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(112.3 + ,112.9 + ,88.7 + ,105.1 + ,117.3 + ,130.5 + ,94.6 + ,114.9 + ,111.1 + ,137.9 + ,98.7 + ,106.4 + ,102.2 + ,115 + ,84.2 + ,104.5 + ,104.3 + ,116.8 + ,87.7 + ,121.6 + ,122.9 + ,140.9 + ,103.3 + ,141.4 + ,107.6 + ,120.7 + ,88.2 + ,99 + ,121.3 + ,134.2 + ,93.4 + ,126.7 + ,131.5 + ,147.3 + ,106.3 + ,134.1 + ,89 + ,112.4 + ,73.1 + ,81.3 + ,104.4 + ,107.1 + ,78.6 + ,88.6 + ,128.9 + ,128.4 + ,101.6 + ,132.7 + ,135.9 + ,137.7 + ,101.4 + ,132.9 + ,133.3 + ,135 + ,98.5 + ,134.4 + ,121.3 + ,151 + ,99 + ,103.7 + ,120.5 + ,137.4 + ,89.5 + ,119.7 + ,120.4 + ,132.4 + ,83.5 + ,115 + ,137.9 + ,161.3 + ,97.4 + ,132.9 + ,126.1 + ,139.8 + ,87.8 + ,108.5 + ,133.2 + ,146 + ,90.4 + ,113.9 + ,151.1 + ,166.5 + ,101.6 + ,142 + ,105 + ,143.3 + ,80 + ,97.7 + ,119 + ,121 + ,81.7 + ,92.2 + ,140.4 + ,152.6 + ,96.4 + ,128.8 + ,156.6 + ,154.4 + ,110.2 + ,134.9 + ,137.1 + ,154.6 + ,101.1 + ,128.2 + ,122.7 + ,158 + ,89.3 + ,114.8 + ,125.8 + ,142.6 + ,90 + ,117.9 + ,139.3 + ,153.4 + ,95.4 + ,119.1 + ,134.9 + ,163.4 + ,100.3 + ,120.7 + ,149.2 + ,167.3 + ,99.5 + ,129.1 + ,132.3 + ,154.8 + ,93.9 + ,117.6 + ,149 + ,165.7 + ,100.6 + ,129.2 + ,117.2 + ,144.7 + ,84.7 + ,100 + ,119.6 + ,120.9 + ,81.6 + ,87 + ,152 + ,152.8 + ,109 + ,128 + ,149.4 + ,160.2 + ,99 + ,127.7 + ,127.3 + ,128.3 + ,81.1 + ,93.4 + ,114.1 + ,150.5 + ,81.8 + ,84.1 + ,102.1 + ,117 + ,66.5 + ,71.7 + ,107.7 + ,116 + ,66.4 + ,83.2 + ,104.4 + ,133.3 + ,86.3 + ,89.1 + ,102.1 + ,116.4 + ,73.6 + ,79.6 + ,96 + ,104 + ,71.5 + ,62.8 + ,109.3 + ,126.6 + ,87.2 + ,95.1 + ,90 + ,92.9 + ,65.3 + ,63.6 + ,83.9 + ,83.6 + ,69.7 + ,61.4 + ,112 + ,112.8 + ,95.5 + ,98.2 + ,114.3 + ,113.2 + ,86.3 + ,95.3 + ,103.6 + ,118.5 + ,81 + ,81.5 + ,91.7 + ,125.5 + ,88.7 + ,85.5 + ,80.8 + ,91.3 + ,71.9 + ,71.1 + ,87.2 + ,105.4 + ,78.6 + ,78.1 + ,109.2 + ,121.3 + ,96 + ,103 + ,102.7 + ,106.9 + ,81.1 + ,86 + ,95.1 + ,109.4 + ,77.5 + ,86.2 + ,117.5 + ,132.6 + ,97.3 + ,105.7 + ,85.1 + ,96.8 + ,78.6 + ,57.2 + ,92.1 + ,100.3 + ,79 + ,73.7 + ,113.5 + ,119.2 + ,93.4 + ,120.5) + ,dim=c(4 + ,60) + ,dimnames=list(c('X1' + ,'X2' + ,'X3' + ,'X4') + ,1:60)) > y <- array(NA,dim=c(4,60),dimnames=list(c('X1','X2','X3','X4'),1:60)) > 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: 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#output/ > #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/1dg9s1292933172.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] 4 > 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/29p601292933172.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 = 13.8409, df = 58, p-value < 2.2e-16 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: 0.8002310 0.9244007 sample estimates: cor 0.876128 > 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 > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/3cqno1292933172.tab") > > try(system("convert tmp/1dg9s1292933172.ps tmp/1dg9s1292933172.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.509 0.205 2.193