R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-pc-linux-gnu (32-bit) 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(132838 + ,312991 + ,5599 + ,47645 + ,15545 + ,575093 + ,30406 + ,129842 + ,301647 + ,5234 + ,45970 + ,15001 + ,557560 + ,29511 + ,129694 + ,305353 + ,5279 + ,48069 + ,14961 + ,564478 + ,30857 + ,130080 + ,313665 + ,5391 + ,53080 + ,15245 + ,580523 + ,33161 + ,131496 + ,322402 + ,5280 + ,57896 + ,15656 + ,596594 + ,34097 + ,131556 + ,318280 + ,5173 + ,54344 + ,15577 + ,586570 + ,32108 + ,128925 + ,292852 + ,4724 + ,40482 + ,14630 + ,536214 + ,24789 + ,127836 + ,287481 + ,4554 + ,37110 + ,14336 + ,523597 + ,23238 + ,129164 + ,295210 + ,4713 + ,39263 + ,14834 + ,536535 + ,23915 + ,129531 + ,295650 + ,4811 + ,38889 + ,14921 + ,536322 + ,23764 + ,128548 + ,292919 + ,4668 + ,39593 + ,14707 + ,532638 + ,23990 + ,127330 + ,290649 + ,4516 + ,39305 + ,14516 + ,528222 + ,24071 + ,123815 + ,281687 + ,4203 + ,40560 + ,14055 + ,516141 + ,24448 + ,124393 + ,270336 + ,4016 + ,38306 + ,13493 + ,501866 + ,23794 + ,123707 + ,271420 + ,3993 + ,40911 + ,13528 + ,506174 + ,25025 + ,123736 + ,278183 + ,3971 + ,44700 + ,13719 + ,517945 + ,26921 + ,124507 + ,284913 + ,3838 + ,50328 + ,14170 + ,533590 + ,28575 + ,125005 + ,283487 + ,3891 + ,47499 + ,14009 + ,528379 + ,27256 + ,121383 + ,256677 + ,3306 + ,34446 + ,13159 + ,477580 + ,21065 + ,121200 + ,252945 + ,3235 + ,31434 + ,12927 + ,469357 + ,20454 + ,125249 + ,264963 + ,3404 + ,34066 + ,13510 + ,490243 + ,21672 + ,125253 + ,265988 + ,3400 + ,35044 + ,13520 + ,492622 + ,22217 + ,127977 + ,274857 + ,3447 + ,37040 + ,14089 + ,507561 + ,23046 + ,128984 + ,279650 + ,3431 + ,38706 + ,14251 + ,516922 + ,24364 + ,126770 + ,276715 + ,3321 + ,40430 + ,13980 + ,514258 + ,25631 + ,126448 + ,273887 + ,3189 + ,39613 + ,13715 + ,509846 + ,25360 + ,127845 + ,282308 + ,3256 + ,44236 + ,14112 + ,527070 + ,27534 + ,128818 + ,289847 + ,3290 + ,47859 + ,14289 + ,541657 + ,29853 + ,132127 + ,301101 + ,3475 + ,53711 + ,15020 + ,564591 + ,31554 + ,132338 + ,297008 + ,3454 + ,50352 + ,14860 + ,555362 + ,29788 + ,126645 + ,268909 + ,2806 + ,36142 + ,13800 + ,498662 + ,22779 + ,130625 + ,278383 + ,2777 + ,34819 + ,14431 + ,511038 + ,22576 + ,133506 + ,286226 + ,2865 + ,37353 + ,14944 + ,525919 + ,23572 + ,135277 + ,288936 + ,2924 + ,37550 + ,15083 + ,531673 + ,24132 + ,137664 + ,298953 + ,3011 + ,40462 + ,15707 + ,548854 + ,25699 + ,139821 + ,305837 + ,3099 + ,41753 + ,15954 + ,560576 + ,26960 + ,138440 + ,301979 + ,2988 + ,43437 + ,15631 + ,557274 + ,28005 + ,139879 + ,306281 + ,3032 + ,44784 + ,15813 + ,565742 + ,29114 + ,142256 + ,317057 + ,3131 + ,49537 + ,16356 + ,587625 + ,31945 + ,146322 + ,334780 + ,3343 + ,54974 + ,17086 + ,619916 + ,35559 + ,146389 + ,335895 + ,3275 + ,58535 + ,17302 + ,625809 + ,36259 + ,147841 + ,333874 + ,3243 + ,54762 + ,17247 + ,619567 + ,34018 + ,146449 + ,311028 + ,2897 + ,40738 + ,16398 + ,572942 + ,26543 + ,147960 + ,311767 + ,2818 + ,38052 + ,16590 + ,572775 + ,25672 + ,148487 + ,312575 + ,2836 + ,38436 + ,16673 + ,574205 + ,25925 + ,149802 + ,315040 + ,2721 + ,36993 + ,16962 + ,579799 + ,28472 + ,151387 + ,320325 + ,2742 + ,39056 + ,17278 + ,590072 + ,29669 + ,151936 + ,321178 + ,2707 + ,39996 + ,17224 + ,593408 + ,30786) + ,dim=c(7 + ,48) + ,dimnames=list(c('Basis' + ,'Secundair' + ,'Duaal' + ,'Hoger(Bachelor)' + ,'Leercontract' + ,'Werkloosheid' + ,'Hoger_onderwijs(Master)') + ,1:48)) > y <- array(NA,dim=c(7,48),dimnames=list(c('Basis','Secundair','Duaal','Hoger(Bachelor)','Leercontract','Werkloosheid','Hoger_onderwijs(Master)'),1:48)) > 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' > 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/fisher/rcomp/tmp/12i0t1354815009.ps",horizontal=F,onefile=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/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/fisher/rcomp/createtable") > > n <- length(y[,1]) > n [1] 7 > 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/fisher/rcomp/tmp/21mtx1354815009.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 = 9.5393, df = 46, p-value = 1.785e-12 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: 0.6908467 0.8924675 sample estimates: cor 0.8150018 > 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/fisher/rcomp/tmp/3ri871354815009.tab") > > try(system("convert tmp/12i0t1354815009.ps tmp/12i0t1354815009.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.734 0.303 2.030