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(1221.53 + ,2617.2 + ,10168.52 + ,6957.61 + ,23448.78 + ,1180.55 + ,2506.13 + ,9937.04 + ,6688.49 + ,23007.99 + ,1183.26 + ,2679.07 + ,9202.45 + ,6601.37 + ,23096.32 + ,1141.2 + ,2589.73 + ,9369.35 + ,6229.02 + ,22358.17 + ,1049.33 + ,2457.46 + ,8824.06 + ,5925.22 + ,20536.49 + ,1101.6 + ,2517.3 + ,9537.3 + ,6147.97 + ,21029.81 + ,1030.71 + ,2386.53 + ,9382.64 + ,5965.52 + ,20128.99 + ,1089.41 + ,2453.37 + ,9768.7 + ,5964.33 + ,19765.19 + ,1186.69 + ,2529.66 + ,11057.4 + ,6135.7 + ,21108.59 + ,1169.43 + ,2475.14 + ,11089.94 + ,6153.55 + ,21239.35 + ,1104.49 + ,2525.93 + ,10126.03 + ,5598.46 + ,20608.7 + ,1073.87 + ,2480.93 + ,10198.04 + ,5608.79 + ,20121.99 + ,1115.1 + ,2229.85 + ,10546.44 + ,5957.43 + ,21872.5 + ,1095.63 + ,2169.14 + ,9345.55 + ,5625.95 + ,21821.5 + ,1036.19 + ,2030.98 + ,10034.74 + ,5414.96 + ,21752.87 + ,1057.08 + ,2071.37 + ,10133.23 + ,5675.16 + ,20955.25 + ,1020.62 + ,1953.35 + ,10492.53 + ,5458.04 + ,19724.19 + ,987.48 + ,1748.74 + ,10356.83 + ,5332.14 + ,20573.33 + ,919.32 + ,1696.58 + ,9958.44 + ,4808.64 + ,18378.73 + ,919.14 + ,1900.09 + ,9522.5 + ,4940.82 + ,18171 + ,872.81 + ,1908.64 + ,8828.26 + ,4769.45 + ,15520.99 + ,797.87 + ,1881.46 + ,8109.53 + ,4084.76 + ,13576.02 + ,735.09 + ,2100.18 + ,7568.42 + ,3843.74 + ,12811.57 + ,825.88 + ,2672.2 + ,7994.05 + ,4338.35 + ,13278.21 + ,903.25 + ,3136 + ,8859.56 + ,4810.2 + ,14387.48 + ,896.24 + ,2994.38 + ,8512.27 + ,4669.44 + ,13888.24 + ,968.75 + ,3168.22 + ,8576.98 + ,4987.97 + ,13968.67 + ,1166.36 + ,3751.41 + ,11259.86 + ,5831.02 + ,18016.21 + ,1282.83 + ,3925.43 + ,13072.87 + ,6422.3 + ,21261.89 + ,1267.38 + ,3719.52 + ,13376.81 + ,6479.56 + ,22731.1 + ,1280 + ,3757.12 + ,13481.38 + ,6418.32 + ,22102.01 + ,1400.38 + ,3722.23 + ,14338.54 + ,7096.79 + ,24533.12 + ,1385.59 + ,4127.47 + ,13849.99 + ,6948.82 + ,25755.35 + ,1322.7 + ,4162.5 + ,12525.54 + ,6534.97 + ,22849.2 + ,1330.63 + ,4441.82 + ,13603.02 + ,6748.13 + ,24331.67 + ,1378.55 + ,4325.29 + ,13592.47 + ,6851.75 + ,23455.74 + ,1468.36 + ,4350.83 + ,15307.78 + ,8067.32 + ,27812.65 + ,1481.14 + ,4384.47 + ,15680.67 + ,7870.52 + ,28643.61 + ,1549.38 + ,4639.4 + ,16737.63 + ,8019.22 + ,31352.58 + ,1526.75 + ,4697.86 + ,16785.69 + ,7861.51 + ,27142.47 + ,1473.99 + ,4614.76 + ,16569.09 + ,7638.17 + ,23984.14 + ,1455.27 + ,4471.65 + ,17248.89 + ,7584.14 + ,23184.94 + ,1503.35 + ,4305.23 + ,18138.36 + ,8007.32 + ,21772.73 + ,1530.62 + ,4433.57 + ,17875.75 + ,7883.04 + ,20634.47 + ,1482.37 + ,4388.53 + ,17400.41 + ,7408.87 + ,20318.98 + ,1420.86 + ,4140.3 + ,17287.65 + ,6917.03 + ,19800.93 + ,1406.82 + ,4144.38 + ,17604.12 + ,6715.44 + ,19651.51 + ,1438.24 + ,4070.78 + ,17383.42 + ,6789.11 + ,20106.42 + ,1418.3 + ,3906.01 + ,17225.83 + ,6596.92 + ,19964.72 + ,1400.63 + ,3795.91 + ,16274.33 + ,6309.19 + ,18960.48 + ,1377.94 + ,3703.32 + ,16399.39 + ,6268.92 + ,18324.35 + ,1335.85 + ,3675.8 + ,16127.58 + ,6004.33 + ,17543.05 + ,1303.82 + ,3911.06 + ,16140.76 + ,5859.57 + ,17392.27 + ,1276.66 + ,3912.28 + ,15456.81 + ,5681.97 + ,16971.34 + ,1270.2 + ,3839.25 + ,15505.18 + ,5683.31 + ,16267.62 + ,1270.09 + ,3744.63 + ,15467.33 + ,5692.86 + ,15857.89 + ,1310.61 + ,3549.25 + ,16906.23 + ,6009.89 + ,16661.3 + ,1294.87 + ,3394.14 + ,17059.66 + ,5970.08 + ,15805.04 + ,1280.66 + ,3264.26 + ,16205.43 + ,5796.04 + ,15918.48 + ,1280.08 + ,3328.8 + ,16649.82 + ,5674.15 + ,15753.14 + ,1248.29 + ,3223.98 + ,16111.43 + ,5408.26 + ,14876.43 + ,1249.48 + ,3228.01 + ,14872.15 + ,5193.4 + ,14937.14 + ,1207.01 + ,3112.83 + ,13606.5 + ,4929.07 + ,14386.37 + ,1228.81 + ,3051.67 + ,13574.3 + ,5044.12 + ,15428.52 + ,1220.33 + ,3039.71 + ,12413.6 + ,4829.69 + ,14903.55 + ,1234.18 + ,3125.67 + ,11899.6 + ,4886.5 + ,14880.98 + ,1191.33 + ,3106.54 + ,11584.01 + ,4586.28 + ,14201.06 + ,1191.5 + ,11276.59 + ,4460.63 + ,13867.07 + ,1156.85 + ,11008.9 + ,4184.84 + ,13908.97 + ,1180.59 + ,11668.95 + ,4348.77 + ,13516.88 + ,1203.6 + ,11740.6 + ,4350.49 + ,14195.35 + ,1181.27 + ,11387.59 + ,4254.85 + ,13721.69) + ,dim=c(5 + ,72) + ,dimnames=list(c('S&P' + ,'Bel20' + ,'Nikkei' + ,'DAX' + ,'HangSeng') + ,1:72)) > y <- array(NA,dim=c(5,72),dimnames=list(c('S&P','Bel20','Nikkei','DAX','HangSeng'),1:72)) > 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/183bi1293226724.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] 5 > 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/2t3s61293226724.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.6165, df = 70, p-value = 0.5395 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: -0.1609172 0.3000511 sample estimates: cor 0.07349106 > 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 7: In cor.test.default(y[i, ], y[j, ], method = "spearman") : Cannot compute exact p-values with ties 8: In cor.test.default(y[i, ], y[j, ], method = "spearman") : Cannot compute exact p-values with ties 9: In cor.test.default(y[i, ], y[j, ], method = "spearman") : Cannot compute exact p-values with ties 10: 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/3xm8t1293226724.tab") > > try(system("convert tmp/183bi1293226724.ps tmp/183bi1293226724.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.610 0.290 0.891