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(105.31 + ,1576.23 + ,29.29 + ,710.45 + ,105.63 + ,1546.37 + ,28.99 + ,720 + ,106.02 + ,1545.05 + ,28.91 + ,720 + ,105.85 + ,1552.34 + ,29.29 + ,720 + ,106.57 + ,1594.3 + ,30.96 + ,754.78 + ,106.48 + ,1605.78 + ,30.57 + ,802.73 + ,106.60 + ,1673.21 + ,30.59 + ,845.24 + ,106.75 + ,1612.94 + ,31.39 + ,893.91 + ,106.69 + ,1566.34 + ,31.28 + ,931.43 + ,106.69 + ,1530.17 + ,31.1 + ,940 + ,106.93 + ,1582.54 + ,31.7 + ,947.73 + ,107.21 + ,1702.16 + ,32.57 + ,960 + ,107.88 + ,1701.93 + ,32.49 + ,996.96 + ,108.84 + ,1811.15 + ,32.46 + ,1000 + ,108.96 + ,1924.2 + ,32.3 + ,1000 + ,109.52 + ,2034.25 + ,32.97 + ,1000 + ,108.45 + ,2011.13 + ,32.9 + ,1013.04 + ,108.67 + ,2013.04 + ,32.93 + ,1095.24 + ,108.96 + ,2151.67 + ,33.72 + ,1159.09 + ,108.76 + ,1902.09 + ,33.33 + ,1200 + ,107.85 + ,1944.01 + ,33.44 + ,1200 + ,108.78 + ,1916.67 + ,33.89 + ,1282.61 + ,107.51 + ,1967.31 + ,34.34 + ,1513.64 + ,108.83 + ,2119.88 + ,33.56 + ,1669.05 + ,111.54 + ,2216.38 + ,32.67 + ,1700 + ,111.74 + ,2522.83 + ,32.57 + ,1700 + ,112.04 + ,2647.64 + ,33.23 + ,1700 + ,111.74 + ,2631.23 + ,32.85 + ,1665.91 + ,111.81 + ,2693.41 + ,32.61 + ,1650 + ,111.86 + ,3021.76 + ,32.57 + ,1650 + ,114.23 + ,2953.67 + ,32.98 + ,1619.57 + ,114.80 + ,2796.8 + ,31.33 + ,1599.05 + ,115.17 + ,2672.05 + ,29.8 + ,1572.73 + ,115.11 + ,2251.23 + ,28.06 + ,1470 + ,114.43 + ,2046.08 + ,25.47 + ,1268 + ,114.66 + ,2420.04 + ,24.65 + ,1217.39 + ,115.11 + ,2608.89 + ,23.94 + ,1154.09 + ,117.74 + ,2660.47 + ,23.89 + ,984 + ,118.18 + ,2493.98 + ,23.54 + ,900 + ,118.56 + ,2541.7 + ,24.28 + ,900 + ,117.63 + ,2554.6 + ,25.51 + ,916.67 + ,117.71 + ,2699.61 + ,27.03 + ,957.73 + ,117.46 + ,2805.48 + ,27.09 + ,966.09 + ,117.37 + ,2956.66 + ,27.3 + ,980 + ,117.34 + ,3149.51 + ,27.11 + ,990.91 + ,117.09 + ,3372.5 + ,26.39 + ,1000.91 + ,116.65 + ,3379.33 + ,27.54 + ,1042.38 + ,116.71 + ,3517.54 + ,26.85 + ,1142.61 + ,116.82 + ,3527.34 + ,26.82 + ,1214.29 + ,117.33 + ,3281.06 + ,25.9 + ,1218 + ,117.95 + ,3089.65 + ,24.96 + ,1202.61 + ,123.53 + ,3222.76 + ,25.4 + ,1200 + ,124.91 + ,3165.76 + ,24.38 + ,1228.57 + ,125.99 + ,3232.43 + ,24.73 + ,1195.91 + ,126.29 + ,3229.54 + ,25.43 + ,1180 + ,125.68 + ,3071.74 + ,26.04 + ,1210.91 + ,125.52 + ,2850.17 + ,25.59 + ,1272.27) + ,dim=c(4 + ,57) + ,dimnames=list(c('PC&S' + ,'PCacao' + ,'PSuiker' + ,'PNoten') + ,1:57)) > y <- array(NA,dim=c(4,57),dimnames=list(c('PC&S','PCacao','PSuiker','PNoten'),1:57)) > 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' > #'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/19ind1292929165.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] 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/www/html/rcomp/tmp/25ak31292929165.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 = 7.5867, p-value = 3.286e-14 alternative hypothesis: true tau is not equal to 0 sample estimates: tau 0.6913431 > 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 6: 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/3jkiv1292929165.tab") > try(system("convert tmp/19ind1292929165.ps tmp/19ind1292929165.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.535 0.199 1.229