R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-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(18897 + ,22424 + ,19364 + ,19434 + ,22831 + ,23072 + ,37471 + ,14690 + ,17518 + ,22125 + ,18586 + ,18389 + ,22727 + ,22551 + ,36160 + ,13824 + ,8632 + ,7653 + ,8225 + ,8405 + ,8344 + ,8695 + ,9197 + ,9477 + ,832 + ,554 + ,822 + ,854 + ,830 + ,935 + ,1051 + ,1150 + ,3351 + ,3357 + ,3270 + ,3346 + ,3235 + ,3329 + ,3480 + ,3447 + ,8 + ,8 + ,3 + ,4 + ,5 + ,5 + ,4 + ,4 + ,1 + ,1 + ,1 + ,1 + ,1 + ,1 + ,1 + ,2 + ,7 + ,10 + ,11 + ,9 + ,10 + ,9 + ,10 + ,9 + ,217 + ,222 + ,204 + ,205 + ,191 + ,197 + ,196 + ,191 + ,911 + ,947 + ,918 + ,939 + ,937 + ,967 + ,1007 + ,962 + ,1932 + ,1901 + ,1862 + ,1921 + ,1823 + ,1879 + ,1982 + ,2003 + ,274 + ,267 + ,270 + ,267 + ,269 + ,271 + ,281 + ,276 + ,131 + ,109 + ,87 + ,66 + ,68 + ,64 + ,76 + ,81 + ,1708 + ,1668 + ,1738 + ,1715 + ,1726 + ,1771 + ,1861 + ,2079 + ,2609 + ,1965 + ,2308 + ,2424 + ,2486 + ,2594 + ,2729 + ,2720 + ,133 + ,32 + ,119 + ,89 + ,93 + ,107 + ,102 + ,23 + ,2476 + ,1933 + ,2189 + ,2335 + ,2393 + ,2487 + ,2627 + ,2697 + ,10 + ,37 + ,23 + ,21 + ,22 + ,27 + ,21 + ,18 + ,1510 + ,1616 + ,1378 + ,1605 + ,1534 + ,1654 + ,1421 + ,1650 + ,6427 + ,7719 + ,8279 + ,6133 + ,11706 + ,9235 + ,24339 + ,1324 + ,3812 + ,5127 + ,5890 + ,4487 + ,7888 + ,6772 + ,9522 + ,3656 + ,724 + ,99 + ,154 + ,157 + ,367 + ,153 + ,171 + ,-211 + ,1560 + ,1996 + ,1917 + ,1223 + ,2860 + ,1964 + ,13508 + ,-2076 + ,156 + ,113 + ,166 + ,116 + ,435 + ,166 + ,975 + ,-178 + ,3 + ,3 + ,2 + ,2 + ,15 + ,13 + ,27 + ,13 + ,172 + ,380 + ,151 + ,148 + ,141 + ,167 + ,137 + ,120 + ,65 + ,1700 + ,163 + ,568 + ,80 + ,2043 + ,768 + ,338 + ,593 + ,2931 + ,292 + ,1348 + ,774 + ,631 + ,122 + ,698 + ,281 + ,469 + ,227 + ,309 + ,266 + ,267 + ,292 + ,321 + ,1191 + ,145 + ,747 + ,874 + ,38 + ,275 + ,423 + ,218 + ,72 + ,57 + ,2 + ,32 + ,32 + ,57 + ,16 + ,21 + ,113 + ,-6 + ,27 + ,120 + ,32 + ,184 + ,860 + ,604 + ,19 + ,86 + ,2 + ,18 + ,3 + ,3 + ,12 + ,246 + ,97 + ,11 + ,27 + ,120 + ,32 + ,185 + ,860 + ,381 + ,18897 + ,22424 + ,19364 + ,19434 + ,22831 + ,23072 + ,37471 + ,14690 + ,16770 + ,18775 + ,17704 + ,16289 + ,21687 + ,20252 + ,35933 + ,13873 + ,6132 + ,5145 + ,5705 + ,5818 + ,5817 + ,6171 + ,6504 + ,6749 + ,648 + ,299 + ,484 + ,535 + ,511 + ,548 + ,638 + ,758 + ,1739 + ,1710 + ,1776 + ,1910 + ,1843 + ,1990 + ,2141 + ,2097 + ,160 + ,167 + ,176 + ,193 + ,183 + ,202 + ,163 + ,179 + ,621 + ,570 + ,592 + ,743 + ,655 + ,735 + ,851 + ,835 + ,804 + ,821 + ,842 + ,831 + ,847 + ,869 + ,886 + ,881 + ,3 + ,3 + ,3 + ,3 + ,3 + ,3 + ,3 + ,3 + ,150 + ,149 + ,163 + ,140 + ,156 + ,182 + ,238 + ,199 + ,549 + ,528 + ,558 + ,354 + ,470 + ,438 + ,450 + ,453 + ,95 + ,80 + ,132 + ,-46 + ,88 + ,49 + ,57 + ,62 + ,354 + ,353 + ,339 + ,323 + ,308 + ,314 + ,325 + ,322 + ,100 + ,95 + ,87 + ,77 + ,73 + ,75 + ,68 + ,70 + ,342 + ,343 + ,357 + ,354 + ,339 + ,343 + ,343 + ,305 + ,2854 + ,2265 + ,2530 + ,2664 + ,2653 + ,2852 + ,2932 + ,3135 + ,167 + ,99 + ,168 + ,132 + ,137 + ,147 + ,132 + ,35 + ,2687 + ,2166 + ,2362 + ,2533 + ,2516 + ,2705 + ,2799 + ,3100 + ,645 + ,770 + ,634 + ,680 + ,581 + ,675 + ,814 + ,677 + ,6113 + ,7729 + ,8065 + ,5931 + ,11602 + ,9279 + ,24726 + ,1473 + ,3567 + ,4697 + ,5792 + ,4959 + ,8473 + ,6753 + ,9199 + ,3926 + ,472 + ,241 + ,87 + ,262 + ,330 + ,64 + ,172 + ,-142 + ,1665 + ,2360 + ,1934 + ,584 + ,2229 + ,1972 + ,13856 + ,-2338 + ,328 + ,318 + ,154 + ,6 + ,256 + ,181 + ,1301 + ,-241 + ,0 + ,1 + ,0 + ,0 + ,12 + ,10 + ,21 + ,10 + ,81 + ,112 + ,99 + ,120 + ,302 + ,300 + ,177 + ,259 + ,1322 + ,1286 + ,1317 + ,1325 + ,1314 + ,1322 + ,1308 + ,1370 + ,154 + ,143 + ,156 + ,152 + ,144 + ,151 + ,151 + ,171 + ,1277 + ,1448 + ,1340 + ,1689 + ,1529 + ,1544 + ,1264 + ,1656 + ,1127 + ,2253 + ,486 + ,694 + ,699 + ,1110 + ,1165 + ,1776 + ,456 + ,1356 + ,63 + ,2861 + ,89 + ,82 + ,1019 + ,926 + ,224 + ,200 + ,149 + ,91 + ,165 + ,216 + ,94 + ,131 + ,1444 + ,1990 + ,1445 + ,176 + ,888 + ,2517 + ,413 + ,-264 + ,3 + ,8 + ,4 + ,7 + ,40 + ,38 + ,-64 + ,-10 + ,1444 + ,2084 + ,1443 + ,187 + ,850 + ,2483 + ,489 + ,-231) + ,dim=c(8 + ,69) + ,dimnames=list(c('2010-I' + ,'2010-II' + ,'2010-III' + ,'2010-IV' + ,'2011-I' + ,'2011-II' + ,'2011-III' + ,'2011-IV') + ,1:69)) > y <- array(NA,dim=c(8,69),dimnames=list(c('2010-I','2010-II','2010-III','2010-IV','2011-I','2011-II','2011-III','2011-IV'),1:69)) > 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/19fw91355162201.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] 8 > 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/21hvu1355162201.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 = 60.3341, df = 67, p-value < 2.2e-16 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: 0.9853343 0.9943872 sample estimates: cor 0.9909223 > 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) + } + } There were 28 warnings (use warnings() to see them) > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/3oc7c1355162201.tab") > > try(system("convert tmp/19fw91355162201.ps tmp/19fw91355162201.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.486 0.209 1.672