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(3010 + ,2590 + ,11290 + ,4700 + ,44.51 + ,2910 + ,2080 + ,11620 + ,4960 + ,45.48 + ,3840 + ,2640 + ,10790 + ,4880 + ,53.1 + ,3580 + ,3000 + ,8380 + ,4090 + ,51.88 + ,3140 + ,2350 + ,9370 + ,3450 + ,48.65 + ,3550 + ,2220 + ,10090 + ,3020 + ,54.35 + ,3250 + ,2540 + ,11130 + ,3070 + ,57.52 + ,2820 + ,2700 + ,10530 + ,3720 + ,63.98 + ,2260 + ,2580 + ,10490 + ,3750 + ,62.91 + ,2060 + ,2420 + ,10570 + ,3910 + ,58.54 + ,2120 + ,2090 + ,11170 + ,4120 + ,55.24 + ,2210 + ,2000 + ,11610 + ,4780 + ,56.86 + ,2190 + ,1860 + ,10920 + ,3070 + ,62.99 + ,2180 + ,1980 + ,11570 + ,4100 + ,60.21 + ,2350 + ,2690 + ,12960 + ,3900 + ,62.06 + ,2440 + ,3040 + ,11190 + ,3020 + ,70.26 + ,2370 + ,2450 + ,11920 + ,3220 + ,69.78 + ,2440 + ,2650 + ,14930 + ,4030 + ,68.56 + ,2610 + ,2710 + ,14520 + ,4210 + ,73.67 + ,3040 + ,3230 + ,12970 + ,4510 + ,73.23 + ,3190 + ,3160 + ,13870 + ,4320 + ,61.96 + ,3120 + ,3040 + ,13250 + ,3890 + ,57.81 + ,3170 + ,2630 + ,12760 + ,7280 + ,58.76 + ,3600 + ,2730 + ,14050 + ,9640 + ,62.47 + ,3420 + ,2830 + ,14660 + ,5680 + ,53.68 + ,3650 + ,2320 + ,15010 + ,6320 + ,57.56 + ,4180 + ,2410 + ,15020 + ,5820 + ,62.05 + ,2960 + ,3080 + ,13090 + ,4890 + ,67.49 + ,2710 + ,2260 + ,13190 + ,3320 + ,67.21 + ,2950 + ,2300 + ,11390 + ,2930 + ,71.05 + ,3030 + ,3600 + ,10110 + ,3530 + ,76.93 + ,3770 + ,3380 + ,8240 + ,3690 + ,70.76 + ,4740 + ,3670 + ,7920 + ,3750 + ,77.17 + ,4450 + ,3040 + ,7700 + ,3330 + ,82.34 + ,5550 + ,2840 + ,7920 + ,4790 + ,92.41 + ,5580 + ,2810 + ,8130 + ,5990 + ,90.93 + ,5890 + ,2980 + ,10510 + ,5290 + ,92.18 + ,7480 + ,2440 + ,10230 + ,5310 + ,94.99 + ,10450 + ,2620 + ,10940 + ,4790 + ,103.64 + ,6360 + ,2270 + ,9230 + ,3630 + ,109.07 + ,6710 + ,2540 + ,10320 + ,2820 + ,122.8 + ,6200 + ,3060 + ,9590 + ,2770 + ,132.32 + ,4490 + ,3730 + ,9980 + ,2820 + ,132.72 + ,3480 + ,3450 + ,9630 + ,3750 + ,113.24 + ,2520 + ,3220 + ,9520 + ,3100 + ,97.23 + ,1920 + ,2980 + ,9150 + ,4350 + ,71.58 + ,2010 + ,2470 + ,9490 + ,4050 + ,52.45 + ,1950 + ,2240 + ,10090 + ,6000 + ,39.95 + ,2240 + ,1970 + ,9570 + ,10630 + ,43.44 + ,2370 + ,1860 + ,8870 + ,3750 + ,43.32 + ,2840 + ,2200 + ,8270 + ,3840 + ,46.54 + ,2700 + ,2000 + ,7530 + ,4200 + ,50.18 + ,2980 + ,1590 + ,10240 + ,2610 + ,57.3 + ,3290 + ,2280 + ,10590 + ,2610 + ,68.61 + ,3300 + ,2830 + ,9440 + ,2530 + ,64.44 + ,3000 + ,3060 + ,10620 + ,3090 + ,72.51 + ,2330 + ,3320 + ,11470 + ,4310 + ,67.65 + ,2190 + ,2680 + ,10680 + ,4190 + ,72.77 + ,1970 + ,2470 + ,11130 + ,3790 + ,76.66 + ,2170 + ,2500 + ,12390 + ,3910 + ,74.46 + ,2830 + ,2170 + ,10920 + ,4890 + ,76.17 + ,3190 + ,2070 + ,10320 + ,4970 + ,73.75 + ,3550 + ,2380 + ,10810 + ,5550 + ,78.83 + ,3240 + ,2480 + ,10280 + ,4730 + ,84.82 + ,3450 + ,2350 + ,11790 + ,4580 + ,75.95 + ,3570 + ,2610 + ,13290 + ,2500 + ,74.76 + ,3230 + ,3410 + ,11740 + ,2630 + ,75.58 + ,3260 + ,3380 + ,11320 + ,4300 + ,77.04 + ,2700 + ,2720 + ,11930 + ,3750 + ,77.84) + ,dim=c(5 + ,69) + ,dimnames=list(c('Garnalen' + ,'Kabeljauw' + ,'Tong' + ,'Zeeduivel' + ,'Olie') + ,1:69)) > y <- array(NA,dim=c(5,69),dimnames=list(c('Garnalen','Kabeljauw','Tong','Zeeduivel','Olie'),1:69)) > 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' > #'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/1211a1293212480.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] 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/html/rcomp/tmp/2510f1293212480.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) Kendall's rank correlation tau data: y[1, ] and y[2, ] z = 2.6111, p-value = 0.009024 alternative hypothesis: true tau is not equal to 0 sample estimates: tau 0.2156613 > 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/html/rcomp/tmp/31byo1293212480.tab") > > try(system("convert tmp/1211a1293212480.ps tmp/1211a1293212480.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.669 0.270 1.407