R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: i686-pc-linux-gnu (32-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > y <- c(45,50,49,55,39,68,69,56,58,48,34,50,76,49,51,53,36,62,46,50,47,50,44,50,29,49,26,79,53,53,72,35,42,37,46,48,46,49,65,52,75,58,43,60,43,51,70,69,65,63,44,61,40,62,59,47,50,50,65,54,44,66,34,74,57,60,36,50,60,45,55,44,57,33,30,64,49,76,40,48,65,50,70,78,44,48,52,40) > x <- c(111,102,108,109,118,79,88,102,105,92,131,104,83,84,85,110,121,120,100,94,89,93,128,84,127,106,129,82,106,109,91,111,105,118,103,101,101,95,108,95,98,82,100,100,107,95,97,93,81,89,111,95,106,83,81,115,112,92,85,95,115,91,107,102,86,96,114,105,82,120,88,90,85,106,109,75,91,96,108,86,98,99,95,88,111,103,107,118) > par2 = 'two.sided' > par1 = 'pearson' > ylab = 'y' > xlab = 'x' > postscript(file="/var/fisher/rcomp/tmp/1jbl61386082157.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x,y, xlab=xlab, ylab=ylab) > abline(coef=(lm(y ~ x))$coeff, col='red') > ctp<-cor.test(x, y, use='pair', method='pearson') > legend('bottomright', c('cor =', as.character(round(ctp$estimate, digits=4)))) > dev.off() null device 1 > (sw1<-shapiro.test(x)) Shapiro-Wilk normality test data: x W = 0.9796, p-value = 0.18 > (sw2<-shapiro.test(y)) Shapiro-Wilk normality test data: y W = 0.9802, p-value = 0.1977 > (cxy<-cor.test(x, y, method=par1)) Pearson's product-moment correlation data: x and y t = -7.5051, df = 86, p-value = 5.244e-11 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: -0.7409108 -0.4833297 sample estimates: cor -0.6290895 > > #Note: the /var/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/fisher/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,paste('Shapiro Test (', xlab,')',sep=''),3,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Statistic W',header=TRUE) > a<-table.element(a,'Probability',header=TRUE) > a<-table.element(a,'Link',header=TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,round(sw1$statistic, digits=4)) > a<-table.element(a,round(sw1$p.value, digits=4)) > a<-table.element(a,hyperlink('http://en.wikipedia.org/wiki/Shapiro%E2%80%93Wilk_test','Shapiro-Wilk Test','Shapiro-Wilk Test')) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/fisher/rcomp/tmp/21saw1386082157.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, paste('Shapiro Test (', ylab,')',sep=''),3,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Statistic W',header=TRUE) > a<-table.element(a,'probability',header=TRUE) > a<-table.element(a,'Link',header=TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,round(sw2$statistic, digits=4)) > a<-table.element(a,round(sw2$p.value, digits=4)) > a<-table.element(a,hyperlink('http://en.wikipedia.org/wiki/Shapiro%E2%80%93Wilk_test','Shapiro-Wilk Test','Shapiro-Wilk Test')) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/fisher/rcomp/tmp/354bh1386082157.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Correlation Test X-Y',5,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Statistic',header=TRUE) > a<-table.element(a,'Value',header=TRUE) > a<-table.element(a,'probability',header=TRUE) > a<-table.element(a,'Method',header=TRUE) > a<-table.element(a,'alternative',header=TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,names(cxy$estimate)) > a<-table.element(a,round(cxy$estimate, digits=4)) > a<-table.element(a,round(cxy$p.value, digits=4)) > a<-table.element(a,cxy$method) > a<-table.element(a,cxy$alternative) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/fisher/rcomp/tmp/48ja61386082157.tab") > > try(system("convert tmp/1jbl61386082157.ps tmp/1jbl61386082157.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.114 0.615 2.668