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(2 + ,'Yes' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Good' + ,2 + ,'Yes' + ,NA + ,'Treatment' + ,'UsedStats' + ,'No' + ,'No' + ,'Good' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Good' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'Yes' + ,'Bad' + ,2 + ,'Yes' + ,NA + ,'Treatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'Yes' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'Yes' + ,'Bad' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'No' + ,NA + ,'Treatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Good' + ,2 + ,'Yes' + ,NA + ,'Treatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'Yes' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Good' + ,2 + ,'Yes' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Good' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'No' + ,NA + ,'Treatment' + ,'UsedStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'Yes' + ,NA + ,'Treatment' + ,'UsedStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'Yes' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'Yes' + ,NA + ,'Treatment' + ,'UsedStats' + ,'No' + ,'Yes' + ,'Bad' + ,2 + ,'No' + ,NA + ,'Treatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'UsedStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'Yes' + ,NA + ,'Treatment' + ,'UsedStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'Yes' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'Yes' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Good' + ,2 + ,'Yes' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Good' + ,2 + ,'Yes' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'Yes' + ,NA + ,'Treatment' + ,'UsedStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'UsedStats' + ,'No' + ,'Yes' + ,'Good' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Good' + ,2 + ,'No' + ,NA + ,'Treatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'Yes' + ,'Bad' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Good' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Good' + ,2 + ,'Yes' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'Yes' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Good' + ,2 + ,'Yes' + ,NA + ,'NoTreatment' + ,'UsedStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'Yes' + ,NA + ,'NoTreatment' + ,'UsedStats' + ,'No' + ,'Yes' + ,'Good' + ,2 + ,'Yes' + ,NA + ,'Treatment' + ,'UsedStats' + ,'No' + ,'Yes' + ,'Good' + ,2 + ,'No' + ,NA + ,'Treatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'UsedStats' + ,'Yes' + ,'No' + ,'Good' + ,2 + ,'No' + ,NA + ,'Treatment' + ,'UsedStats' + ,'No' + ,'No' + ,'Good' + ,2 + ,'Yes' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'Yes' + ,'Good' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'Yes' + ,'Bad' + ,2 + ,'No' + ,NA + ,'Treatment' + ,'NoStats' + ,'No' + ,'No' + ,'Good' + ,2 + ,'No' + ,NA + ,'Treatment' + ,'UsedStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'No' + ,NA + ,'Treatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'Yes' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Bad' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'Yes' + ,'Good' + ,2 + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,'No' + ,'Good' + ,2 + ,'Yes' + ,NA + ,'NoTreatment' + ,'UsedStats' + ,'Yes' + ,'No' + ,'Bad' + ,2 + ,'Yes' + ,NA + ,'NoTreatment' + ,'UsedStats' + ,'Yes' + ,'Yes' + ,'Bad' + ,2 + ,'Yes' + ,NA + ,'NoTreatment' + ,'UsedStats' + ,'No' + ,'No' + ,'Bad') + ,dim=c(8 + ,68) + ,dimnames=list(c('Weeks' + ,'UseLimit' + ,'T40' + ,'T20' + ,'Used' + ,'CorrectAnalysis' + ,'Useful' + ,'Outcome') + ,1:68)) > y <- array(NA,dim=c(8,68),dimnames=list(c('Weeks','UseLimit','T40','T20','Used','CorrectAnalysis','Useful','Outcome'),1:68)) > 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 = 'Pearson Chi-Squared' > par2 = '7' > par1 = '4' > main = 'Association Plot' > par3 <- 'Pearson Chi-Squared' > par2 <- '7' > par1 <- '4' > #'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] [,5] [,6] [,7] [,8] [1,] "2" "Yes" NA "NoTreatment" "NoStats" "No" "No" "Good" [2,] "2" "Yes" NA "Treatment" "UsedStats" "No" "No" "Good" [3,] "2" "No" NA "NoTreatment" "NoStats" "No" "No" "Bad" [4,] "2" "No" NA "NoTreatment" "NoStats" "No" "No" "Good" [5,] "2" "No" NA "NoTreatment" "NoStats" "No" "Yes" "Bad" [6,] "2" "Yes" NA "Treatment" "NoStats" "No" "No" "Bad" [7,] "2" "Yes" NA "NoTreatment" "NoStats" "No" "Yes" "Bad" [8,] "2" "No" NA "NoTreatment" "NoStats" "No" "No" "Bad" [9,] "2" "No" NA "Treatment" "NoStats" "No" "No" "Bad" [10,] "2" "No" NA "NoTreatment" "NoStats" "No" "No" "Good" [11,] "2" "Yes" NA "Treatment" "NoStats" "No" "No" "Bad" [12,] "2" "No" NA "NoTreatment" "NoStats" "No" "No" "Bad" [13,] "2" "Yes" NA "NoTreatment" "NoStats" "No" "No" "Bad" [14,] "2" "No" NA "NoTreatment" "NoStats" "No" "No" "Good" [15,] "2" "Yes" NA "NoTreatment" "NoStats" "No" "No" "Good" [16,] "2" "No" NA "NoTreatment" "NoStats" "No" "No" "Bad" [17,] "2" "No" NA "NoTreatment" "NoStats" "No" "No" "Bad" [18,] "2" "No" NA "NoTreatment" "NoStats" "No" "No" "Bad" [19,] "2" "No" NA "Treatment" "UsedStats" "No" "No" "Bad" [20,] "2" "No" NA "NoTreatment" "NoStats" "No" "No" "Bad" [21,] "2" "No" NA "NoTreatment" "NoStats" "No" "No" "Bad" [22,] "2" "Yes" NA "Treatment" "UsedStats" "No" "No" "Bad" [23,] "2" "No" NA "NoTreatment" "NoStats" "No" "No" "Bad" [24,] "2" "Yes" NA "NoTreatment" "NoStats" "No" "No" "Bad" [25,] "2" "Yes" NA "Treatment" "UsedStats" "No" "Yes" "Bad" [26,] "2" "No" NA "Treatment" "NoStats" "No" "No" "Bad" [27,] "2" "No" NA "NoTreatment" "UsedStats" "No" "No" "Bad" [28,] "2" "Yes" NA "Treatment" "UsedStats" "No" "No" "Bad" [29,] "2" "Yes" NA "NoTreatment" "NoStats" "No" "No" "Bad" [30,] "2" "No" NA "NoTreatment" "NoStats" "No" "No" "Bad" [31,] "2" "Yes" NA "NoTreatment" "NoStats" "No" "No" "Good" [32,] "2" "Yes" NA "NoTreatment" "NoStats" "No" "No" "Bad" [33,] "2" "No" NA "NoTreatment" "NoStats" "No" "No" "Bad" [34,] "2" "No" NA "NoTreatment" "NoStats" "No" "No" "Good" [35,] "2" "Yes" NA "NoTreatment" "NoStats" "No" "No" "Bad" [36,] "2" "No" NA "NoTreatment" "NoStats" "No" "No" "Bad" [37,] "2" "Yes" NA "Treatment" "UsedStats" "No" "No" "Bad" [38,] "2" "No" NA "NoTreatment" "UsedStats" "No" "Yes" "Good" [39,] "2" "No" NA "NoTreatment" "NoStats" "No" "No" "Good" [40,] "2" "No" NA "Treatment" "NoStats" "No" "No" "Bad" [41,] "2" "No" NA "NoTreatment" "NoStats" "No" "Yes" "Bad" [42,] "2" "No" NA "NoTreatment" "NoStats" "No" "No" "Good" [43,] "2" "No" NA "NoTreatment" "NoStats" "No" "No" "Bad" [44,] "2" "No" NA "NoTreatment" "NoStats" "No" "No" "Good" [45,] "2" "Yes" NA "NoTreatment" "NoStats" "No" "No" "Bad" [46,] "2" "Yes" NA "NoTreatment" "NoStats" "No" "No" "Good" [47,] "2" "Yes" NA "NoTreatment" "UsedStats" "No" "No" "Bad" [48,] "2" "No" NA "NoTreatment" "NoStats" "No" "No" "Bad" [49,] "2" "No" NA "NoTreatment" "NoStats" "No" "No" "Bad" [50,] "2" "No" NA "NoTreatment" "NoStats" "No" "No" "Bad" [51,] "2" "Yes" NA "NoTreatment" "UsedStats" "No" "Yes" "Good" [52,] "2" "Yes" NA "Treatment" "UsedStats" "No" "Yes" "Good" [53,] "2" "No" NA "Treatment" "NoStats" "No" "No" "Bad" [54,] "2" "No" NA "NoTreatment" "NoStats" "No" "No" "Bad" [55,] "2" "No" NA "NoTreatment" "UsedStats" "Yes" "No" "Good" [56,] "2" "No" NA "Treatment" "UsedStats" "No" "No" "Good" [57,] "2" "Yes" NA "NoTreatment" "NoStats" "No" "No" "Bad" [58,] "2" "No" NA "NoTreatment" "NoStats" "No" "Yes" "Good" [59,] "2" "No" NA "NoTreatment" "NoStats" "No" "Yes" "Bad" [60,] "2" "No" NA "Treatment" "NoStats" "No" "No" "Good" [61,] "2" "No" NA "Treatment" "UsedStats" "No" "No" "Bad" [62,] "2" "No" NA "Treatment" "NoStats" "No" "No" "Bad" [63,] "2" "Yes" NA "NoTreatment" "NoStats" "No" "No" "Bad" [64,] "2" "No" NA "NoTreatment" "NoStats" "No" "Yes" "Good" [65,] "2" "No" NA "NoTreatment" "NoStats" "No" "No" "Good" [66,] "2" "Yes" NA "NoTreatment" "UsedStats" "Yes" "No" "Bad" [67,] "2" "Yes" NA "NoTreatment" "UsedStats" "Yes" "Yes" "Bad" [68,] "2" "Yes" NA "NoTreatment" "UsedStats" "No" "No" "Bad" > (table1 <- table(z[,cat1],z[,cat2])) No Yes NoTreatment 42 9 Treatment 15 2 > (V1<-dimnames(y)[[1]][cat1]) [1] "T20" > (V2<-dimnames(y)[[1]][cat2]) [1] "Useful" > postscript(file="/var/wessaorg/rcomp/tmp/1vvh51356123548.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/2d33r1356123548.tab") > (cst<-chisq.test(table1, simulate.p.value=simulate.p.value) ) Pearson's Chi-squared test with Yates' continuity correction data: table1 X-squared = 0.0362, df = 1, p-value = 0.8492 Warning message: In chisq.test(table1, simulate.p.value = simulate.p.value) : Chi-squared approximation may be incorrect > 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/314eo1356123548.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/4o32z1356123548.tab") > > try(system("convert tmp/1vvh51356123548.ps tmp/1vvh51356123548.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.608 0.238 1.823