source('/home/pw/wessanet/cretab') myrfcuid = '' y <- c(5,4,4,4,5,4,4,4,2,4,5,4,3,5,3,4,4,4,3,3,4,4,4,4,2,2,5,2,5,4,4,5,4,4,3,4,3,4,4,2,4,5) x <- c(22,23,22,22,22,22,22,20,22,22,28,23,20,22,22,32,22,23,22,22,22,31,23,22,23,23,22,22,22,22,21,22,21,22,23,20,21,23,22,20,22,22) ylab = 'y' xlab = 'x' #'GNU S' R Code compiled by R2WASP v. 1.2.327 (Sat, 15 Jul 2017 00:19:43 +0200) #Author: root #To cite this work: Wessa P., (2017), Spearman Rank Correlation (v1.0.3) in Free Statistics Software (v$_version), Office for Research Development and Education, URL https://www.wessa.net/rwasp_spearman.wasp/ #Source of accompanying publication: Office for Research, Development, and Education # k <- cor.test(x,y,method='spearman') postscript(file="/home/pw/wessanet/rcomp/tmp/1ntvi1581325996.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) plot(x,y,main='Scatterplot',xlab=xlab,ylab=ylab) grid() dev.off() postscript(file="/home/pw/wessanet/rcomp/tmp/2nwl61581325996.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) plot(rank(x),rank(y),main='Scatterplot of Ranks',xlab=xlab,ylab=ylab) grid() dev.off() a<-table.start() a<-table.row.start(a) a<-table.element(a,'Spearman Rank Correlation',2,TRUE) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'rho',header=TRUE) a<-table.element(a,k$estimate) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'2-sided p-value',header=TRUE) a<-table.element(a,k$p.value) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'S',header=TRUE) a<-table.element(a,k$statistic) a<-table.row.end(a) a<-table.end(a) table.save(a,file="/home/pw/wessanet/rcomp/tmp/3svc61581325996.tab") try(system("convert /home/pw/wessanet/rcomp/tmp/1ntvi1581325996.ps /home/pw/wessanet/rcomp/tmp/1ntvi1581325996.png",intern=TRUE)) try(system("convert /home/pw/wessanet/rcomp/tmp/2nwl61581325996.ps /home/pw/wessanet/rcomp/tmp/2nwl61581325996.png",intern=TRUE))