R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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(77,51,54,70,59,76,77,73,71,64,75,56,52,64,57,66,101,62,75,61,124,61,66,70,59,50,61,60,41,100,71,73,76,52,63,65,54,69,86,67,53,80,59,80,82,55,NA,NA,56,75,85,57,73,107,NA,64,65,74,70,58,69,71,76,75,98,59,63,62,51,76,61,66,54,57,50,NA,55,64,70,70,60,56,52,55,56,61,66,53,59,56,68,56,86,71,87,57,101,50,52,NA,55,63,47,45,63,51,51,55,64,55,90,79,57,67,77,62,83,94,76,66,77,73,68,55,NA,56,NA,45,68,44,61,89,53,47,84,53,62,NA,91,83,68,53,55,55,66,55,55,55,67,86,58,47,45,NA,44,58,68,NA,NA,56,50,54,52,58,58,59,62,66,95,50,75,NA,61,NA,64,68,NA,67,82,68,78,NA,NA,59,70,56,55,54,75,49,93,86,59,51,61,71,80,NA,91,81) > x <- c(77,58,53,68,59,76,76,69,71,65,70,166,51,64,52,65,92,62,76,61,119,61,65,66,54,50,63,58,39,101,71,75,79,52,68,64,56,69,88,65,54,80,63,78,85,54,73,49,54,75,82,56,74,102,64,65,66,73,75,57,68,71,71,78,97,60,64,64,52,80,62,66,55,56,50,50,50,63,69,69,61,55,53,60,56,59,62,53,57,57,70,56,84,69,88,56,103,50,52,55,55,63,47,45,62,53,52,57,64,59,84,79,55,67,76,62,83,96,75,65,78,69,68,55,67,52,47,45,68,44,62,87,56,50,83,53,64,62,90,85,66,52,53,54,64,55,55,59,70,88,57,47,47,55,48,54,69,59,58,57,51,54,53,59,56,59,63,66,96,53,76,54,61,82,62,71,60,66,81,68,80,43,82,63,70,56,60,58,76,50,88,89,59,51,62,74,83,81,90,79) > par2 = 'two.sided' > par1 = 'pearson' > ylab = 'weight' > xlab = 'self_reported_weight' > par2 <- 'two.sided' > par1 <- 'pearson' > #'GNU S' R Code compiled by R2WASP v. 1.2.291 () > #Author: root > #To cite this work: Ian E. Holliday, 2012, Pregnancy and Cognition (v1.0.3) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_Pregnancy%20and%20cognition.wasp/ > #Source of accompanying publication: > # > postscript(file="/var/wessaorg/rcomp/tmp/1zv0v1338544066.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.8707, p-value = 4.919e-12 > (sw2<-shapiro.test(y)) Shapiro-Wilk normality test data: y W = 0.9378, p-value = 4.164e-07 > (cxy<-cor.test(x, y, method=par1)) Pearson's product-moment correlation data: x and y t = 20.4839, df = 181, p-value < 2.2e-16 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: 0.7860942 0.8748298 sample estimates: cor 0.8358414 > > #Note: the /var/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/2c2yu1338544066.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/wessaorg/rcomp/tmp/3qknf1338544066.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/wessaorg/rcomp/tmp/4e3mj1338544066.tab") > > try(system("convert tmp/1zv0v1338544066.ps tmp/1zv0v1338544066.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.556 0.123 0.670