R version 2.12.0 (2010-10-15) Copyright (C) 2010 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(04.031636 + ,00.521505 + ,09.166456 + ,01.303763 + ,03.702076 + ,00.424828 + ,07.970589 + ,01.416094 + ,03.056167 + ,00.425031 + ,07.104091 + ,01.052458 + ,03.280707 + ,00.477194 + ,06.621064 + ,01.312283 + ,02.984728 + ,00.828021 + ,07.529215 + ,01.309429 + ,03.693712 + ,00.615619 + ,08.170938 + ,01.492409 + ,03.226317 + ,00.366627 + ,08.157450 + ,01.026556 + ,02.190349 + ,00.430888 + ,07.378962 + ,01.005406 + ,02.599515 + ,00.281029 + ,07.921496 + ,01.334886 + ,03.080288 + ,00.464625 + ,08.156740 + ,01.393873 + ,02.929672 + ,00.269395 + ,08.856365 + ,01.128092 + ,02.922548 + ,00.577905 + ,08.817177 + ,01.122787 + ,03.234943 + ,00.566115 + ,08.734347 + ,01.213104 + ,02.983081 + ,00.507758 + ,09.345927 + ,01.253528 + ,03.284389 + ,00.750718 + ,08.992970 + ,01.094796 + ,03.806511 + ,00.680840 + ,10.785120 + ,00.912944 + ,03.784579 + ,00.766109 + ,08.886867 + ,01.195130 + ,02.645654 + ,00.456147 + ,08.818847 + ,00.927499 + ,03.092081 + ,00.497750 + ,08.823744 + ,00.965333 + ,03.204859 + ,00.419327 + ,09.165298 + ,01.198078 + ,03.107225 + ,00.609551 + ,08.652657 + ,00.966362 + ,03.466909 + ,00.457337 + ,08.173054 + ,00.973685 + ,02.984404 + ,00.570548 + ,07.563416 + ,00.994801 + ,03.218072 + ,00.347900 + ,07.595809 + ,00.826262 + ,02.827310 + ,00.387499 + ,08.381467 + ,00.688888 + ,03.182049 + ,00.582429 + ,07.216432 + ,00.781307 + ,02.236319 + ,00.239103 + ,06.540178 + ,00.604791 + ,02.033218 + ,00.236745 + ,06.238914 + ,01.086240 + ,01.644804 + ,00.262616 + ,05.487288 + ,00.774026 + ,01.627971 + ,00.424093 + ,05.759462 + ,01.026032 + ,01.677559 + ,00.365275 + ,05.993215 + ,00.676435 + ,02.330828 + ,00.375076 + ,07.474726 + ,00.830525 + ,02.493615 + ,00.409006 + ,07.348907 + ,00.791624 + ,02.257172 + ,00.389168 + ,07.303379 + ,00.752391 + ,02.655517 + ,00.240261 + ,07.119314 + ,00.670202 + ,02.298655 + ,00.158950 + ,06.993780 + ,00.880336 + ,02.600402 + ,00.439337 + ,06.958153 + ,00.914297 + ,03.045230 + ,00.509468 + ,07.595706 + ,00.961042 + ,02.790583 + ,00.374347 + ,08.088153 + ,00.930194 + ,03.227052 + ,00.433983 + ,07.555753 + ,00.867966 + ,02.967479 + ,00.413056 + ,07.315433 + ,00.989160 + ,02.938817 + ,00.328893 + ,07.893427 + ,00.997288 + ,03.277961 + ,00.518665 + ,08.858794 + ,00.798744 + ,03.423985 + ,00.548650 + ,08.839367 + ,00.975379 + ,03.072646 + ,00.546911 + ,08.014733 + ,00.934721 + ,02.754253 + ,00.496349 + ,07.873465 + ,00.973234 + ,02.910431 + ,00.530893 + ,08.930377 + ,00.815300 + ,03.174369 + ,00.595776 + ,10.500550 + ,00.940209 + ,03.068387 + ,00.557058 + ,12.611440 + ,00.794493 + ,03.089543 + ,00.573133 + ,11.417870 + ,00.931340 + ,02.906654 + ,00.500542 + ,11.872490 + ,00.922050 + ,02.931161 + ,00.543127 + ,11.060820 + ,00.784517 + ,03.025660 + ,00.559366 + ,12.043310 + ,00.822098 + ,02.939551 + ,00.691169 + ,09.776299 + ,00.891026 + ,02.691019 + ,00.440349 + ,09.557194 + ,00.807306 + ,03.198120 + ,00.567666 + ,09.202590 + ,00.951441 + ,03.076390 + ,00.596911 + ,10.224020 + ,01.147907 + ,02.863873 + ,00.473554 + ,09.350807 + ,01.172609 + ,03.013802 + ,00.592394 + ,08.300913 + ,01.281051 + ,03.053364 + ,00.597556 + ,08.365779 + ,01.165962 + ,02.864753 + ,00.633413 + ,08.133595 + ,00.978911 + ,03.057062 + ,00.605712 + ,07.660470 + ,01.410951 + ,02.959365 + ,00.704611 + ,08.074839 + ,01.197838 + ,03.252258 + ,00.480526 + ,07.848597 + ,01.288368 + ,03.602988 + ,00.702686 + ,07.998220 + ,01.102253 + ,03.497704 + ,00.700902 + ,07.396895 + ,01.197657 + ,03.296867 + ,00.603085 + ,07.900419 + ,01.299984 + ,03.602417 + ,00.698092 + ,08.100500 + ,01.198611 + ,03.300100 + ,00.597656 + ,07.899453 + ,01.299252 + ,03.401930 + ,00.802342 + ,07.599783 + ,01.097604 + ,03.502591 + ,00.601711 + ,08.100929 + ,01.399770 + ,03.402348 + ,00.599313 + ,09.002175 + ,01.398396 + ,03.498551 + ,00.602563 + ,10.298900 + ,01.401880 + ,03.199823 + ,00.701663 + ,10.101520 + ,01.699717 + ,02.700064 + ,00.499571 + ,10.699150 + ,01.397610 + ,02.801034 + ,00.498092 + ,09.698140 + ,01.500135 + ,02.898628 + ,00.497569 + ,09.800951 + ,01.400136 + ,02.800854 + ,00.600183 + ,10.900470 + ,01.400427 + ,02.399942 + ,00.333954 + ,10.697850 + ,01.341477 + ,02.402724 + ,00.274437 + ,09.297252 + ,01.338580 + ,02.202331 + ,00.320943 + ,10.397440 + ,01.482977 + ,02.102594 + ,00.540667 + ,10.900720 + ,01.163253 + ,01.798293 + ,00.405021 + ,12.901270 + ,01.328468 + ,01.202484 + ,00.288596 + ,13.099060 + ,01.234550 + ,01.400201 + ,00.327594 + ,11.698280 + ,01.484741 + ,01.200832 + ,00.313261 + ,11.099870 + ,01.336579 + ,01.298083 + ,00.257556 + ,11.301570 + ,01.339292 + ,01.099742 + ,00.213839 + ,10.702110 + ,01.405225 + ,01.001377 + ,00.186186 + ,10.099310 + ,01.333491 + ,00.836174 + ,00.159271 + ,09.591119 + ,01.149740) + ,dim=c(4 + ,90) + ,dimnames=list(c('Firearm_Suicide' + ,'Firearm_Homicide' + ,'NonFirearm_Suicide' + ,'NonFirearm_Homicide') + ,1:90)) > y <- array(NA,dim=c(4,90),dimnames=list(c('Firearm_Suicide','Firearm_Homicide','NonFirearm_Suicide','NonFirearm_Homicide'),1:90)) > 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: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), 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: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > 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='kendall') + 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/rcomp/tmp/18a3n1293624082.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/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Kendall tau rank correlations for all pairs of data series',3,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'pair',1,TRUE) > a<-table.element(a,'tau',1,TRUE) > a<-table.element(a,'p-value',1,TRUE) > a<-table.row.end(a) > n <- length(y[,1]) > n [1] 4 > cor.test(y[1,],y[2,],method='kendall') Kendall's rank correlation tau data: y[1, ] and y[2, ] z = 7.1552, p-value = 8.353e-13 alternative hypothesis: true tau is not equal to 0 sample estimates: tau 0.5126092 > for (i in 1:(n-1)) + { + for (j in (i+1):n) + { + a<-table.row.start(a) + dum <- paste('tau(',dimnames(t(x))[[2]][i]) + dum <- paste(dum,',') + dum <- paste(dum,dimnames(t(x))[[2]][j]) + dum <- paste(dum,')') + a<-table.element(a,dum,header=TRUE) + r <- cor.test(y[i,],y[j,],method='kendall') + a<-table.element(a,r$estimate) + a<-table.element(a,r$p.value) + a<-table.row.end(a) + } + } > a<-table.end(a) > table.save(a,file="/var/www/rcomp/tmp/252je1293624082.tab") > try(system("convert tmp/18a3n1293624082.ps tmp/18a3n1293624082.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.620 0.230 0.832