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(4 + ,'Yes' + ,1 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Good' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Bad' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Bad' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Bad' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Bad' + ,4 + ,'Yes' + ,2 + ,NA + ,'NoStats' + ,2 + ,'Yes' + ,'Good' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Bad' + ,4 + ,'No' + ,1 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Bad' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Good' + ,4 + ,'Yes' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Bad' + ,4 + ,'Yes' + ,1 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Bad' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Bad' + ,4 + ,'No' + ,2 + ,NA + ,'UsedStats' + ,2 + ,'Yes' + ,'Bad' + ,4 + ,'Yes' + ,1 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Bad' + ,4 + ,'No' + ,2 + ,NA + ,'UsedStats' + ,2 + ,'Yes' + ,'Good' + ,4 + ,'No' + ,1 + ,NA + ,'UsedStats' + ,2 + ,'Yes' + ,'Good' + ,4 + ,'Yes' + ,1 + ,NA + ,'UsedStats' + ,1 + ,'Yes' + ,'Bad' + ,4 + ,'Yes' + ,1 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Bad' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Good' + ,4 + ,'No' + ,1 + ,NA + ,'UsedStats' + ,1 + ,'Yes' + ,'Good' + ,4 + ,'Yes' + ,2 + ,NA + ,'NoStats' + ,2 + ,'Yes' + ,'Bad' + ,4 + ,'Yes' + ,2 + ,NA + ,'UsedStats' + ,2 + ,'Yes' + ,'Good' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'Yes' + ,'Good' + ,4 + ,'Yes' + ,2 + ,NA + ,'NoStats' + ,2 + ,'Yes' + ,'Good' + ,4 + ,'No' + ,1 + ,NA + ,'UsedStats' + ,2 + ,'No' + ,'Good' + ,4 + ,'No' + ,2 + ,NA + ,'UsedStats' + ,2 + ,'Yes' + ,'Bad' + ,4 + ,'Yes' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Good' + ,4 + ,'No' + ,2 + ,NA + ,'UsedStats' + ,2 + ,'No' + ,'Bad' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Good' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'Yes' + ,'Bad' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Bad' + ,4 + ,'Yes' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Bad' + ,4 + ,'Yes' + ,2 + ,NA + ,'NoStats' + ,2 + ,'Yes' + ,'Bad' + ,4 + ,'No' + ,1 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Good' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Bad' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Bad' + ,4 + ,'Yes' + ,1 + ,NA + ,'UsedStats' + ,2 + ,'Yes' + ,'Bad' + ,4 + ,'No' + ,2 + ,NA + ,'UsedStats' + ,2 + ,'No' + ,'Good' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'Yes' + ,'Good' + ,4 + ,'No' + ,1 + ,NA + ,'NoStats' + ,2 + ,'Yes' + ,'Bad' + ,4 + ,'No' + ,2 + ,NA + ,'UsedStats' + ,1 + ,'Yes' + ,'Good' + ,4 + ,'No' + ,2 + ,NA + ,'UsedStats' + ,2 + ,'No' + ,'Good' + ,4 + ,'Yes' + ,2 + ,NA + ,'NoStats' + ,2 + ,'Yes' + ,'Good' + ,4 + ,'Yes' + ,1 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Bad' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'Yes' + ,'Bad' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'Yes' + ,'Good' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Bad' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Good' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'Yes' + ,'Good' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Bad' + ,4 + ,'No' + ,1 + ,NA + ,'UsedStats' + ,2 + ,'No' + ,'Bad' + ,4 + ,'Yes' + ,1 + ,NA + ,'UsedStats' + ,1 + ,'Yes' + ,'Bad' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Good' + ,4 + ,'No' + ,2 + ,NA + ,'UsedStats' + ,1 + ,'No' + ,'Bad' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Bad' + ,4 + ,'No' + ,1 + ,NA + ,'UsedStats' + ,2 + ,'No' + ,'Good' + ,4 + ,'No' + ,2 + ,NA + ,'UsedStats' + ,2 + ,'Yes' + ,'Good' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Good' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Good' + ,4 + ,'Yes' + ,1 + ,NA + ,'UsedStats' + ,1 + ,'Yes' + ,'Good' + ,4 + ,'Yes' + ,1 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Good' + ,4 + ,'No' + ,2 + ,NA + ,'UsedStats' + ,2 + ,'Yes' + ,'Bad' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Bad' + ,4 + ,'Yes' + ,1 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Good' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Bad' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Bad' + ,4 + ,'No' + ,1 + ,NA + ,'UsedStats' + ,1 + ,'Yes' + ,'Bad' + ,4 + ,'Yes' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Bad' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Good' + ,4 + ,'No' + ,2 + ,NA + ,'UsedStats' + ,2 + ,'No' + ,'Bad' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Bad' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Good' + ,4 + ,'No' + ,2 + ,NA + ,'UsedStats' + ,2 + ,'No' + ,'Good' + ,4 + ,'Yes' + ,2 + ,NA + ,'UsedStats' + ,2 + ,'No' + ,'Bad' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Good' + ,4 + ,'No' + ,1 + ,NA + ,'NoStats' + ,2 + ,'Yes' + ,'Good' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Good' + ,4 + ,'No' + ,2 + ,NA + ,'UsedStats' + ,2 + ,'Yes' + ,'Good' + ,4 + ,'No' + ,1 + ,NA + ,'UsedStats' + ,1 + ,'No' + ,'Good' + ,4 + ,'No' + ,1 + ,NA + ,'NoStats' + ,2 + ,'Yes' + ,'Bad' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Bad' + ,4 + ,'Yes' + ,2 + ,NA + ,'UsedStats' + ,2 + ,'No' + ,'Good' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Bad' + ,4 + ,'No' + ,2 + ,NA + ,'UsedStats' + ,1 + ,'No' + ,'Bad' + ,4 + ,'No' + ,2 + ,NA + ,'NoStats' + ,2 + ,'Yes' + ,'Good' + ,4 + ,'Yes' + ,2 + ,NA + ,'NoStats' + ,2 + ,'No' + ,'Bad') + ,dim=c(8 + ,86) + ,dimnames=list(c('weeks' + ,'uselimit' + ,'treatment4' + ,'treatment2' + ,'stats' + ,'correctanalysis' + ,'useful' + ,'outcome') + ,1:86)) > y <- array(NA,dim=c(8,86),dimnames=list(c('weeks','uselimit','treatment4','treatment2','stats','correctanalysis','useful','outcome'),1:86)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } There were 50 or more warnings (use warnings() to see the first 50) > par3 = 'Exact Pearson Chi-Squared by Simulation' > par2 = '6' > par1 = '3' > main = 'Association Plot' > library(vcd) Loading required package: MASS Loading required package: grid Loading required package: colorspace > cat1 <- as.numeric(par1) # > cat2<- as.numeric(par2) # > simulate.p.value=FALSE > if (par3 == 'Exact Pearson Chi-Squared by Simulation') simulate.p.value=TRUE > x <- t(x) > (z <- array(unlist(x),dim=c(length(x[,1]),length(x[1,])))) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] "4" "Yes" "1" NA "NoStats" "2" "No" "Good" [2,] "4" "No" "2" NA "NoStats" "2" "No" "Bad" [3,] "4" "No" "2" NA "NoStats" "2" "No" "Bad" [4,] "4" "No" "2" NA "NoStats" "2" "No" "Bad" [5,] "4" "No" "2" NA "NoStats" "2" "No" "Bad" [6,] "4" "Yes" "2" NA "NoStats" "2" "Yes" "Good" [7,] "4" "No" "2" NA "NoStats" "2" "No" "Bad" [8,] "4" "No" "1" NA "NoStats" "2" "No" "Bad" [9,] "4" "No" "2" NA "NoStats" "2" "No" "Good" [10,] "4" "Yes" "2" NA "NoStats" "2" "No" "Bad" [11,] "4" "Yes" "1" NA "NoStats" "2" "No" "Bad" [12,] "4" "No" "2" NA "NoStats" "2" "No" "Bad" [13,] "4" "No" "2" NA "UsedStats" "2" "Yes" "Bad" [14,] "4" "Yes" "1" NA "NoStats" "2" "No" "Bad" [15,] "4" "No" "2" NA "UsedStats" "2" "Yes" "Good" [16,] "4" "No" "1" NA "UsedStats" "2" "Yes" "Good" [17,] "4" "Yes" "1" NA "UsedStats" "1" "Yes" "Bad" [18,] "4" "Yes" "1" NA "NoStats" "2" "No" "Bad" [19,] "4" "No" "2" NA "NoStats" "2" "No" "Good" [20,] "4" "No" "1" NA "UsedStats" "1" "Yes" "Good" [21,] "4" "Yes" "2" NA "NoStats" "2" "Yes" "Bad" [22,] "4" "Yes" "2" NA "UsedStats" "2" "Yes" "Good" [23,] "4" "No" "2" NA "NoStats" "2" "Yes" "Good" [24,] "4" "Yes" "2" NA "NoStats" "2" "Yes" "Good" [25,] "4" "No" "1" NA "UsedStats" "2" "No" "Good" [26,] "4" "No" "2" NA "UsedStats" "2" "Yes" "Bad" [27,] "4" "Yes" "2" NA "NoStats" "2" "No" "Good" [28,] "4" "No" "2" NA "UsedStats" "2" "No" "Bad" [29,] "4" "No" "2" NA "NoStats" "2" "No" "Good" [30,] "4" "No" "2" NA "NoStats" "2" "Yes" "Bad" [31,] "4" "No" "2" NA "NoStats" "2" "No" "Bad" [32,] "4" "Yes" "2" NA "NoStats" "2" "No" "Bad" [33,] "4" "Yes" "2" NA "NoStats" "2" "Yes" "Bad" [34,] "4" "No" "1" NA "NoStats" "2" "No" "Good" [35,] "4" "No" "2" NA "NoStats" "2" "No" "Bad" [36,] "4" "No" "2" NA "NoStats" "2" "No" "Bad" [37,] "4" "Yes" "1" NA "UsedStats" "2" "Yes" "Bad" [38,] "4" "No" "2" NA "UsedStats" "2" "No" "Good" [39,] "4" "No" "2" NA "NoStats" "2" "Yes" "Good" [40,] "4" "No" "1" NA "NoStats" "2" "Yes" "Bad" [41,] "4" "No" "2" NA "UsedStats" "1" "Yes" "Good" [42,] "4" "No" "2" NA "UsedStats" "2" "No" "Good" [43,] "4" "Yes" "2" NA "NoStats" "2" "Yes" "Good" [44,] "4" "Yes" "1" NA "NoStats" "2" "No" "Bad" [45,] "4" "No" "2" NA "NoStats" "2" "Yes" "Bad" [46,] "4" "No" "2" NA "NoStats" "2" "Yes" "Good" [47,] "4" "No" "2" NA "NoStats" "2" "No" "Bad" [48,] "4" "No" "2" NA "NoStats" "2" "No" "Good" [49,] "4" "No" "2" NA "NoStats" "2" "Yes" "Good" [50,] "4" "No" "2" NA "NoStats" "2" "No" "Bad" [51,] "4" "No" "1" NA "UsedStats" "2" "No" "Bad" [52,] "4" "Yes" "1" NA "UsedStats" "1" "Yes" "Bad" [53,] "4" "No" "2" NA "NoStats" "2" "No" "Good" [54,] "4" "No" "2" NA "UsedStats" "1" "No" "Bad" [55,] "4" "No" "2" NA "NoStats" "2" "No" "Bad" [56,] "4" "No" "1" NA "UsedStats" "2" "No" "Good" [57,] "4" "No" "2" NA "UsedStats" "2" "Yes" "Good" [58,] "4" "No" "2" NA "NoStats" "2" "No" "Good" [59,] "4" "No" "2" NA "NoStats" "2" "No" "Good" [60,] "4" "Yes" "1" NA "UsedStats" "1" "Yes" "Good" [61,] "4" "Yes" "1" NA "NoStats" "2" "No" "Good" [62,] "4" "No" "2" NA "UsedStats" "2" "Yes" "Bad" [63,] "4" "No" "2" NA "NoStats" "2" "No" "Bad" [64,] "4" "Yes" "1" NA "NoStats" "2" "No" "Good" [65,] "4" "No" "2" NA "NoStats" "2" "No" "Bad" [66,] "4" "No" "2" NA "NoStats" "2" "No" "Bad" [67,] "4" "No" "1" NA "UsedStats" "1" "Yes" "Bad" [68,] "4" "Yes" "2" NA "NoStats" "2" "No" "Bad" [69,] "4" "No" "2" NA "NoStats" "2" "No" "Good" [70,] "4" "No" "2" NA "UsedStats" "2" "No" "Bad" [71,] "4" "No" "2" NA "NoStats" "2" "No" "Bad" [72,] "4" "No" "2" NA "NoStats" "2" "No" "Good" [73,] "4" "No" "2" NA "UsedStats" "2" "No" "Good" [74,] "4" "Yes" "2" NA "UsedStats" "2" "No" "Bad" [75,] "4" "No" "2" NA "NoStats" "2" "No" "Good" [76,] "4" "No" "1" NA "NoStats" "2" "Yes" "Good" [77,] "4" "No" "2" NA "NoStats" "2" "No" "Good" [78,] "4" "No" "2" NA "UsedStats" "2" "Yes" "Good" [79,] "4" "No" "1" NA "UsedStats" "1" "No" "Good" [80,] "4" "No" "1" NA "NoStats" "2" "Yes" "Bad" [81,] "4" "No" "2" NA "NoStats" "2" "No" "Bad" [82,] "4" "Yes" "2" NA "UsedStats" "2" "No" "Good" [83,] "4" "No" "2" NA "NoStats" "2" "No" "Bad" [84,] "4" "No" "2" NA "UsedStats" "1" "No" "Bad" [85,] "4" "No" "2" NA "NoStats" "2" "Yes" "Good" [86,] "4" "Yes" "2" NA "NoStats" "2" "No" "Bad" > (table1 <- table(z[,cat1],z[,cat2])) 1 2 1 6 17 2 3 60 > (V1<-dimnames(y)[[1]][cat1]) [1] "treatment4" > (V2<-dimnames(y)[[1]][cat2]) [1] "correctanalysis" > postscript(file="/var/wessaorg/rcomp/tmp/1lt6b1356017686.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > assoc(ftable(z[,cat1],z[,cat2],row.vars=1,dnn=c(V1,V2)),shade=T) > 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") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Tabulation of Results',ncol(table1)+1,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,paste(V1,' x ', V2),ncol(table1)+1,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, ' ', 1,TRUE) > for(nc in 1:ncol(table1)){ + a<-table.element(a, colnames(table1)[nc], 1, TRUE) + } > a<-table.row.end(a) > for(nr in 1:nrow(table1) ){ + a<-table.element(a, rownames(table1)[nr], 1, TRUE) + for(nc in 1:ncol(table1) ){ + a<-table.element(a, table1[nr, nc], 1, FALSE) + } + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/2kbyk1356017686.tab") > (cst<-chisq.test(table1, simulate.p.value=simulate.p.value) ) Pearson's Chi-squared test with simulated p-value (based on 2000 replicates) data: table1 X-squared = 8.1774, df = NA, p-value = 0.01449 > if (par3 == 'McNemar Chi-Squared') { + (cst <- mcnemar.test(table1)) + } > if (par3 != 'McNemar Chi-Squared') { + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Tabulation of Expected Results',ncol(table1)+1,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,paste(V1,' x ', V2),ncol(table1)+1,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a, ' ', 1,TRUE) + for(nc in 1:ncol(table1)){ + a<-table.element(a, colnames(table1)[nc], 1, TRUE) + } + a<-table.row.end(a) + for(nr in 1:nrow(table1) ){ + a<-table.element(a, rownames(table1)[nr], 1, TRUE) + for(nc in 1:ncol(table1) ){ + a<-table.element(a, round(cst$expected[nr, nc], digits=2), 1, FALSE) + } + a<-table.row.end(a) + } + a<-table.end(a) + table.save(a,file="/var/wessaorg/rcomp/tmp/3knuk1356017686.tab") + } > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Statistical Results',2,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, cst$method, 2,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Chi Square Statistic', 1, TRUE) > a<-table.element(a, round(cst$statistic, digits=2), 1,FALSE) > a<-table.row.end(a) > if(!simulate.p.value){ + a<-table.row.start(a) + a<-table.element(a, 'Degrees of Freedom', 1, TRUE) + a<-table.element(a, cst$parameter, 1,FALSE) + a<-table.row.end(a) + } > a<-table.row.start(a) > a<-table.element(a, 'P value', 1, TRUE) > a<-table.element(a, round(cst$p.value, digits=2), 1,FALSE) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/4k4x01356017686.tab") > > try(system("convert tmp/1lt6b1356017686.ps tmp/1lt6b1356017686.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.653 0.272 1.901