R version 2.9.0 (2009-04-17) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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(631923 + ,-12 + ,-10.8 + ,654294 + ,-13 + ,-12.2 + ,671833 + ,-16 + ,-14.1 + ,586840 + ,-10 + ,-15.2 + ,600969 + ,-4 + ,-15.8 + ,625568 + ,-9 + ,-15.8 + ,558110 + ,-8 + ,-14.9 + ,630577 + ,-9 + ,-12.6 + ,628654 + ,-3 + ,-9.9 + ,603184 + ,-13 + ,-7.8 + ,656255 + ,-3 + ,-6 + ,600730 + ,-1 + ,-5 + ,670326 + ,-2 + ,-4.5 + ,678423 + ,0 + ,-3.9 + ,641502 + ,0 + ,-2.9 + ,625311 + ,-3 + ,-1.5 + ,628177 + ,0 + ,-0.5 + ,589767 + ,5 + ,0 + ,582471 + ,3 + ,0.5 + ,636248 + ,4 + ,0.9 + ,599885 + ,3 + ,0.8 + ,621694 + ,1 + ,0.1 + ,637406 + ,-1 + ,-1 + ,596994 + ,0 + ,-2 + ,696308 + ,-2 + ,-3 + ,674201 + ,-1 + ,-3.7 + ,648861 + ,2 + ,-4.7 + ,649605 + ,0 + ,-6.4 + ,672392 + ,-6 + ,-7.5 + ,598396 + ,-7 + ,-7.8 + ,613177 + ,-6 + ,-7.7 + ,638104 + ,-4 + ,-6.6 + ,615632 + ,-9 + ,-4.2 + ,634465 + ,-2 + ,-2 + ,638686 + ,-3 + ,-0.7 + ,604243 + ,2 + ,0.1 + ,706669 + ,3 + ,0.9 + ,677185 + ,1 + ,2.1 + ,644328 + ,0 + ,3.5 + ,644825 + ,1 + ,4.9 + ,605707 + ,1 + ,5.7 + ,600136 + ,3 + ,6.2 + ,612166 + ,5 + ,6.5 + ,599659 + ,5 + ,6.5 + ,634210 + ,4 + ,6.3 + ,618234 + ,11 + ,6.2 + ,613576 + ,8 + ,6.4 + ,627200 + ,-1 + ,6.3 + ,668973 + ,4 + ,5.8 + ,651479 + ,4 + ,5.1 + ,619661 + ,4 + ,5.1 + ,644260 + ,6 + ,5.8 + ,579936 + ,6 + ,6.7 + ,601752 + ,6 + ,7.1 + ,595376 + ,6 + ,6.7 + ,588902 + ,4 + ,5.5 + ,634341 + ,1 + ,4.2 + ,594305 + ,6 + ,3 + ,606200 + ,0 + ,2.2 + ,610926 + ,2 + ,2 + ,633685 + ,-2 + ,1.8 + ,639696 + ,0 + ,1.8 + ,659451 + ,1 + ,1.5 + ,593248 + ,-3 + ,0.4 + ,606677 + ,-3 + ,-0.9 + ,599434 + ,-5 + ,-1.7 + ,569578 + ,-7 + ,-2.6 + ,629873 + ,-7 + ,-4.4 + ,613438 + ,-5 + ,-8.3 + ,604172 + ,-13 + ,-14.4 + ,658328 + ,-16 + ,-21.3 + ,612633 + ,-20 + ,-26.5 + ,707372 + ,-18 + ,-29.2 + ,739770 + ,-21 + ,-30.8 + ,777535 + ,-20 + ,-30.9 + ,685030 + ,-16 + ,-29.5 + ,730234 + ,-14 + ,-27.1 + ,714154 + ,-12 + ,-24.4 + ,630872 + ,-10 + ,-21.9 + ,719492 + ,-3 + ,-19.3 + ,677023 + ,-4 + ,-17 + ,679272 + ,-4 + ,-13.8 + ,718317 + ,-1 + ,-9.9 + ,645672 + ,-8 + ,-7.9) + ,dim=c(3 + ,84) + ,dimnames=list(c('Werkloosheid' + ,'Consumentenvertrouwen' + ,'Ondernemersvertrouwen') + ,1:84)) > y <- array(NA,dim=c(3,84),dimnames=list(c('Werkloosheid','Consumentenvertrouwen','Ondernemersvertrouwen'),1:84)) > 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' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Patrick Wessa > #To cite this work: Patrick Wessa, (2010), Multivariate Correlation Matrix (v1.0.4) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/Patrick.Wessa/rwasp_pairs.wasp#output/ > #Source of accompanying publication: > #Technical description: > 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/www/html/rcomp/tmp/1tija1292963372.ps",horizontal=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/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/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/www/html/rcomp/tmp/2w0hx1292963372.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 = -3.7422, df = 82, p-value = 0.0003372 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: -0.5511902 -0.1824751 sample estimates: cor -0.3819285 > 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/www/html/rcomp/tmp/3asxo1292963372.tab") > > try(system("convert tmp/1tija1292963372.ps tmp/1tija1292963372.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.469 0.201 1.213