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. > x <- array(list(631.923 + ,9.911 + ,58608 + ,654.294 + ,8.915 + ,46865 + ,671.833 + ,9.452 + ,51378 + ,586.840 + ,9.112 + ,46235 + ,600.969 + ,8.472 + ,47206 + ,625.568 + ,8.230 + ,45382 + ,558.110 + ,8.384 + ,41227 + ,630.577 + ,8.625 + ,33795 + ,628.654 + ,8.221 + ,31295 + ,603.184 + ,8.649 + ,42625 + ,656.255 + ,8.625 + ,33625 + ,600.730 + ,10.443 + ,21538 + ,670.326 + ,10.357 + ,56421 + ,678.423 + ,8.586 + ,53152 + ,641.502 + ,8.892 + ,53536 + ,625.311 + ,8.329 + ,52408 + ,628.177 + ,8.101 + ,41454 + ,589.767 + ,7.922 + ,38271 + ,582.471 + ,8.120 + ,35306 + ,636.248 + ,7.838 + ,26414 + ,599.885 + ,7.735 + ,31917 + ,621.694 + ,8.406 + ,38030 + ,637.406 + ,8.209 + ,27534 + ,595.994 + ,9.451 + ,18387 + ,696.308 + ,10.041 + ,50556 + ,674.201 + ,9.411 + ,43901 + ,648.861 + ,10.405 + ,48572 + ,649.605 + ,8.467 + ,43899 + ,672.392 + ,8.464 + ,37532 + ,598.396 + ,8.102 + ,40357 + ,613.177 + ,7.627 + ,35489 + ,638.104 + ,7.513 + ,29027 + ,615.632 + ,7.510 + ,34485 + ,634.465 + ,8.291 + ,42598 + ,638.686 + ,8.064 + ,30306 + ,604.243 + ,9.383 + ,26451 + ,706.669 + ,9.706 + ,47460 + ,677.185 + ,8.579 + ,50104 + ,644.328 + ,9.474 + ,61465 + ,664.825 + ,8.318 + ,53726 + ,605.707 + ,8.213 + ,39477 + ,600.136 + ,8.059 + ,43895 + ,612.166 + ,9.111 + ,31481 + ,599.659 + ,7.708 + ,29896 + ,634.210 + ,7.680 + ,33842 + ,618.234 + ,8.014 + ,39120 + ,613.576 + ,8.007 + ,33702 + ,627.200 + ,8.718 + ,25094 + ,668.973 + ,9.486 + ,51442 + ,651.479 + ,9.113 + ,45594 + ,619.661 + ,9.025 + ,52518 + ,644.260 + ,8.476 + ,48564 + ,579.936 + ,7.952 + ,41745 + ,601.752 + ,7.759 + ,49585 + ,595.376 + ,7.835 + ,32747 + ,588.902 + ,7.600 + ,33379 + ,634.341 + ,7.651 + ,35645 + ,594.305 + ,8.319 + ,37034 + ,606.200 + ,8.812 + ,35681 + ,610.926 + ,8.630 + ,20972) + ,dim=c(3 + ,60) + ,dimnames=list(c('WERKLOOSHEID' + ,'OVERLIJDENS' + ,'INSCHRIJVINGEN') + ,1:60)) > y <- array(NA,dim=c(3,60),dimnames=list(c('WERKLOOSHEID','OVERLIJDENS','INSCHRIJVINGEN'),1:60)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par1 = 'kendall' > 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/1gw7f1324634938.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] 3 > 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/26eln1324634938.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) Kendall's rank correlation tau data: y[1, ] and y[2, ] z = 3.0423, p-value = 0.002348 alternative hypothesis: true tau is not equal to 0 sample estimates: tau 0.2695677 > 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 > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/3tkyk1324634939.tab") > > try(system("convert tmp/1gw7f1324634938.ps tmp/1gw7f1324634938.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.594 0.087 0.685