R version 2.12.0 (2010-10-15) Copyright (C) 2010 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(0.8973 + ,7.4271 + ,0.9383 + ,7.7662 + ,0.9217 + ,7.6289 + ,0.9095 + ,7.5281 + ,0.892 + ,7.3831 + ,0.8742 + ,7.2355 + ,0.8532 + ,7.0617 + ,0.8607 + ,7.1237 + ,0.9005 + ,7.4533 + ,0.9111 + ,7.5411 + ,0.9059 + ,7.4978 + ,0.8883 + ,7.3525 + ,0.8924 + ,7.3862 + ,0.8833 + ,7.311 + ,0.87 + ,7.2013 + ,0.8758 + ,7.249 + ,0.8858 + ,7.3321 + ,0.917 + ,7.59 + ,0.9554 + ,7.9082 + ,0.9922 + ,8.2123 + ,0.9778 + ,8.0929 + ,0.9808 + ,8.118 + ,0.9811 + ,8.1206 + ,1.0014 + ,8.2883 + ,1.0183 + ,8.4281 + ,1.0622 + ,8.7917 + ,1.0773 + ,8.9168 + ,1.0807 + ,8.9446 + ,1.0848 + ,8.9786 + ,1.1582 + ,9.5862 + ,1.1663 + ,9.6533 + ,1.1372 + ,9.4125 + ,1.1139 + ,9.2195 + ,1.1222 + ,9.2882 + ,1.1692 + ,9.6774 + ,1.1702 + ,9.6857 + ,1.2286 + ,10.1688 + ,1.2613 + ,10.4399 + ,1.2646 + ,10.4675 + ,1.2262 + ,10.149 + ,1.1985 + ,9.9163 + ,1.2007 + ,9.9268 + ,1.2138 + ,10.0529 + ,1.2266 + ,10.1622 + ,1.2176 + ,10.083 + ,1.2218 + ,10.1134 + ,1.249 + ,10.3423 + ,1.2991 + ,10.7536 + ,1.3408 + ,11.0967 + ,1.3119 + ,10.8588 + ,1.3014 + ,10.7719 + ,1.3201 + ,10.9262 + ,1.2938 + ,10.708 + ,1.2694 + ,10.5062 + ,1.2165 + ,10.0683 + ,1.2037 + ,9.8954 + ,1.2292 + ,9.9589 + ,1.2256 + ,9.9177 + ,1.2015 + ,9.7189 + ,1.1786 + ,9.5273 + ,1.1856 + ,9.5746 + ,1.2103 + ,9.763 + ,1.1938 + ,9.6117 + ,1.202 + ,9.6581 + ,1.2271 + ,9.8361 + ,1.277 + ,10.2353 + ,1.265 + ,10.1285 + ,1.2684 + ,10.1347 + ,1.2811 + ,10.2141 + ,1.2727 + ,10.0971 + ,1.2611 + ,9.9651 + ,1.2881 + ,10.1286 + ,1.3213 + ,10.3356 + ,1.2999 + ,10.1238 + ,1.3074 + ,10.1326 + ,1.3242 + ,10.2467 + ,1.3516 + ,10.44 + ,1.3511 + ,10.3689 + ,1.3419 + ,10.2415 + ,1.3716 + ,10.3899 + ,1.3622 + ,10.3162 + ,1.3896 + ,10.4533 + ,1.4227 + ,10.6741 + ,1.4684 + ,10.8957 + ,1.457 + ,10.7404 + ,1.4718 + ,10.6568 + ,1.4748 + ,10.5682 + ,1.5527 + ,10.9833 + ,1.575 + ,11.0237 + ,1.5557 + ,10.8462 + ,1.5553 + ,10.7287 + ,1.577 + ,10.7809 + ,1.4975 + ,10.2609 + ,1.4369 + ,9.8252 + ,1.3322 + ,9.1071 + ,1.2732 + ,8.695 + ,1.3449 + ,9.2205 + ,1.3239 + ,9.0496 + ,1.2785 + ,8.7406 + ,1.305 + ,8.921 + ,1.319 + ,9.011 + ,1.365 + ,9.3157 + ,1.4016 + ,9.5786 + ,1.4088 + ,9.6246 + ,1.4268 + ,9.7485 + ,1.4562 + ,9.9431 + ,1.4816 + ,10.1152 + ,1.4914 + ,10.1827 + ,1.4614 + ,9.9777 + ,1.4272 + ,9.7436 + ,1.3686 + ,9.3462 + ,1.3569 + ,9.2623 + ,1.3406 + ,9.1505 + ,1.2565 + ,8.5794 + ,1.2208 + ,8.3245 + ,1.277 + ,8.6538 + ,1.2894 + ,8.752 + ,1.3067 + ,8.8104 + ,1.3898 + ,9.2665 + ,1.3661 + ,9.0895) + ,dim=c(2 + ,120) + ,dimnames=list(c('Dollar' + ,'Yuan') + ,1:120)) > y <- array(NA,dim=c(2,120),dimnames=list(c('Dollar','Yuan'),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 = 'pearson' > main = 'Correlation Matrix' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Dr. Ian E. Holliday > #To cite this work: Ian E. Holliday, 2009, YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #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/rcomp/tmp/16tga1293361070.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/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/www/rcomp/tmp/2k2wj1293361070.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 = 17.2068, df = 118, p-value < 2.2e-16 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: 0.7853893 0.8899490 sample estimates: cor 0.845593 > 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/www/rcomp/tmp/3ycta1293361070.tab") > > try(system("convert tmp/16tga1293361070.ps tmp/16tga1293361070.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.510 0.160 0.654