R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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(1772 + ,158258 + ,89 + ,20465 + ,1703 + ,186930 + ,57 + ,33629 + ,192 + ,7215 + ,18 + ,1423 + ,2294 + ,129098 + ,94 + ,25629 + ,3448 + ,230587 + ,134 + ,54002 + ,6813 + ,508313 + ,261 + ,151036 + ,1795 + ,180745 + ,56 + ,33287 + ,1680 + ,185559 + ,58 + ,31172 + ,1896 + ,154581 + ,43 + ,28113 + ,2917 + ,290658 + ,95 + ,57803 + ,1946 + ,121844 + ,75 + ,49830 + ,2148 + ,184039 + ,69 + ,52143 + ,1832 + ,100324 + ,98 + ,21055 + ,3059 + ,209427 + ,114 + ,47007 + ,1469 + ,167592 + ,57 + ,28735 + ,1565 + ,154593 + ,86 + ,59147 + ,1755 + ,142018 + ,56 + ,78950 + ,1234 + ,77855 + ,59 + ,13497 + ,2779 + ,167047 + ,87 + ,46154 + ,726 + ,27997 + ,24 + ,53249 + ,1048 + ,73019 + ,59 + ,10726 + ,2804 + ,241082 + ,99 + ,83700 + ,1760 + ,195820 + ,72 + ,40400 + ,2261 + ,141899 + ,53 + ,33797 + ,1848 + ,145433 + ,86 + ,36205 + ,1647 + ,180241 + ,31 + ,30165 + ,2081 + ,202232 + ,160 + ,58534 + ,1393 + ,190230 + ,91 + ,44663 + ,2741 + ,354924 + ,118 + ,92556 + ,2112 + ,192399 + ,44 + ,40078 + ,1684 + ,182286 + ,44 + ,34711 + ,1616 + ,181590 + ,45 + ,31076 + ,2227 + ,133801 + ,105 + ,74608 + ,3088 + ,233686 + ,123 + ,58092 + ,2388 + ,219428 + ,52 + ,42009 + ,1 + ,0 + ,1 + ,0 + ,2099 + ,223044 + ,63 + ,36022 + ,1669 + ,100129 + ,51 + ,23333 + ,2094 + ,136733 + ,47 + ,53349 + ,2153 + ,249965 + ,64 + ,92596 + ,2390 + ,242379 + ,71 + ,49598 + ,1701 + ,145794 + ,59 + ,44093 + ,983 + ,96404 + ,32 + ,84205 + ,2161 + ,195891 + ,78 + ,63369 + ,1276 + ,117156 + ,50 + ,60132 + ,1189 + ,157787 + ,94 + ,37403 + ,744 + ,81293 + ,31 + ,24460 + ,2231 + ,224049 + ,100 + ,46456 + ,2242 + ,223789 + ,87 + ,66616 + ,2638 + ,160344 + ,58 + ,41554 + ,658 + ,48188 + ,28 + ,22346 + ,1859 + ,152206 + ,68 + ,30874 + ,2489 + ,294283 + ,73 + ,68701 + ,2025 + ,235223 + ,78 + ,35728 + ,1911 + ,195583 + ,59 + ,29010 + ,1714 + ,145942 + ,54 + ,23110 + ,1851 + ,208834 + ,66 + ,38844 + ,980 + ,93764 + ,23 + ,27084 + ,1177 + ,151985 + ,66 + ,35139 + ,2809 + ,190545 + ,95 + ,57476 + ,1688 + ,148922 + ,60 + ,33277 + ,2097 + ,132856 + ,80 + ,31141 + ,1309 + ,126107 + ,60 + ,61281 + ,1243 + ,112718 + ,36 + ,25820 + ,1255 + ,160930 + ,34 + ,23284 + ,1293 + ,99184 + ,40 + ,35378 + ,2259 + ,182022 + ,69 + ,74990 + ,2897 + ,138708 + ,65 + ,29653 + ,1103 + ,114408 + ,38 + ,64622 + ,340 + ,31970 + ,15 + ,4157 + ,2791 + ,225558 + ,112 + ,29245 + ,1333 + ,137011 + ,71 + ,50008 + ,1441 + ,113612 + ,68 + ,52338 + ,1622 + ,108641 + ,70 + ,13310 + ,2649 + ,162203 + ,66 + ,92901 + ,1499 + ,100098 + ,44 + ,10956 + ,2302 + ,174768 + ,60 + ,34241 + ,2540 + ,158459 + ,97 + ,75043 + ,1000 + ,80934 + ,30 + ,21152 + ,1234 + ,84971 + ,71 + ,42249 + ,927 + ,80545 + ,68 + ,42005 + ,2176 + ,287191 + ,64 + ,41152 + ,956 + ,62974 + ,27 + ,14399 + ,1531 + ,130982 + ,38 + ,28263 + ,1013 + ,75555 + ,45 + ,17215 + ,1771 + ,162154 + ,54 + ,48140 + ,2613 + ,226638 + ,227 + ,62897 + ,1203 + ,115019 + ,110 + ,22883 + ,1303 + ,105038 + ,60 + ,41622 + ,1524 + ,155537 + ,52 + ,40715 + ,1829 + ,153133 + ,41 + ,65897 + ,2227 + ,165577 + ,76 + ,76542 + ,1233 + ,151517 + ,57 + ,37477 + ,1365 + ,133686 + ,58 + ,53216 + ,901 + ,58128 + ,38 + ,40911 + ,2319 + ,245196 + ,117 + ,57021 + ,1857 + ,195576 + ,70 + ,73116 + ,223 + ,19349 + ,12 + ,3895 + ,2390 + ,225371 + ,105 + ,46609 + ,1973 + ,152796 + ,76 + ,29351 + ,699 + ,59117 + ,28 + ,2325 + ,1062 + ,91762 + ,24 + ,31747 + ,1252 + ,127987 + ,52 + ,32665 + ,1154 + ,113552 + ,58 + ,19249 + ,823 + ,85338 + ,40 + ,15292 + ,596 + ,27676 + ,22 + ,5842 + ,1471 + ,147984 + ,47 + ,33994 + ,1130 + ,122417 + ,37 + ,13018 + ,0 + ,0 + ,0 + ,0 + ,1082 + ,91529 + ,32 + ,98177 + ,1134 + ,107205 + ,66 + ,37941 + ,1366 + ,144664 + ,44 + ,31032 + ,1452 + ,136540 + ,62 + ,32683 + ,869 + ,76656 + ,59 + ,34545 + ,78 + ,3616 + ,5 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1127 + ,183065 + ,43 + ,27525 + ,1578 + ,144636 + ,83 + ,66856 + ,2018 + ,156889 + ,97 + ,28549 + ,919 + ,113273 + ,38 + ,38610 + ,778 + ,43410 + ,19 + ,2781 + ,1751 + ,175774 + ,72 + ,41211 + ,956 + ,95401 + ,41 + ,22698 + ,1875 + ,118893 + ,54 + ,41194 + ,731 + ,60493 + ,40 + ,32689 + ,285 + ,19764 + ,12 + ,5752 + ,1833 + ,164062 + ,55 + ,26757 + ,1147 + ,132696 + ,32 + ,22527 + ,1646 + ,155367 + ,54 + ,44810 + ,256 + ,11796 + ,9 + ,0 + ,98 + ,10674 + ,9 + ,0 + ,1403 + ,142261 + ,56 + ,100674 + ,41 + ,6836 + ,3 + ,0 + ,1786 + ,154206 + ,61 + ,57786 + ,42 + ,5118 + ,3 + ,0 + ,528 + ,40248 + ,16 + ,5444 + ,0 + ,0 + ,0 + ,0 + ,1072 + ,122641 + ,46 + ,28470 + ,1305 + ,88837 + ,38 + ,61849 + ,81 + ,7131 + ,4 + ,0 + ,261 + ,9056 + ,14 + ,2179 + ,934 + ,76611 + ,24 + ,8019 + ,1179 + ,132697 + ,50 + ,39644 + ,1147 + ,100681 + ,19 + ,23494) + ,dim=c(4 + ,144) + ,dimnames=list(c('page_views' + ,'Time_spent' + ,'Logins' + ,'Writing') + ,1:144)) > y <- array(NA,dim=c(4,144),dimnames=list(c('page_views','Time_spent','Logins','Writing'),1:144)) > 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' > 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/wessaorg/rcomp/tmp/1mab21344775899.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/2vql11344775899.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 = 12.4866, p-value < 2.2e-16 alternative hypothesis: true tau is not equal to 0 sample estimates: tau 0.702595 > 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 > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/37vd11344775899.tab") > > try(system("convert tmp/1mab21344775899.ps tmp/1mab21344775899.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.435 0.194 1.616