R version 3.0.1 (2013-05-16) -- "Good Sport" 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(51,54,59,52,64,57,66,62,61,61,59,50,61,60,41,71,52,63,54,53,59,55,56,75,57,75,59,63,62,51,61,54,57,50,55,64,60,52,55,56,53,59,56,56,57,50,52,55,47,45,63,51,51,55,64,55,57,77,62,68,55,45,68,44,61,53,47,53,62,53,55,55,66,55,55,55,67,58,47,45,44,56,50,54,52,58,59,62,66,50,59,56,55,54,49,59,51,61) > x <- c(161,161,157,161,168,163,166,168,175,170,171,166,169,166,157,166,164,169,166,164,163,160,174,162,165,173,162,165,164,158,175,165,163,166,160,160,165,169,167,170,165,163,162,161,165,169,159,164,163,163,175,164,152,167,166,166,174,167,168,178,165,157,171,157,166,160,148,162,172,163,165,176,171,160,165,157,173,168,162,150,163,167,163,161,162,172,159,170,166,158,165,162,172,169,158,164,156,164) > par2 = 'two.sided' > par1 = 'spearman' > ylab = 'RepHt' > xlab = 'Height' > postscript(file="/var/wessaorg/rcomp/tmp/1tc4s1378100965.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.9839, p-value = 0.277 > (sw2<-shapiro.test(y)) Shapiro-Wilk normality test data: y W = 0.976, p-value = 0.06961 > (cxy<-cor.test(x, y, method=par1)) Spearman's rank correlation rho data: x and y S = 70346.27, p-value = 3.973e-09 alternative hypothesis: true rho is not equal to 0 sample estimates: rho 0.5515032 Warning message: In cor.test.default(x, y, method = par1) : Cannot compute exact p-value with ties > > #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/21thm1378100965.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/3h8ka1378100965.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/46b9t1378100965.tab") > > try(system("convert tmp/1tc4s1378100965.ps tmp/1tc4s1378100965.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.345 0.295 1.639