R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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. > x <- array(list(0 + ,0 + ,173326 + ,146283 + ,0 + ,0 + ,133131 + ,98364 + ,0 + ,0 + ,258873 + ,86146 + ,0 + ,0 + ,180083 + ,96933 + ,0 + ,0 + ,324799 + ,79234 + ,0 + ,0 + ,230964 + ,42551 + ,0 + ,0 + ,236785 + ,195663 + ,0 + ,0 + ,135473 + ,6853 + ,0 + ,0 + ,202925 + ,21529 + ,0 + ,0 + ,215147 + ,95757 + ,0 + ,0 + ,344297 + ,85584 + ,0 + ,0 + ,153935 + ,143983 + ,0 + ,0 + ,132943 + ,75851 + ,0 + ,0 + ,174724 + ,59238 + ,0 + ,0 + ,174415 + ,93163 + ,0 + ,0 + ,225548 + ,96037 + ,0 + ,0 + ,223632 + ,151511 + ,0 + ,0 + ,124817 + ,136368 + ,0 + ,0 + ,221698 + ,112642 + ,0 + ,0 + ,210767 + ,94728 + ,0 + ,0 + ,170266 + ,105499 + ,0 + ,0 + ,260561 + ,121527 + ,0 + ,0 + ,84853 + ,127766 + ,0 + ,0 + ,294424 + ,98958 + ,0 + ,0 + ,101011 + ,77900 + ,0 + ,0 + ,215641 + ,85646 + ,0 + ,0 + ,325107 + ,98579 + ,0 + ,0 + ,7176 + ,130767 + ,0 + ,0 + ,167542 + ,131741 + ,0 + ,1 + ,106408 + ,53907 + ,0 + ,1 + ,96560 + ,178812 + ,0 + ,1 + ,265769 + ,146761 + ,0 + ,1 + ,269651 + ,82036 + ,0 + ,1 + ,149112 + ,163253 + ,0 + ,1 + ,175824 + ,27032 + ,0 + ,1 + ,152871 + ,171975 + ,0 + ,1 + ,111665 + ,65990 + ,0 + ,1 + ,116408 + ,86572 + ,0 + ,1 + ,362301 + ,159676 + ,0 + ,1 + ,78800 + ,1929 + ,0 + ,1 + ,183167 + ,85371 + ,0 + ,1 + ,277965 + ,58391 + ,0 + ,1 + ,150629 + ,31580 + ,0 + ,1 + ,168809 + ,136815 + ,0 + ,1 + ,24188 + ,120642 + ,0 + ,1 + ,329267 + ,69107 + ,0 + ,1 + ,65029 + ,50495 + ,0 + ,1 + ,101097 + ,108016 + ,0 + ,1 + ,218946 + ,46341 + ,0 + ,1 + ,244052 + ,78348 + ,0 + ,1 + ,341570 + ,79336 + ,0 + ,1 + ,103597 + ,56968 + ,0 + ,1 + ,233328 + ,93176 + ,1 + ,0 + ,256462 + ,161632 + ,1 + ,0 + ,206161 + ,87850 + ,1 + ,0 + ,311473 + ,127969 + ,1 + ,0 + ,235800 + ,15049 + ,1 + ,0 + ,177939 + ,155135 + ,1 + ,0 + ,207176 + ,25109 + ,1 + ,0 + ,196553 + ,45824 + ,1 + ,0 + ,174184 + ,102996 + ,1 + ,0 + ,143246 + ,160604 + ,1 + ,0 + ,187559 + ,158051 + ,1 + ,0 + ,187681 + ,44547 + ,1 + ,0 + ,119016 + ,162647 + ,1 + ,0 + ,182192 + ,174141 + ,1 + ,0 + ,73566 + ,60622 + ,1 + ,0 + ,194979 + ,179566 + ,1 + ,0 + ,167488 + ,184301 + ,1 + ,0 + ,143756 + ,75661 + ,1 + ,0 + ,275541 + ,96144 + ,1 + ,0 + ,243199 + ,129847 + ,1 + ,0 + ,182999 + ,117286 + ,1 + ,0 + ,135649 + ,71180 + ,1 + ,0 + ,152299 + ,109377 + ,1 + ,0 + ,120221 + ,85298 + ,1 + ,1 + ,346485 + ,73631 + ,1 + ,1 + ,145790 + ,86767 + ,1 + ,1 + ,193339 + ,23824 + ,1 + ,1 + ,80953 + ,93487 + ,1 + ,1 + ,122774 + ,82981 + ,1 + ,1 + ,130585 + ,73815 + ,1 + ,1 + ,112611 + ,94552 + ,1 + ,1 + ,286468 + ,132190 + ,1 + ,1 + ,241066 + ,128754 + ,1 + ,1 + ,148446 + ,66363 + ,1 + ,1 + ,204713 + ,67808 + ,1 + ,1 + ,182079 + ,61724 + ,1 + ,1 + ,140344 + ,131722 + ,1 + ,1 + ,220516 + ,68580 + ,1 + ,1 + ,243060 + ,106175 + ,1 + ,1 + ,162765 + ,55792 + ,1 + ,1 + ,182613 + ,25157 + ,1 + ,1 + ,232138 + ,76669 + ,1 + ,1 + ,265318 + ,57283 + ,1 + ,1 + ,85574 + ,105805 + ,1 + ,1 + ,310839 + ,129484 + ,1 + ,1 + ,225060 + ,72413 + ,1 + ,1 + ,232317 + ,87831 + ,1 + ,1 + ,144966 + ,96971 + ,1 + ,1 + ,43287 + ,71299 + ,1 + ,1 + ,155754 + ,77494 + ,1 + ,1 + ,164709 + ,120336 + ,1 + ,1 + ,201940 + ,93913 + ,1 + ,1 + ,235454 + ,136048 + ,1 + ,1 + ,220801 + ,181248) + ,dim=c(4 + ,106) + ,dimnames=list(c('POP' + ,'Gender' + ,'Time_RFC_sec' + ,'Compendium_writing_time_sec') + ,1:106)) > y <- array(NA,dim=c(4,106),dimnames=list(c('POP','Gender','Time_RFC_sec','Compendium_writing_time_sec'),1:106)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par1 = 'pearson' > main = 'Correlation Matrix' > panel.tau <- function(x, y, digits=2, prefix='', cex.cor) + { + usr <- par('usr'); on.exit(par(usr)) + par(usr = c(0, 1, 0, 1)) + rr <- cor.test(x, y, method=par1) + r <- round(rr$p.value,2) + txt <- format(c(r, 0.123456789), digits=digits)[1] + txt <- paste(prefix, txt, sep='') + if(missing(cex.cor)) cex <- 0.5/strwidth(txt) + text(0.5, 0.5, txt, cex = cex) + } > panel.hist <- function(x, ...) + { + usr <- par('usr'); on.exit(par(usr)) + par(usr = c(usr[1:2], 0, 1.5) ) + h <- hist(x, plot = FALSE) + breaks <- h$breaks; nB <- length(breaks) + y <- h$counts; y <- y/max(y) + rect(breaks[-nB], 0, breaks[-1], y, col='grey', ...) + } > postscript(file="/var/wessaorg/rcomp/tmp/1q3wd1355072591.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > pairs(t(y),diag.panel=panel.hist, upper.panel=panel.smooth, lower.panel=panel.tau, main=main) > dev.off() null device 1 > > #Note: the /var/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/rcomp/createtable") > > n <- length(y[,1]) > n [1] 4 > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,paste('Correlations for all pairs of data series (method=',par1,')',sep=''),n+1,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,' ',header=TRUE) > for (i in 1:n) { + a<-table.element(a,dimnames(t(x))[[2]][i],header=TRUE) + } > a<-table.row.end(a) > for (i in 1:n) { + a<-table.row.start(a) + a<-table.element(a,dimnames(t(x))[[2]][i],header=TRUE) + for (j in 1:n) { + r <- cor.test(y[i,],y[j,],method=par1) + a<-table.element(a,round(r$estimate,3)) + } + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/2vxz81355072591.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Correlations for all pairs of data series with p-values',4,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'pair',1,TRUE) > a<-table.element(a,'Pearson r',1,TRUE) > a<-table.element(a,'Spearman rho',1,TRUE) > a<-table.element(a,'Kendall tau',1,TRUE) > a<-table.row.end(a) > cor.test(y[1,],y[2,],method=par1) Pearson's product-moment correlation data: y[1, ] and y[2, ] t = 1.1622, df = 104, p-value = 0.2478 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: -0.07923918 0.29755626 sample estimates: cor 0.1132277 > for (i in 1:(n-1)) + { + for (j in (i+1):n) + { + a<-table.row.start(a) + dum <- paste(dimnames(t(x))[[2]][i],';',dimnames(t(x))[[2]][j],sep='') + a<-table.element(a,dum,header=TRUE) + rp <- cor.test(y[i,],y[j,],method='pearson') + a<-table.element(a,round(rp$estimate,4)) + rs <- cor.test(y[i,],y[j,],method='spearman') + a<-table.element(a,round(rs$estimate,4)) + rk <- cor.test(y[i,],y[j,],method='kendall') + a<-table.element(a,round(rk$estimate,4)) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'p-value',header=T) + a<-table.element(a,paste('(',round(rp$p.value,4),')',sep='')) + a<-table.element(a,paste('(',round(rs$p.value,4),')',sep='')) + a<-table.element(a,paste('(',round(rk$p.value,4),')',sep='')) + a<-table.row.end(a) + } + } Warning messages: 1: In cor.test.default(y[i, ], y[j, ], method = "spearman") : Cannot compute exact p-values with ties 2: In cor.test.default(y[i, ], y[j, ], method = "spearman") : Cannot compute exact p-values with ties 3: In cor.test.default(y[i, ], y[j, ], method = "spearman") : Cannot compute exact p-values with ties 4: In cor.test.default(y[i, ], y[j, ], method = "spearman") : Cannot compute exact p-values with ties 5: In cor.test.default(y[i, ], y[j, ], method = "spearman") : Cannot compute exact p-values with ties > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/3z82r1355072591.tab") > > try(system("convert tmp/1q3wd1355072591.ps tmp/1q3wd1355072591.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.261 0.165 1.396