R version 3.2.2 (2015-08-14) -- "Fire Safety" Copyright (C) 2015 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-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(25 + ,0 + ,0 + ,245 + ,253 + ,1 + ,0 + ,0 + ,1 + ,71 + ,33 + ,0 + ,0 + ,238 + ,253 + ,1 + ,0 + ,0 + ,1 + ,54 + ,26 + ,0 + ,0 + ,233 + ,257 + ,1 + ,0 + ,0 + ,1 + ,44 + ,33 + ,0 + ,0 + ,201 + ,245 + ,0 + ,0 + ,0 + ,1 + ,63 + ,31 + ,0 + ,0 + ,204 + ,242 + ,0 + ,0 + ,0 + ,1 + ,78 + ,26 + ,0 + ,0 + ,210 + ,248 + ,0 + ,0 + ,0 + ,1 + ,52 + ,29 + ,0 + ,1 + ,225 + ,254 + ,0 + ,0 + ,1 + ,1 + ,59 + ,28 + ,0 + ,0 + ,242 + ,232 + ,0 + ,0 + ,0 + ,1 + ,67 + ,26 + ,1 + ,0 + ,243 + ,233 + ,0 + ,1 + ,0 + ,1 + ,80 + ,26 + ,1 + ,0 + ,211 + ,245 + ,0 + ,0 + ,1 + ,1 + ,55 + ,27 + ,1 + ,NA + ,249 + ,249 + ,0 + ,0 + ,0 + ,1 + ,93 + ,27 + ,1 + ,0 + ,250 + ,265 + ,1 + ,0 + ,0 + ,1 + ,44 + ,25 + ,0 + ,0 + ,209 + ,247 + ,0 + ,0 + ,0 + ,1 + ,92 + ,26 + ,0 + ,0 + ,208 + ,252 + ,0 + ,0 + ,0 + ,1 + ,74 + ,31 + ,0 + ,0 + ,238 + ,253 + ,0 + ,0 + ,0 + ,1 + ,82 + ,32 + ,0 + ,0 + ,235 + ,NA + ,0 + ,0 + ,0 + ,0 + ,52 + ,31 + ,0 + ,0 + ,240 + ,NA + ,0 + ,0 + ,0 + ,0 + ,63 + ,26 + ,0 + ,0 + ,224 + ,249 + ,0 + ,1 + ,0 + ,1 + ,85 + ,30 + ,1 + ,0 + ,209 + ,242 + ,0 + ,0 + ,0 + ,1 + ,82 + ,27 + ,1 + ,0 + ,244 + ,254 + ,1 + ,0 + ,0 + ,1 + ,59 + ,28 + ,1 + ,0 + ,232 + ,243 + ,0 + ,0 + ,0 + ,1 + ,50 + ,26 + ,0 + ,0 + ,245 + ,254 + ,0 + ,0 + ,0 + ,1 + ,48 + ,30 + ,0 + ,0 + ,199 + ,243 + ,0 + ,0 + ,0 + ,1 + ,48 + ,27 + ,0 + ,0 + ,231 + ,243 + ,0 + ,0 + ,0 + ,1 + ,75 + ,26 + ,1 + ,0 + ,242 + ,253 + ,0 + ,1 + ,0 + ,1 + ,93 + ,27 + ,1 + ,0 + ,218 + ,244 + ,0 + ,0 + ,0 + ,1 + ,56 + ,25 + ,1 + ,0 + ,265 + ,264 + ,1 + ,1 + ,0 + ,1 + ,47 + ,27 + ,0 + ,0 + ,216 + ,238 + ,0 + ,0 + ,0 + ,0 + ,74 + ,28 + ,1 + ,0 + ,253 + ,256 + ,1 + ,0 + ,0 + ,1 + ,48 + ,26 + ,1 + ,0 + ,213 + ,250 + ,0 + ,0 + ,0 + ,1 + ,67 + ,32 + ,1 + ,0 + ,257 + ,256 + ,0 + ,0 + ,0 + ,1 + ,89 + ,24 + ,0 + ,0 + ,258 + ,266 + ,1 + ,0 + ,0 + ,1 + ,44 + ,26 + ,0 + ,0 + ,245 + ,NA + ,1 + ,0 + ,1 + ,1 + ,59 + ,30 + ,1 + ,0 + ,214 + ,245 + ,0 + ,0 + ,0 + ,1 + ,67 + ,28 + ,1 + ,0 + ,229 + ,NA + ,0 + ,0 + ,0 + ,0 + ,43 + ,29 + ,0 + ,1 + ,227 + ,240 + ,1 + ,0 + ,0 + ,1 + ,54 + ,27 + ,0 + ,0 + ,236 + ,240 + ,0 + ,0 + ,0 + ,1 + ,70 + ,26 + ,0 + ,0 + ,213 + ,229 + ,0 + ,0 + ,0 + ,0 + ,44 + ,27 + ,0 + ,0 + ,233 + ,NA + ,0 + ,0 + ,1 + ,0 + ,52 + ,26 + ,1 + ,0 + ,234 + ,248 + ,0 + ,0 + ,0 + ,0 + ,44 + ,25 + ,1 + ,0 + ,215 + ,243 + ,0 + ,0 + ,0 + ,1 + ,52 + ,31 + ,0 + ,0 + ,220 + ,NA + ,0 + ,1 + ,0 + ,0 + ,67 + ,25 + ,0 + ,0 + ,212 + ,222 + ,0 + ,0 + ,0 + ,0 + ,44 + ,35 + ,1 + ,1 + ,244 + ,256 + ,1 + ,1 + ,0 + ,1 + ,67 + ,25 + ,0 + ,0 + ,216 + ,245 + ,0 + ,0 + ,1 + ,1 + ,52 + ,34 + ,1 + ,1 + ,219 + ,256 + ,1 + ,1 + ,1 + ,1 + ,70 + ,38 + ,0 + ,1 + ,209 + ,253 + ,0 + ,0 + ,0 + ,1 + ,93 + ,30 + ,1 + ,NA + ,210 + ,201 + ,0 + ,0 + ,0 + ,0 + ,52 + ,28 + ,0 + ,0 + ,224 + ,246 + ,0 + ,0 + ,0 + ,1 + ,78 + ,26 + ,0 + ,0 + ,226 + ,246 + ,0 + ,0 + ,0 + ,1 + ,58 + ,33 + ,1 + ,1 + ,249 + ,261 + ,1 + ,0 + ,0 + ,1 + ,72 + ,25 + ,1 + ,0 + ,245 + ,254 + ,0 + ,0 + ,1 + ,1 + ,72 + ,25 + ,0 + ,0 + ,227 + ,237 + ,0 + ,0 + ,0 + ,0 + ,75 + ,32 + ,1 + ,0 + ,223 + ,243 + ,0 + ,0 + ,0 + ,1 + ,78 + ,27 + ,1 + ,0 + ,249 + ,257 + ,1 + ,0 + ,0 + ,1 + ,78 + ,26 + ,0 + ,0 + ,237 + ,NA + ,0 + ,0 + ,0 + ,0 + ,47 + ,27 + ,0 + ,0 + ,216 + ,248 + ,0 + ,0 + ,0 + ,1 + ,67 + ,27 + ,0 + ,0 + ,241 + ,241 + ,0 + ,0 + ,0 + ,1 + ,58 + ,27 + ,1 + ,0 + ,218 + ,240 + ,0 + ,0 + ,1 + ,1 + ,61 + ,25 + ,1 + ,1 + ,229 + ,232 + ,0 + ,0 + ,0 + ,0 + ,61 + ,26 + ,1 + ,0 + ,254 + ,259 + ,0 + ,0 + ,0 + ,1 + ,69 + ,27 + ,1 + ,0 + ,225 + ,NA + ,0 + ,0 + ,0 + ,0 + ,72 + ,NA + ,1 + ,1 + ,247 + ,260 + ,1 + ,0 + ,0 + ,1 + ,56 + ,28 + ,1 + ,0 + ,212 + ,NA + ,0 + ,0 + ,1 + ,0 + ,70 + ,26 + ,0 + ,0 + ,229 + ,261 + ,1 + ,1 + ,0 + ,1 + ,77 + ,26 + ,0 + ,0 + ,204 + ,258 + ,0 + ,0 + ,0 + ,1 + ,67 + ,25 + ,0 + ,1 + ,222 + ,252 + ,0 + ,0 + ,0 + ,1 + ,64 + ,24 + ,0 + ,0 + ,222 + ,243 + ,0 + ,0 + ,0 + ,1 + ,65 + ,32 + ,1 + ,0 + ,254 + ,257 + ,1 + ,0 + ,0 + ,1 + ,69 + ,31 + ,1 + ,0 + ,NA + ,NA + ,0 + ,0 + ,0 + ,0 + ,52 + ,28 + ,1 + ,0 + ,226 + ,219 + ,0 + ,0 + ,0 + ,0 + ,47 + ,28 + ,1 + ,1 + ,240 + ,248 + ,0 + ,0 + ,0 + ,1 + ,74 + ,27 + ,1 + ,0 + ,221 + ,241 + ,0 + ,0 + ,0 + ,1 + ,58 + ,25 + ,1 + ,0 + ,219 + ,242 + ,0 + ,0 + ,0 + ,1 + ,50 + ,29 + ,1 + ,0 + ,236 + ,229 + ,0 + ,0 + ,0 + ,0 + ,56 + ,26 + ,1 + ,0 + ,221 + ,238 + ,0 + ,0 + ,0 + ,0 + ,55 + ,25 + ,0 + ,0 + ,237 + ,260 + ,1 + ,0 + ,0 + ,1 + ,61 + ,26 + ,0 + ,0 + ,231 + ,229 + ,0 + ,0 + ,0 + ,0 + ,86 + ,25 + ,0 + ,0 + ,233 + ,249 + ,0 + ,1 + ,0 + ,1 + ,55 + ,25 + ,0 + ,0 + ,230 + ,250 + ,0 + ,0 + ,0 + ,1 + ,69 + ,28 + ,0 + ,0 + ,212 + ,243 + ,0 + ,0 + ,0 + ,1 + ,81 + ,26 + ,0 + ,0 + ,228 + ,246 + ,0 + ,0 + ,0 + ,1 + ,55 + ,26 + ,0 + ,0 + ,218 + ,244 + ,0 + ,0 + ,0 + ,1 + ,80 + ,26 + ,1 + ,0 + ,245 + ,NA + ,1 + ,0 + ,0 + ,1 + ,58 + ,26 + ,1 + ,0 + ,243 + ,257 + ,0 + ,0 + ,0 + ,1 + ,58 + ,30 + ,1 + ,1 + ,247 + ,259 + ,1 + ,0 + ,0 + ,1 + ,44 + ,28 + ,0 + ,0 + ,221 + ,237 + ,0 + ,0 + ,0 + ,0 + ,44 + ,31 + ,0 + ,1 + ,215 + ,222 + ,0 + ,0 + ,0 + ,0 + ,64 + ,31 + ,0 + ,0 + ,228 + ,251 + ,1 + ,0 + ,0 + ,1 + ,55 + ,26 + ,1 + ,0 + ,259 + ,NA + ,0 + ,0 + ,1 + ,1 + ,72 + ,26 + ,1 + ,0 + ,234 + ,248 + ,0 + ,0 + ,0 + ,1 + ,61 + ,25 + ,1 + ,0 + ,251 + ,259 + ,0 + ,0 + ,0 + ,1 + ,73 + ,26 + ,0 + ,0 + ,216 + ,252 + ,0 + ,0 + ,0 + ,1 + ,63 + ,30 + ,0 + ,0 + ,229 + ,248 + ,0 + ,1 + ,1 + ,1 + ,78 + ,26 + ,0 + ,0 + ,216 + ,259 + ,1 + ,0 + ,0 + ,1 + ,69 + ,33 + ,0 + ,0 + ,217 + ,229 + ,0 + ,1 + ,0 + ,0 + ,72 + ,27 + ,0 + ,0 + ,238 + ,244 + ,1 + ,0 + ,0 + ,1 + ,61 + ,32 + ,1 + ,1 + ,239 + ,262 + ,0 + ,0 + ,0 + ,1 + ,58 + ,29 + ,1 + ,0 + ,215 + ,223 + ,0 + ,0 + ,0 + ,0 + ,64 + ,26 + ,1 + ,0 + ,214 + ,243 + ,0 + ,0 + ,0 + ,1 + ,72 + ,27 + ,0 + ,0 + ,213 + ,231 + ,0 + ,0 + ,0 + ,0 + ,69 + ,27 + ,0 + ,0 + ,237 + ,241 + ,0 + ,0 + ,0 + ,1 + ,78 + ,29 + ,1 + ,0 + ,245 + ,234 + ,0 + ,0 + ,0 + ,1 + ,61 + ,27 + ,1 + ,0 + ,242 + ,NA + ,1 + ,0 + ,0 + ,1 + ,75 + ,27 + ,1 + ,0 + ,244 + ,238 + ,0 + ,1 + ,0 + ,1 + ,72 + ,35 + ,1 + ,0 + ,266 + ,264 + ,1 + ,0 + ,0 + ,1 + ,95 + ,25 + ,1 + ,0 + ,254 + ,NA + ,1 + ,0 + ,0 + ,1 + ,75 + ,28 + ,0 + ,1 + ,207 + ,246 + ,0 + ,1 + ,0 + ,1 + ,69 + ,28 + ,1 + ,1 + ,217 + ,246 + ,0 + ,0 + ,1 + ,1 + ,53 + ,27 + ,0 + ,1 + ,210 + ,221 + ,0 + ,1 + ,0 + ,0 + ,89) + ,dim=c(10 + ,110) + ,dimnames=list(c('age' + ,'gender' + ,'humanity' + ,'step1' + ,'step2' + ,'quartile' + ,'gold' + ,'25' + ,'uslmehigh' + ,'avg') + ,1:110)) > y <- array(NA,dim=c(10,110),dimnames=list(c('age','gender','humanity','step1','step2','quartile','gold','25','uslmehigh','avg'),1:110)) > 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 = 'Scatter Plots and p-values' > par1 <- 'pearson' > #'GNU S' R Code compiled by R2WASP v. 1.2.327 () > #Author: root > #To cite this work: Patrick Wessa, (2013), Multivariate Correlation Matrix (v1.0.7) 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: > # > 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/1yoj91446567815.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] 10 > 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/27maj1446567815.tab") > ncorrs <- (n*n -n)/2 > mycorrs <- array(0, dim=c(10,3)) > 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 = 0.80104, df = 107, p-value = 0.4249 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: -0.1125276 0.2615121 sample estimates: cor 0.07720836 > 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) + for (iii in 1:10) { + iiid100 <- iii / 100 + if (rp$p.value < iiid100) mycorrs[iii, 1] = mycorrs[iii, 1] + 1 + if (rs$p.value < iiid100) mycorrs[iii, 2] = mycorrs[iii, 2] + 1 + if (rk$p.value < iiid100) mycorrs[iii, 3] = mycorrs[iii, 3] + 1 + } + } + } There were 45 warnings (use warnings() to see them) > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/3onlw1446567815.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Meta Analysis of Correlation Tests',4,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Number of significant by total number of Correlations',4,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Type I error',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) > for (iii in 1:10) { + iiid100 <- iii / 100 + a<-table.row.start(a) + a<-table.element(a,round(iiid100,2),header=T) + a<-table.element(a,round(mycorrs[iii,1]/ncorrs,2)) + a<-table.element(a,round(mycorrs[iii,2]/ncorrs,2)) + a<-table.element(a,round(mycorrs[iii,3]/ncorrs,2)) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/4oia51446567815.tab") > > try(system("convert tmp/1yoj91446567815.ps tmp/1yoj91446567815.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.525 0.135 1.658