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(10 + ,288.60 + ,1.39 + ,113.67 + ,0.8764 + ,8.1110 + ,9 + ,269.10 + ,1.31 + ,110.26 + ,0.8399 + ,7.9156 + ,8 + ,268.70 + ,1.29 + ,110.04 + ,0.8236 + ,7.9325 + ,7 + ,264.30 + ,1.28 + ,111.73 + ,0.8357 + ,8.0201 + ,6 + ,264.30 + ,1.22 + ,110.99 + ,0.8277 + ,7.9062 + ,5 + ,267.60 + ,1.26 + ,115.83 + ,0.8571 + ,7.8907 + ,4 + ,298.10 + ,1.34 + ,125.33 + ,0.8746 + ,7.9323 + ,3 + ,279.80 + ,1.36 + ,123.03 + ,0.9016 + ,8.0369 + ,2 + ,263.20 + ,1.37 + ,123.46 + ,0.8760 + ,8.0971 + ,1 + ,272.50 + ,1.43 + ,130.34 + ,0.8831 + ,8.1817 + ,12 + ,263.70 + ,1.46 + ,131.21 + ,0.8997 + ,8.4066 + ,11 + ,273.70 + ,1.49 + ,132.97 + ,0.8989 + ,8.4143 + ,10 + ,261.40 + ,1.48 + ,133.91 + ,0.9156 + ,8.3596 + ,9 + ,241.10 + ,1.46 + ,133.14 + ,0.8914 + ,8.5964 + ,8 + ,253.40 + ,1.43 + ,135.31 + ,0.8627 + ,8.6602 + ,7 + ,228.60 + ,1.41 + ,133.09 + ,0.8609 + ,8.9494 + ,6 + ,244.90 + ,1.40 + ,135.39 + ,0.8567 + ,8.9388 + ,5 + ,206.10 + ,1.37 + ,131.85 + ,0.8844 + ,8.7943 + ,4 + ,177.00 + ,1.32 + ,130.25 + ,0.8976 + ,8.7867 + ,3 + ,165.10 + ,1.31 + ,127.65 + ,0.9197 + ,8.8388 + ,2 + ,148.10 + ,1.28 + ,118.30 + ,0.8869 + ,8.7838 + ,1 + ,152.90 + ,1.32 + ,119.73 + ,0.9182 + ,9.2164 + ,12 + ,146.50 + ,1.34 + ,122.51 + ,0.9045 + ,9.4228 + ,11 + ,188.00 + ,1.27 + ,123.28 + ,0.8306 + ,8.8094 + ,10 + ,252.00 + ,1.33 + ,133.52 + ,0.7867 + ,8.5928 + ,9 + ,351.60 + ,1.44 + ,153.20 + ,0.7992 + ,8.1566 + ,8 + ,403.00 + ,1.50 + ,163.63 + ,0.7928 + ,7.9723 + ,7 + ,468.80 + ,1.58 + ,168.45 + ,0.7931 + ,8.0487 + ,6 + ,464.00 + ,1.56 + ,166.26 + ,0.7915 + ,7.9915 + ,5 + ,435.40 + ,1.56 + ,162.31 + ,0.7921 + ,7.8648 + ,4 + ,382.20 + ,1.58 + ,161.56 + ,0.7949 + ,7.9629 + ,3 + ,360.60 + ,1.55 + ,156.59 + ,0.7749 + ,7.9717 + ,2 + ,329.50 + ,1.47 + ,157.97 + ,0.7509 + ,7.9480 + ,1 + ,320.20 + ,1.47 + ,158.68 + ,0.7473 + ,7.9566 + ,12 + ,315.00 + ,1.46 + ,163.55 + ,0.7206 + ,8.0117 + ,11 + ,322.70 + ,1.47 + ,162.89 + ,0.7090 + ,7.9519 + ,10 + ,289.70 + ,1.42 + ,164.95 + ,0.6961 + ,7.6963 + ,9 + ,270.30 + ,1.39 + ,159.82 + ,0.6889 + ,7.8306 + ,8 + ,247.80 + ,1.36 + ,159.05 + ,0.6777 + ,7.9735 + ,7 + ,259.60 + ,1.37 + ,166.76 + ,0.6744 + ,7.9380 + ,6 + ,241.00 + ,1.34 + ,164.55 + ,0.6756 + ,8.0590 + ,5 + ,230.00 + ,1.35 + ,163.22 + ,0.6814 + ,8.1394 + ,4 + ,230.30 + ,1.35 + ,160.68 + ,0.6793 + ,8.1194 + ,3 + ,214.00 + ,1.32 + ,155.24 + ,0.6802 + ,8.1340 + ,2 + ,202.90 + ,1.31 + ,157.60 + ,0.6680 + ,8.0875 + ,1 + ,188.50 + ,1.30 + ,156.56 + ,0.6634 + ,8.2780 + ,12 + ,215.60 + ,1.32 + ,154.82 + ,0.6729 + ,8.1575 + ,11 + ,205.60 + ,1.29 + ,151.11 + ,0.6740 + ,8.2446 + ,10 + ,203.70 + ,1.26 + ,149.65 + ,0.6725 + ,8.3960 + ,9 + ,218.20 + ,1.27 + ,148.99 + ,0.6751 + ,8.2572 + ,8 + ,253.00 + ,1.28 + ,148.53 + ,0.6767 + ,7.9920 + ,7 + ,255.40 + ,1.27 + ,146.70 + ,0.6878 + ,7.9386 + ,6 + ,240.70 + ,1.27 + ,145.11 + ,0.6867 + ,7.8559 + ,5 + ,242.20 + ,1.28 + ,142.70 + ,0.6833 + ,7.7988 + ,4 + ,240.20 + ,1.23 + ,143.59 + ,0.6946 + ,7.8413 + ,3 + ,215.20 + ,1.20 + ,140.96 + ,0.6894 + ,7.9775 + ,2 + ,211.10 + ,1.19 + ,140.77 + ,0.6830 + ,8.0593 + ,1 + ,219.30 + ,1.21 + ,139.81 + ,0.6860 + ,8.0366) + ,dim=c(6 + ,58) + ,dimnames=list(c('Maand' + ,'Olie' + ,'Dollar' + ,'Yen' + ,'Pond' + ,'Noorse_kroon') + ,1:58)) > y <- array(NA,dim=c(6,58),dimnames=list(c('Maand','Olie','Dollar','Yen','Pond','Noorse_kroon'),1:58)) > 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' > par1 <- 'pearson' > #'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/ > #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/122nb1292341729.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] 6 > 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/26kmh1292341729.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.5789, df = 56, p-value = 0.565 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: -0.1848546 0.3288681 sample estimates: cor 0.0771236 > 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 12 warnings (use warnings() to see them) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/3kvn01292341730.tab") > > try(system("convert tmp/122nb1292341729.ps tmp/122nb1292341729.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.688 0.301 1.455