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(1 + ,236.67 + ,107.11 + ,8.92 + ,2 + ,258.1 + ,122.23 + ,9.32 + ,3 + ,241.52 + ,134.69 + ,8.9 + ,4 + ,190.71 + ,128.79 + ,8.53 + ,5 + ,200.32 + ,126.16 + ,8.51 + ,6 + ,223.41 + ,119.98 + ,9.03 + ,7 + ,201.38 + ,108.45 + ,9.6 + ,8 + ,211.83 + ,108.43 + ,9.88 + ,9 + ,224.41 + ,98.17 + ,10.81 + ,10 + ,211.57 + ,106.09 + ,11.61 + ,11 + ,194.77 + ,108.81 + ,11.81 + ,12 + ,201.86 + ,103.03 + ,13.93 + ,13 + ,225 + ,124.36 + ,16.19 + ,14 + ,278.9 + ,118.52 + ,18.05 + ,15 + ,259.74 + ,112.2 + ,17.08 + ,16 + ,230.45 + ,114.71 + ,17.46 + ,17 + ,238.26 + ,107.96 + ,16.9 + ,18 + ,250.14 + ,101.21 + ,15.69 + ,19 + ,263.81 + ,102.77 + ,15.86 + ,20 + ,247.22 + ,112.13 + ,12.98 + ,21 + ,229.81 + ,109.36 + ,12.31 + ,22 + ,224.27 + ,110.91 + ,11.51 + ,23 + ,213.23 + ,123.57 + ,11.73 + ,24 + ,239.57 + ,129.95 + ,11.7 + ,25 + ,249.7 + ,124.46 + ,10.9 + ,26 + ,212.5 + ,122.34 + ,10.57 + ,27 + ,203.27 + ,116.61 + ,10.37 + ,28 + ,192.05 + ,114.59 + ,9.59 + ,29 + ,190.04 + ,112.52 + ,9.09 + ,30 + ,202.05 + ,118.67 + ,9.26 + ,31 + ,211.91 + ,116.8 + ,9.9 + ,32 + ,210.39 + ,123.63 + ,9.61 + ,33 + ,231.25 + ,128.04 + ,9.85 + ,34 + ,224.3 + ,134.57 + ,9.99 + ,35 + ,209.64 + ,130.33 + ,9.9 + ,36 + ,206.05 + ,136.47 + ,10.45 + ,37 + ,229.7 + ,139.05 + ,11.66 + ,38 + ,264.67 + ,158.21 + ,13.61 + ,39 + ,246.29 + ,148.07 + ,12.88 + ,40 + ,260.91 + ,137.74 + ,12.52 + ,41 + ,265.14 + ,139.74 + ,10.93 + ,42 + ,284.52 + ,144.08 + ,12.07 + ,43 + ,287.48 + ,145.35 + ,13.21 + ,44 + ,321.9 + ,145.77 + ,13.68 + ,45 + ,321.59 + ,140.56 + ,14.02 + ,46 + ,282.39 + ,121.41 + ,11.7 + ,47 + ,241 + ,120.44 + ,11.83 + ,48 + ,228.48 + ,116.97 + ,11.32 + ,49 + ,261.59 + ,128.03 + ,12.24 + ,50 + ,270 + ,128.51 + ,13.31 + ,51 + ,262.86 + ,127.76 + ,12.93 + ,52 + ,277.41 + ,134.58 + ,13.47 + ,53 + ,288 + ,147.64 + ,15.47 + ,54 + ,287.14 + ,144.46 + ,16.58 + ,55 + ,337.65 + ,137.6 + ,17.8 + ,56 + ,328.38 + ,146.87 + ,21.72 + ,57 + ,374.41 + ,145.67 + ,23.45 + ,58 + ,344.77 + ,151.95 + ,23.16 + ,59 + ,361.05 + ,150.23 + ,22.77 + ,60 + ,374.22 + ,155.86 + ,24.9) + ,dim=c(4 + ,60) + ,dimnames=list(c('Month' + ,'Tea' + ,'Coffee' + ,'Sugar') + ,1:60)) > y <- array(NA,dim=c(4,60),dimnames=list(c('Month','Tea','Coffee','Sugar'),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/1osgn1292272262.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/29tet1292272262.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 = 7.2009, df = 58, p-value = 1.347e-09 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: 0.5246435 0.8011921 sample estimates: cor 0.6870407 > 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 > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/3nlck1292272262.tab") > > try(system("convert tmp/1osgn1292272262.ps tmp/1osgn1292272262.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.499 0.235 1.059