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(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) > x <- c(52,55,80,45,60,34,45,68,26,70,85,54,55,40,55,50,71,55,70,55,60,65,66,55,90,55,60,35,55,26,14,45,35,65,35,60,60,60,65,45,20,50,60,48,40,55,54,40,40,34,60,30,75,24,30,80,60,46,35,60,75,54,78,20,45,60,70,35,20,60,20,50,50,75,70,20,45,20,50,55,15,26,25,30,60,40,40,50) > par2 = 'two.sided' > par1 = 'pearson' > ylab = 'IQ' > xlab = 'GRADES' > postscript(file="/var/fisher/rcomp/tmp/1yd4l1386067945.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.9777, p-value = 0.1327 > (sw2<-shapiro.test(y)) Shapiro-Wilk normality test data: y W = 0.9796, p-value = 0.18 > (cxy<-cor.test(x, y, method=par1)) Pearson's product-moment correlation data: x and y t = 5.6739, df = 86, p-value = 1.843e-07 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: 0.3507983 0.6592747 sample estimates: cor 0.5218958 > > #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/227dx1386067945.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/31b0c1386067945.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/4js1c1386067945.tab") > > try(system("convert tmp/1yd4l1386067945.ps tmp/1yd4l1386067945.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.294 0.429 1.695