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(107.11 + ,236.67 + ,8.92 + ,1 + ,122.23 + ,258.1 + ,9.32 + ,2 + ,134.69 + ,241.52 + ,8.9 + ,3 + ,128.79 + ,190.71 + ,8.53 + ,4 + ,126.16 + ,200.32 + ,8.51 + ,5 + ,119.98 + ,223.41 + ,9.03 + ,6 + ,108.45 + ,201.38 + ,9.6 + ,7 + ,108.43 + ,211.83 + ,9.88 + ,8 + ,98.17 + ,224.41 + ,10.81 + ,9 + ,106.09 + ,211.57 + ,11.61 + ,10 + ,108.81 + ,194.77 + ,11.81 + ,11 + ,103.03 + ,201.86 + ,13.93 + ,12 + ,124.36 + ,225 + ,16.19 + ,1 + ,118.52 + ,278.9 + ,18.05 + ,2 + ,112.2 + ,259.74 + ,17.08 + ,3 + ,114.71 + ,230.45 + ,17.46 + ,4 + ,107.96 + ,238.26 + ,16.9 + ,5 + ,101.21 + ,250.14 + ,15.69 + ,6 + ,102.77 + ,263.81 + ,15.86 + ,7 + ,112.13 + ,247.22 + ,12.98 + ,8 + ,109.36 + ,229.81 + ,12.31 + ,9 + ,110.91 + ,224.27 + ,11.51 + ,10 + ,123.57 + ,213.23 + ,11.73 + ,11 + ,129.95 + ,239.57 + ,11.7 + ,12 + ,124.46 + ,249.7 + ,10.9 + ,1 + ,122.34 + ,212.5 + ,10.57 + ,2 + ,116.61 + ,203.27 + ,10.37 + ,3 + ,114.59 + ,192.05 + ,9.59 + ,4 + ,112.52 + ,190.04 + ,9.09 + ,5 + ,118.67 + ,202.05 + ,9.26 + ,6 + ,116.8 + ,211.91 + ,9.9 + ,7 + ,123.63 + ,210.39 + ,9.61 + ,8 + ,128.04 + ,231.25 + ,9.85 + ,9 + ,134.57 + ,224.3 + ,9.99 + ,10 + ,130.33 + ,209.64 + ,9.9 + ,11 + ,136.47 + ,206.05 + ,10.45 + ,12 + ,139.05 + ,229.7 + ,11.66 + ,1 + ,158.21 + ,264.67 + ,13.61 + ,2 + ,148.07 + ,246.29 + ,12.88 + ,3 + ,137.74 + ,260.91 + ,12.52 + ,4 + ,139.74 + ,265.14 + ,10.93 + ,5 + ,144.08 + ,284.52 + ,12.07 + ,6 + ,145.35 + ,287.48 + ,13.21 + ,7 + ,145.77 + ,321.9 + ,13.68 + ,8 + ,140.56 + ,321.59 + ,14.02 + ,9 + ,121.41 + ,282.39 + ,11.7 + ,10 + ,120.44 + ,241 + ,11.83 + ,11 + ,116.97 + ,228.48 + ,11.32 + ,12 + ,128.03 + ,261.59 + ,12.24 + ,1 + ,128.51 + ,270 + ,13.31 + ,2 + ,127.76 + ,262.86 + ,12.93 + ,3 + ,134.58 + ,277.41 + ,13.47 + ,4 + ,147.64 + ,288 + ,15.47 + ,5 + ,144.46 + ,287.14 + ,16.58 + ,6 + ,137.6 + ,337.65 + ,17.8 + ,7 + ,146.87 + ,328.38 + ,21.72 + ,8 + ,145.67 + ,374.41 + ,23.45 + ,9 + ,151.95 + ,344.77 + ,23.16 + ,10 + ,150.23 + ,361.05 + ,22.77 + ,11 + ,155.86 + ,374.22 + ,24.9 + ,12) + ,dim=c(4 + ,60) + ,dimnames=list(c('Coffee' + ,'Tea' + ,'Sugar' + ,'Month') + ,1:60)) > y <- array(NA,dim=c(4,60),dimnames=list(c('Coffee','Tea','Sugar','Month'),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' > par1 <- 'pearson' > #'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/html/rcomp/tmp/1d5ok1292316940.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/217651292316941.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 = 6.6572, df = 58, p-value = 1.101e-08 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: 0.4853180 0.7814658 sample estimates: cor 0.6581376 > 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 > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/3485b1292316941.tab") > > try(system("convert tmp/1d5ok1292316940.ps tmp/1d5ok1292316940.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.508 0.223 1.107