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('Treatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'Treatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'Treatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'UsedStats' + ,'No' + ,'Treatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'UsedStats' + ,'No' + ,'Treatment' + ,NA + ,'UsedStats' + ,'No' + ,'Treatment' + ,NA + ,'UsedStats' + ,'Yes' + ,'Treatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'Treatment' + ,NA + ,'UsedStats' + ,'Yes' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'UsedStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'Treatment' + ,NA + ,'UsedStats' + ,'No' + ,'NoTreatment' + ,NA + ,'UsedStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'UsedStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'Treatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'Treatment' + ,NA + ,'UsedStats' + ,'No' + ,'NoTreatment' + ,NA + ,'UsedStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'Treatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'UsedStats' + ,'Yes' + ,'NoTreatment' + ,NA + ,'UsedStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'Treatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'Treatment' + ,NA + ,'UsedStats' + ,'No' + ,'Treatment' + ,NA + ,'UsedStats' + ,'Yes' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'UsedStats' + ,'Yes' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'Treatment' + ,NA + ,'UsedStats' + ,'No' + ,'NoTreatment' + ,NA + ,'UsedStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'Treatment' + ,NA + ,'UsedStats' + ,'Yes' + ,'Treatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'UsedStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'Treatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'Treatment' + ,NA + ,'UsedStats' + ,'Yes' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'UsedStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'UsedStats' + ,'No' + ,'NoTreatment' + ,NA + ,'UsedStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'Treatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'UsedStats' + ,'No' + ,'Treatment' + ,NA + ,'UsedStats' + ,'Yes' + ,'Treatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'UsedStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'UsedStats' + ,'Yes' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No' + ,'NoTreatment' + ,NA + ,'NoStats' + ,'No') + ,dim=c(4 + ,86) + ,dimnames=list(c('T40' + ,'T20' + ,'Used' + ,'CorrectAnalysis') + ,1:86)) > y <- array(NA,dim=c(4,86),dimnames=list(c('T40','T20','Used','CorrectAnalysis'),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 = '4' > par1 = '1' > main = 'Association Plot' > par3 <- 'Exact Pearson Chi-Squared by Simulation' > par2 <- '4' > par1 <- '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Dr. Ian E. Holliday > #To cite this work: Ian E. Holliday, 2009, 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: > #Technical description: > 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] [1,] "Treatment" NA "NoStats" "No" [2,] "NoTreatment" NA "NoStats" "No" [3,] "NoTreatment" NA "NoStats" "No" [4,] "NoTreatment" NA "NoStats" "No" [5,] "NoTreatment" NA "NoStats" "No" [6,] "NoTreatment" NA "NoStats" "No" [7,] "NoTreatment" NA "NoStats" "No" [8,] "Treatment" NA "NoStats" "No" [9,] "NoTreatment" NA "NoStats" "No" [10,] "NoTreatment" NA "NoStats" "No" [11,] "Treatment" NA "NoStats" "No" [12,] "NoTreatment" NA "NoStats" "No" [13,] "NoTreatment" NA "UsedStats" "No" [14,] "Treatment" NA "NoStats" "No" [15,] "NoTreatment" NA "UsedStats" "No" [16,] "Treatment" NA "UsedStats" "No" [17,] "Treatment" NA "UsedStats" "Yes" [18,] "Treatment" NA "NoStats" "No" [19,] "NoTreatment" NA "NoStats" "No" [20,] "Treatment" NA "UsedStats" "Yes" [21,] "NoTreatment" NA "NoStats" "No" [22,] "NoTreatment" NA "UsedStats" "No" [23,] "NoTreatment" NA "NoStats" "No" [24,] "NoTreatment" NA "NoStats" "No" [25,] "Treatment" NA "UsedStats" "No" [26,] "NoTreatment" NA "UsedStats" "No" [27,] "NoTreatment" NA "NoStats" "No" [28,] "NoTreatment" NA "UsedStats" "No" [29,] "NoTreatment" NA "NoStats" "No" [30,] "NoTreatment" NA "NoStats" "No" [31,] "NoTreatment" NA "NoStats" "No" [32,] "NoTreatment" NA "NoStats" "No" [33,] "NoTreatment" NA "NoStats" "No" [34,] "Treatment" NA "NoStats" "No" [35,] "NoTreatment" NA "NoStats" "No" [36,] "NoTreatment" NA "NoStats" "No" [37,] "Treatment" NA "UsedStats" "No" [38,] "NoTreatment" NA "UsedStats" "No" [39,] "NoTreatment" NA "NoStats" "No" [40,] "Treatment" NA "NoStats" "No" [41,] "NoTreatment" NA "UsedStats" "Yes" [42,] "NoTreatment" NA "UsedStats" "No" [43,] "NoTreatment" NA "NoStats" "No" [44,] "Treatment" NA "NoStats" "No" [45,] "NoTreatment" NA "NoStats" "No" [46,] "NoTreatment" NA "NoStats" "No" [47,] "NoTreatment" NA "NoStats" "No" [48,] "NoTreatment" NA "NoStats" "No" [49,] "NoTreatment" NA "NoStats" "No" [50,] "NoTreatment" NA "NoStats" "No" [51,] "Treatment" NA "UsedStats" "No" [52,] "Treatment" NA "UsedStats" "Yes" [53,] "NoTreatment" NA "NoStats" "No" [54,] "NoTreatment" NA "UsedStats" "Yes" [55,] "NoTreatment" NA "NoStats" "No" [56,] "Treatment" NA "UsedStats" "No" [57,] "NoTreatment" NA "UsedStats" "No" [58,] "NoTreatment" NA "NoStats" "No" [59,] "NoTreatment" NA "NoStats" "No" [60,] "Treatment" NA "UsedStats" "Yes" [61,] "Treatment" NA "NoStats" "No" [62,] "NoTreatment" NA "UsedStats" "No" [63,] "NoTreatment" NA "NoStats" "No" [64,] "Treatment" NA "NoStats" "No" [65,] "NoTreatment" NA "NoStats" "No" [66,] "NoTreatment" NA "NoStats" "No" [67,] "Treatment" NA "UsedStats" "Yes" [68,] "NoTreatment" NA "NoStats" "No" [69,] "NoTreatment" NA "NoStats" "No" [70,] "NoTreatment" NA "UsedStats" "No" [71,] "NoTreatment" NA "NoStats" "No" [72,] "NoTreatment" NA "NoStats" "No" [73,] "NoTreatment" NA "UsedStats" "No" [74,] "NoTreatment" NA "UsedStats" "No" [75,] "NoTreatment" NA "NoStats" "No" [76,] "Treatment" NA "NoStats" "No" [77,] "NoTreatment" NA "NoStats" "No" [78,] "NoTreatment" NA "UsedStats" "No" [79,] "Treatment" NA "UsedStats" "Yes" [80,] "Treatment" NA "NoStats" "No" [81,] "NoTreatment" NA "NoStats" "No" [82,] "NoTreatment" NA "UsedStats" "No" [83,] "NoTreatment" NA "NoStats" "No" [84,] "NoTreatment" NA "UsedStats" "Yes" [85,] "NoTreatment" NA "NoStats" "No" [86,] "NoTreatment" NA "NoStats" "No" > (table1 <- table(z[,cat1],z[,cat2])) No Yes NoTreatment 60 3 Treatment 17 6 > (V1<-dimnames(y)[[1]][cat1]) [1] "T40" > (V2<-dimnames(y)[[1]][cat2]) [1] "CorrectAnalysis" > postscript(file="/var/wessaorg/rcomp/tmp/1n2cx1355747230.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/246li1355747230.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.009495 > if (par3 == 'McNemar Chi-Squared') { + (cst <- mcnemar.test(table1)) + } > if (par3=='Fisher Exact Test') { + (cst <- fisher.test(table1)) + } > if ((par3 != 'McNemar Chi-Squared') & (par3 != 'Fisher Exact Test')) { + 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/3uleq1355747230.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) > if (par3=='Pearson Chi-Squared') a<-table.element(a, 'Pearson Chi Square Statistic', 1, TRUE) > if (par3=='Exact Pearson Chi-Squared by Simulation') a<-table.element(a, 'Exact Pearson Chi Square Statistic', 1, TRUE) > if (par3=='McNemar Chi-Squared') a<-table.element(a, 'McNemar Chi Square Statistic', 1, TRUE) > if (par3=='Fisher Exact Test') a<-table.element(a, 'Odds Ratio', 1, TRUE) > if (par3=='Fisher Exact Test') { + if ((ncol(table1) == 2) & (nrow(table1) == 2)) { + a<-table.element(a, round(cst$estimate, digits=2), 1,FALSE) + } else { + a<-table.element(a, '--', 1,FALSE) + } + } else { + a<-table.element(a, round(cst$statistic, digits=2), 1,FALSE) + } > a<-table.row.end(a) > if(!simulate.p.value){ + if(par3!='Fisher Exact Test') { + 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/4fm6y1355747230.tab") > > try(system("convert tmp/1n2cx1355747230.ps tmp/1n2cx1355747230.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.623 0.206 1.808