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(68897 + ,374.92 + ,38683 + ,375.63 + ,44720 + ,376.51 + ,39525 + ,377.75 + ,45315 + ,378.54 + ,50380 + ,378.21 + ,40600 + ,376.65 + ,36279 + ,374.28 + ,42438 + ,373.12 + ,38064 + ,373.1 + ,31879 + ,374.67 + ,11379 + ,375.97 + ,70249 + ,377.03 + ,39253 + ,377.87 + ,47060 + ,378.88 + ,41697 + ,380.42 + ,38708 + ,380.62 + ,49267 + ,379.66 + ,39018 + ,377.48 + ,32228 + ,376.07 + ,40870 + ,374.1 + ,39383 + ,374.47 + ,34571 + ,376.15 + ,12066 + ,377.51 + ,70938 + ,378.43 + ,34077 + ,379.7 + ,45409 + ,380.91 + ,40809 + ,382.2 + ,37013 + ,382.45 + ,44953 + ,382.14 + ,37848 + ,380.6 + ,32745 + ,378.6 + ,39401 + ,376.72 + ,34931 + ,376.98 + ,33008 + ,378.29 + ,8620 + ,380.07 + ,68906 + ,381.36 + ,39556 + ,382.19 + ,50669 + ,382.65 + ,36432 + ,384.65 + ,40891 + ,384.94 + ,48428 + ,384.01 + ,36222 + ,382.15 + ,33425 + ,380.33 + ,39401 + ,378.81 + ,37967 + ,379.06 + ,34801 + ,380.17 + ,12657 + ,381.85 + ,69116 + ,382.88 + ,41519 + ,383.77 + ,51321 + ,384.42 + ,38529 + ,386.36 + ,41547 + ,386.53 + ,52073 + ,386.01 + ,38401 + ,384.45 + ,40898 + ,381.96 + ,40439 + ,380.81 + ,41888 + ,381.09 + ,37898 + ,382.37 + ,8771 + ,383.84 + ,68184 + ,385.42 + ,50530 + ,385.72 + ,47221 + ,385.96 + ,41756 + ,387.18 + ,45633 + ,388.5 + ,48138 + ,387.88 + ,39486 + ,386.38 + ,39341 + ,384.15 + ,41117 + ,383.07 + ,41629 + ,382.98 + ,29722 + ,384.11 + ,7054 + ,385.54 + ,56676 + ,386.92 + ,34870 + ,387.41 + ,35117 + ,388.77 + ,30169 + ,389.46 + ,30936 + ,390.18 + ,35699 + ,389.43 + ,33228 + ,387.74 + ,27733 + ,385.91 + ,33666 + ,384.77 + ,35429 + ,384.38 + ,27438 + ,385.99 + ,8170 + ,387.26) + ,dim=c(2 + ,84) + ,dimnames=list(c('VK/m' + ,'COČ/m') + ,1:84)) > y <- array(NA,dim=c(2,84),dimnames=list(c('VK/m','COČ/m'),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' > 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/1h95b1323440117.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] 2 > 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/2jtvi1323440117.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 = -0.5629, df = 82, p-value = 0.575 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: -0.2728120 0.1544032 sample estimates: cor -0.06204589 > 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 message: 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/33p8p1323440117.tab") > > try(system("convert tmp/1h95b1323440117.ps tmp/1h95b1323440117.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.525 0.075 0.596