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(611 + ,0.072 + ,0.0213 + ,639 + ,0.073 + ,0.0218 + ,630 + ,0.073 + ,0.0290 + ,586 + ,0.073 + ,0.0263 + ,695 + ,0.074 + ,0.0267 + ,552 + ,0.073 + ,0.0181 + ,619 + ,0.074 + ,0.0133 + ,681 + ,0.074 + ,0.0088 + ,421 + ,0.076 + ,0.0128 + ,307 + ,0.076 + ,0.0126 + ,754 + ,0.077 + ,0.0126 + ,690 + ,0.077 + ,0.0129 + ,644 + ,0.078 + ,0.0110 + ,643 + ,0.078 + ,0.0137 + ,608 + ,0.080 + ,0.0121 + ,651 + ,0.081 + ,0.0174 + ,691 + ,0.081 + ,0.0176 + ,627 + ,0.082 + ,0.0148 + ,634 + ,0.081 + ,0.0104 + ,731 + ,0.081 + ,0.0162 + ,475 + ,0.081 + ,0.0149 + ,337 + ,0.080 + ,0.0179 + ,803 + ,0.082 + ,0.0180 + ,722 + ,0.084 + ,0.0158 + ,590 + ,0.084 + ,0.0186 + ,724 + ,0.085 + ,0.0174 + ,627 + ,0.086 + ,0.0159 + ,696 + ,0.085 + ,0.0126 + ,825 + ,0.083 + ,0.0113 + ,677 + ,0.078 + ,0.0192 + ,656 + ,0.078 + ,0.0261 + ,785 + ,0.080 + ,0.0226 + ,412 + ,0.086 + ,0.0241 + ,352 + ,0.089 + ,0.0226 + ,839 + ,0.089 + ,0.0203 + ,729 + ,0.086 + ,0.0286 + ,696 + ,0.083 + ,0.0255 + ,641 + ,0.083 + ,0.0227 + ,695 + ,0.083 + ,0.0226 + ,638 + ,0.084 + ,0.0257 + ,762 + ,0.085 + ,0.0307 + ,635 + ,0.084 + ,0.0276 + ,721 + ,0.086 + ,0.0251 + ,854 + ,0.085 + ,0.0287 + ,418 + ,0.085 + ,0.0314 + ,367 + ,0.085 + ,0.0311 + ,824 + ,0.085 + ,0.0316 + ,687 + ,0.085 + ,0.0247 + ,601 + ,0.085 + ,0.0257 + ,676 + ,0.085 + ,0.0289 + ,740 + ,0.085 + ,0.0263 + ,691 + ,0.086 + ,0.0238 + ,683 + ,0.086 + ,0.0169 + ,594 + ,0.086 + ,0.0196 + ,729 + ,0.086 + ,0.0219 + ,731 + ,0.084 + ,0.0187 + ,386 + ,0.080 + ,0.0160 + ,331 + ,0.079 + ,0.0163 + ,706 + ,0.080 + ,0.0122 + ,715 + ,0.080 + ,0.0121 + ,657 + ,0.080 + ,0.0149 + ,653 + ,0.080 + ,0.0164 + ,642 + ,0.079 + ,0.0166 + ,643 + ,0.079 + ,0.0177 + ,718 + ,0.079 + ,0.0182 + ,654 + ,0.080 + ,0.0178 + ,632 + ,0.079 + ,0.0128 + ,731 + ,0.075 + ,0.0129 + ,392 + ,0.072 + ,0.0137 + ,344 + ,0.070 + ,0.0112 + ,792 + ,0.069 + ,0.0151 + ,852 + ,0.071 + ,0.0224 + ,649 + ,0.071 + ,0.0294 + ,629 + ,0.072 + ,0.0309 + ,685 + ,0.071 + ,0.0346 + ,617 + ,0.069 + ,0.0364 + ,715 + ,0.068 + ,0.0439 + ,715 + ,0.067 + ,0.0415 + ,629 + ,0.067 + ,0.0521 + ,916 + ,0.069 + ,0.0580 + ,531 + ,0.073 + ,0.0591 + ,357 + ,0.074 + ,0.0539 + ,917 + ,0.073 + ,0.0546 + ,828 + ,0.071 + ,0.0472 + ,708 + ,0.070 + ,0.0314 + ,858 + ,0.071 + ,0.0263 + ,775 + ,0.075 + ,0.0232 + ,785 + ,0.077 + ,0.0193 + ,1006 + ,0.078 + ,0.0062 + ,789 + ,0.077 + ,0.0060 + ,734 + ,0.077 + ,-0.0037 + ,906 + ,0.078 + ,-0.0110 + ,532 + ,0.080 + ,-0.0168 + ,387 + ,0.081 + ,-0.0078 + ,991 + ,0.081 + ,-0.0119 + ,841 + ,0.080 + ,-0.0097 + ,892 + ,0.081 + ,-0.0012 + ,782 + ,0.082 + ,0.0026 + ,811 + ,0.083 + ,0.0062 + ,792 + ,0.084 + ,0.0070 + ,978 + ,0.085 + ,0.0166 + ,773 + ,0.085 + ,0.0180 + ,796 + ,0.085 + ,0.0227 + ,946 + ,0.085 + ,0.0246 + ,594 + ,0.085 + ,0.0257 + ,438 + ,0.083 + ,0.0232 + ,1023 + ,0.082 + ,0.0291 + ,868 + ,0.081 + ,0.0301 + ,791 + ,0.079 + ,0.0286 + ,760 + ,0.076 + ,0.0310 + ,779 + ,0.073 + ,0.0322 + ,852 + ,0.071 + ,0.0339 + ,1001 + ,0.070 + ,0.0352 + ,734 + ,0.070 + ,0.0341 + ,996 + ,0.070 + ,0.0335 + ,869 + ,0.070 + ,0.0367 + ,599 + ,0.069 + ,0.0375 + ,426 + ,0.068 + ,0.0360 + ,1138 + ,0.067 + ,0.0355 + ,1091 + ,0.066 + ,0.0357) + ,dim=c(3 + ,120) + ,dimnames=list(c('AantalFaillissementen' + ,'Werkloosheidsgraad' + ,'Inflatie') + ,1:120)) > y <- array(NA,dim=c(3,120),dimnames=list(c('AantalFaillissementen','Werkloosheidsgraad','Inflatie'),1:120)) > 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/1f5qe1324581109.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/2q1gs1324581109.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 = -0.5869, p-value = 0.5573 alternative hypothesis: true tau is not equal to 0 sample estimates: tau -0.03721061 > 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 > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/3vz511324581109.tab") > > try(system("convert tmp/1f5qe1324581109.ps tmp/1f5qe1324581109.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.669 0.105 0.765