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(104708 + ,56190 + ,19246 + ,101817 + ,54300 + ,17549 + ,97898 + ,51362 + ,16428 + ,95559 + ,49802 + ,16209 + ,92822 + ,48088 + ,15235 + ,90848 + ,46696 + ,16186 + ,101141 + ,56586 + ,24971 + ,105841 + ,64148 + ,30776 + ,93647 + ,56449 + ,26416 + ,90923 + ,52538 + ,23157 + ,89130 + ,49359 + ,20155 + ,90212 + ,49583 + ,19790 + ,93196 + ,51050 + ,18849 + ,91861 + ,49610 + ,17573 + ,90593 + ,48321 + ,16597 + ,89895 + ,47692 + ,16158 + ,88819 + ,46243 + ,15507 + ,87924 + ,46248 + ,16433 + ,96906 + ,56381 + ,26325 + ,101217 + ,62329 + ,31144 + ,98709 + ,60673 + ,30535 + ,98139 + ,58393 + ,27596 + ,95529 + ,55742 + ,24064 + ,98577 + ,57135 + ,23854 + ,100772 + ,57961 + ,22407 + ,100180 + ,56571 + ,21125 + ,99200 + ,55615 + ,20226 + ,96251 + ,53494 + ,19547 + ,94514 + ,52623 + ,18933 + ,93780 + ,52820 + ,20372 + ,105192 + ,66825 + ,34331 + ,107682 + ,70695 + ,37329 + ,99687 + ,65660 + ,36761 + ,99436 + ,63238 + ,32737 + ,102049 + ,61741 + ,29321 + ,102673 + ,63642 + ,28883 + ,105813 + ,65521 + ,27436 + ,105056 + ,64006 + ,25101 + ,103916 + ,62728 + ,23776 + ,103513 + ,62438 + ,23782 + ,101893 + ,61109 + ,23027 + ,102503 + ,63422 + ,25606 + ,113149 + ,78094 + ,41328 + ,116696 + ,82030 + ,44751 + ,108500 + ,75892 + ,42855 + ,107800 + ,72431 + ,37628 + ,105941 + ,69194 + ,33544 + ,108742 + ,71171 + ,33275 + ,111680 + ,72545 + ,32009 + ,111270 + ,71503 + ,30813 + ,110698 + ,69624 + ,29143 + ,108517 + ,67407 + ,28121 + ,107127 + ,66103 + ,27007 + ,107088 + ,67466 + ,29112 + ,116321 + ,81088 + ,44067 + ,125045 + ,86781 + ,48481 + ,116779 + ,79964 + ,46581 + ,122887 + ,80407 + ,41166 + ,120162 + ,76589 + ,36824 + ,123198 + ,78083 + ,35936 + ,123610 + ,78000 + ,33633 + ,122293 + ,76431 + ,31630 + ,121289 + ,75461 + ,30434 + ,119393 + ,73739 + ,28546 + ,117494 + ,71988 + ,27660 + ,116693 + ,72929 + ,29830 + ,125062 + ,85785 + ,45599 + ,127281 + ,89261 + ,49303 + ,120195 + ,84012 + ,44417 + ,119804 + ,80924 + ,40386 + ,117113 + ,76588 + ,35544 + ,119240 + ,77546 + ,35019 + ,115823 + ,73054 + ,30400 + ,116281 + ,73430 + ,29602 + ,113816 + ,71093 + ,27701 + ,114632 + ,72202 + ,27937 + ,112987 + ,70872 + ,27283 + ,111633 + ,70452 + ,29372 + ,116721 + ,80506 + ,42821 + ,114850 + ,80400 + ,45386 + ,112797 + ,77613 + ,40170 + ,105368 + ,69056 + ,34371 + ,102524 + ,65321 + ,30077 + ,101327 + ,64018 + ,29251 + ,102612 + ,64767 + ,27202 + ,98873 + ,61099 + ,25714 + ,95993 + ,58329 + ,23784 + ,93244 + ,56396 + ,22968 + ,90403 + ,54656 + ,22243 + ,88539 + ,55259 + ,24255 + ,98106 + ,66912 + ,37282 + ,96963 + ,66631 + ,38794 + ,90781 + ,59907 + ,31828 + ,89253 + ,56274 + ,27949 + ,87794 + ,54045 + ,24605 + ,89810 + ,55792 + ,25695 + ,90864 + ,55499 + ,23338 + ,89025 + ,53216 + ,21941 + ,87621 + ,52259 + ,22034 + ,87718 + ,51257 + ,20637 + ,83433 + ,48150 + ,19418 + ,84535 + ,51125 + ,22454 + ,92223 + ,61046 + ,33261 + ,91052 + ,61022 + ,34995 + ,88456 + ,56742 + ,29132 + ,88706 + ,54485 + ,26171 + ,89137 + ,53862 + ,23828 + ,94066 + ,58228 + ,25743 + ,99258 + ,61951 + ,25204 + ,100673 + ,62874 + ,25679 + ,102269 + ,64013 + ,25281 + ,100833 + ,62937 + ,25136 + ,99314 + ,61897 + ,24794 + ,101764 + ,65267 + ,28278 + ,108242 + ,75228 + ,40062 + ,108148 + ,76161 + ,42590 + ,104761 + ,71480 + ,37885 + ,103772 + ,69070 + ,34061 + ,103737 + ,68293 + ,32412 + ,111043 + ,74685 + ,34647 + ,109906 + ,72664 + ,31750 + ,109335 + ,71965 + ,31288 + ,107247 + ,69238 + ,29331 + ,105690 + ,67738 + ,28768 + ,102755 + ,65187 + ,27780 + ,102280 + ,66170 + ,30113 + ,110590 + ,77309 + ,41240 + ,109122 + ,77134 + ,43271 + ,102803 + ,70957 + ,38108 + ,101424 + ,67749 + ,34382 + ,99138 + ,65081 + ,31551) + ,dim=c(3 + ,131) + ,dimnames=list(c('laaggeschoolde' + ,'middengeschoolde' + ,'hooggeschoolde') + ,1:131)) > y <- array(NA,dim=c(3,131),dimnames=list(c('laaggeschoolde','middengeschoolde','hooggeschoolde'),1:131)) > 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/1tv4m1293187456.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] 3 > 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/2fv2a1293187456.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 = 26.9426, df = 129, p-value < 2.2e-16 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: 0.8907282 0.9438190 sample estimates: cor 0.9214692 > 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) + } + } > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/3an001293187456.tab") > > try(system("convert tmp/1tv4m1293187456.ps tmp/1tv4m1293187456.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.507 0.228 1.093