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,56,75,85,57,73,107,64,74,70,58,69,71,76,75,98,59,63,62,51,76,61,66,54,57,50,55,64,70,70,60,56,52,55,56,61,66,53,59,56,68,56,86,71,87,57,101,50,52,55,63,47,45,63,51,51,55,64,55,90,79,57,67,77,62,83,94,76,66,77,73,68,55,45,68,44,61,89,53,47,84,53,62,91,83,68,53,55,55,66,55,55,55,67,86,58,47,45,44,58,68,56,50,54,52,58,58,59,62,66,95,50,75,61,64,68,67,82,68,78,59,70,56,55,54,75,49,93,86,59,51,61,71,80,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,54,75,82,56,74,102,65,73,75,57,68,71,71,78,97,60,64,64,52,80,62,66,55,56,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,63,47,45,62,53,52,57,64,59,84,79,55,67,76,62,83,96,75,65,78,69,68,55,45,68,44,62,87,56,50,83,53,64,90,85,66,52,53,54,64,55,55,59,70,88,57,47,47,48,54,69,57,51,54,53,59,56,59,63,66,96,53,76,61,62,71,66,81,68,80,63,70,56,60,58,76,50,88,89,59,51,62,74,83,90,79)
par2 = 'two.sided'
par1 = 'pearson'
ylab = 'weight'
xlab = 'repwt'
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/1ezn21337337977.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()
(sw1<-shapiro.test(x))
(sw2<-shapiro.test(y))
(cxy<-cor.test(x, y, method=par1))

#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/2cjn31337337977.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/38hms1337337977.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/4gwdu1337337977.tab") 

try(system("convert tmp/1ezn21337337977.ps tmp/1ezn21337337977.png",intern=TRUE))

