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(NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'Treatment' + ,'UsedStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'Treatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'Treatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'Treatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'Treatment' + ,'UsedStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'Treatment' + ,'UsedStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'Treatment' + ,'UsedStats' + ,'No' + ,NA + ,'Treatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'UsedStats' + ,'No' + ,NA + ,'Treatment' + ,'UsedStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'Treatment' + ,'UsedStats' + ,'No' + ,NA + ,'NoTreatment' + ,'UsedStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'Treatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'UsedStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'UsedStats' + ,'No' + ,NA + ,'Treatment' + ,'UsedStats' + ,'No' + ,NA + ,'Treatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'UsedStats' + ,'Yes' + ,NA + ,'Treatment' + ,'UsedStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'Treatment' + ,'NoStats' + ,'No' + ,NA + ,'Treatment' + ,'UsedStats' + ,'No' + ,NA + ,'Treatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'NoStats' + ,'No' + ,NA + ,'NoTreatment' + ,'UsedStats' + ,'Yes' + ,NA + ,'NoTreatment' + ,'UsedStats' + ,'Yes' + ,NA + ,'NoTreatment' + ,'UsedStats' + ,'No') + ,dim=c(4 + ,68) + ,dimnames=list(c('T40' + ,'T20' + ,'Used' + ,'Correctanalysis') + ,1:68)) > y <- array(NA,dim=c(4,68),dimnames=list(c('T40','T20','Used','Correctanalysis'),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 = '4' > par1 = '2' > main = 'Association Plot' > par3 <- 'Pearson Chi-Squared' > par2 <- '4' > par1 <- '2' > #'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,] NA "NoTreatment" "NoStats" "No" [2,] NA "Treatment" "UsedStats" "No" [3,] NA "NoTreatment" "NoStats" "No" [4,] NA "NoTreatment" "NoStats" "No" [5,] NA "NoTreatment" "NoStats" "No" [6,] NA "Treatment" "NoStats" "No" [7,] NA "NoTreatment" "NoStats" "No" [8,] NA "NoTreatment" "NoStats" "No" [9,] NA "Treatment" "NoStats" "No" [10,] NA "NoTreatment" "NoStats" "No" [11,] NA "Treatment" "NoStats" "No" [12,] NA "NoTreatment" "NoStats" "No" [13,] NA "NoTreatment" "NoStats" "No" [14,] NA "NoTreatment" "NoStats" "No" [15,] NA "NoTreatment" "NoStats" "No" [16,] NA "NoTreatment" "NoStats" "No" [17,] NA "NoTreatment" "NoStats" "No" [18,] NA "NoTreatment" "NoStats" "No" [19,] NA "Treatment" "UsedStats" "No" [20,] NA "NoTreatment" "NoStats" "No" [21,] NA "NoTreatment" "NoStats" "No" [22,] NA "Treatment" "UsedStats" "No" [23,] NA "NoTreatment" "NoStats" "No" [24,] NA "NoTreatment" "NoStats" "No" [25,] NA "Treatment" "UsedStats" "No" [26,] NA "Treatment" "NoStats" "No" [27,] NA "NoTreatment" "UsedStats" "No" [28,] NA "Treatment" "UsedStats" "No" [29,] NA "NoTreatment" "NoStats" "No" [30,] NA "NoTreatment" "NoStats" "No" [31,] NA "NoTreatment" "NoStats" "No" [32,] NA "NoTreatment" "NoStats" "No" [33,] NA "NoTreatment" "NoStats" "No" [34,] NA "NoTreatment" "NoStats" "No" [35,] NA "NoTreatment" "NoStats" "No" [36,] NA "NoTreatment" "NoStats" "No" [37,] NA "Treatment" "UsedStats" "No" [38,] NA "NoTreatment" "UsedStats" "No" [39,] NA "NoTreatment" "NoStats" "No" [40,] NA "Treatment" "NoStats" "No" [41,] NA "NoTreatment" "NoStats" "No" [42,] NA "NoTreatment" "NoStats" "No" [43,] NA "NoTreatment" "NoStats" "No" [44,] NA "NoTreatment" "NoStats" "No" [45,] NA "NoTreatment" "NoStats" "No" [46,] NA "NoTreatment" "NoStats" "No" [47,] NA "NoTreatment" "UsedStats" "No" [48,] NA "NoTreatment" "NoStats" "No" [49,] NA "NoTreatment" "NoStats" "No" [50,] NA "NoTreatment" "NoStats" "No" [51,] NA "NoTreatment" "UsedStats" "No" [52,] NA "Treatment" "UsedStats" "No" [53,] NA "Treatment" "NoStats" "No" [54,] NA "NoTreatment" "NoStats" "No" [55,] NA "NoTreatment" "UsedStats" "Yes" [56,] NA "Treatment" "UsedStats" "No" [57,] NA "NoTreatment" "NoStats" "No" [58,] NA "NoTreatment" "NoStats" "No" [59,] NA "NoTreatment" "NoStats" "No" [60,] NA "Treatment" "NoStats" "No" [61,] NA "Treatment" "UsedStats" "No" [62,] NA "Treatment" "NoStats" "No" [63,] NA "NoTreatment" "NoStats" "No" [64,] NA "NoTreatment" "NoStats" "No" [65,] NA "NoTreatment" "NoStats" "No" [66,] NA "NoTreatment" "UsedStats" "Yes" [67,] NA "NoTreatment" "UsedStats" "Yes" [68,] NA "NoTreatment" "UsedStats" "No" > (table1 <- table(z[,cat1],z[,cat2])) No Yes NoTreatment 48 3 Treatment 17 0 > (V1<-dimnames(y)[[1]][cat1]) [1] "T20" > (V2<-dimnames(y)[[1]][cat2]) [1] "Correctanalysis" > postscript(file="/var/wessaorg/rcomp/tmp/1esr91356130335.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/2wk551356130335.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.1162, df = 1, p-value = 0.7331 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/3xh181356130335.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/4bs1u1356130335.tab") > > try(system("convert tmp/1esr91356130335.ps tmp/1esr91356130335.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.200 0.430 3.606