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('Yes' + ,'Treatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'Yes' + ,'NoTreatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'Treatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'Yes' + ,'NoTreatment' + ,'No' + ,'Yes' + ,'Treatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'Yes' + ,'Treatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'Treatment' + ,'No' + ,'Yes' + ,'Treatment' + ,'Yes' + ,'Yes' + ,'Treatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'Treatment' + ,'Yes' + ,'Yes' + ,'NoTreatment' + ,'No' + ,'Yes' + ,'NoTreatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'Yes' + ,'NoTreatment' + ,'No' + ,'No' + ,'Treatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'Yes' + ,'NoTreatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'Yes' + ,'NoTreatment' + ,'No' + ,'Yes' + ,'NoTreatment' + ,'No' + ,'No' + ,'Treatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'Yes' + ,'Treatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'Treatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'Yes' + ,'No' + ,'NoTreatment' + ,'No' + ,'Yes' + ,'NoTreatment' + ,'No' + ,'Yes' + ,'Treatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'Treatment' + ,'No' + ,'Yes' + ,'Treatment' + ,'Yes' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'Yes' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'Treatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'Yes' + ,'Treatment' + ,'Yes' + ,'Yes' + ,'Treatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'Yes' + ,'Treatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'Treatment' + ,'Yes' + ,'Yes' + ,'NoTreatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'Yes' + ,'NoTreatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'Treatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'Treatment' + ,'Yes' + ,'No' + ,'Treatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'Yes' + ,'NoTreatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'No' + ,'No' + ,'NoTreatment' + ,'Yes' + ,'No' + ,'NoTreatment' + ,'No' + ,'Yes' + ,'NoTreatment' + ,'No' + ,'Yes' + ,NA + ,'No' + ,'Yes' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'Yes' + ,NA + ,'No' + ,'Yes' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'Yes' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'Yes' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'Yes' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'Yes' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'Yes' + ,NA + ,'No' + ,'Yes' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'Yes' + ,NA + ,'No' + ,'Yes' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'Yes' + ,NA + ,'No' + ,'Yes' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'Yes' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'Yes' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'Yes' + ,NA + ,'No' + ,'Yes' + ,NA + ,'No' + ,'Yes' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'Yes' + ,NA + ,'No' + ,'Yes' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'No' + ,NA + ,'Yes' + ,'No' + ,NA + ,'No' + ,'Yes' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'Yes' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'No' + ,NA + ,'No' + ,'Yes' + ,NA + ,'Yes' + ,'Yes' + ,NA + ,'Yes' + ,'Yes' + ,NA + ,'No') + ,dim=c(3 + ,154) + ,dimnames=list(c('T40' + ,'T20' + ,'Correctieanalyse') + ,1:154)) > y <- array(NA,dim=c(3,154),dimnames=list(c('T40','T20','Correctieanalyse'),1:154)) > 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 = '2' > par1 = '1' > main = 'Association Plot' > par3 <- 'Pearson Chi-Squared' > par2 <- '2' > 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] [1,] "Yes" "Treatment" "No" [2,] "No" "NoTreatment" "No" [3,] "No" "NoTreatment" "No" [4,] "No" "NoTreatment" "No" [5,] "No" "NoTreatment" "No" [6,] "Yes" "NoTreatment" "No" [7,] "No" "NoTreatment" "No" [8,] "No" "Treatment" "No" [9,] "No" "NoTreatment" "No" [10,] "Yes" "NoTreatment" "No" [11,] "Yes" "Treatment" "No" [12,] "No" "NoTreatment" "No" [13,] "No" "NoTreatment" "No" [14,] "Yes" "Treatment" "No" [15,] "No" "NoTreatment" "No" [16,] "No" "Treatment" "No" [17,] "Yes" "Treatment" "Yes" [18,] "Yes" "Treatment" "No" [19,] "No" "NoTreatment" "No" [20,] "No" "Treatment" "Yes" [21,] "Yes" "NoTreatment" "No" [22,] "Yes" "NoTreatment" "No" [23,] "No" "NoTreatment" "No" [24,] "Yes" "NoTreatment" "No" [25,] "No" "Treatment" "No" [26,] "No" "NoTreatment" "No" [27,] "Yes" "NoTreatment" "No" [28,] "No" "NoTreatment" "No" [29,] "No" "NoTreatment" "No" [30,] "No" "NoTreatment" "No" [31,] "No" "NoTreatment" "No" [32,] "Yes" "NoTreatment" "No" [33,] "Yes" "NoTreatment" "No" [34,] "No" "Treatment" "No" [35,] "No" "NoTreatment" "No" [36,] "No" "NoTreatment" "No" [37,] "Yes" "Treatment" "No" [38,] "No" "NoTreatment" "No" [39,] "No" "NoTreatment" "No" [40,] "No" "Treatment" "No" [41,] "No" "NoTreatment" "Yes" [42,] "No" "NoTreatment" "No" [43,] "Yes" "NoTreatment" "No" [44,] "Yes" "Treatment" "No" [45,] "No" "NoTreatment" "No" [46,] "No" "NoTreatment" "No" [47,] "No" "NoTreatment" "No" [48,] "No" "NoTreatment" "No" [49,] "No" "NoTreatment" "No" [50,] "No" "NoTreatment" "No" [51,] "No" "Treatment" "No" [52,] "Yes" "Treatment" "Yes" [53,] "No" "NoTreatment" "No" [54,] "No" "NoTreatment" "Yes" [55,] "No" "NoTreatment" "No" [56,] "No" "Treatment" "No" [57,] "No" "NoTreatment" "No" [58,] "No" "NoTreatment" "No" [59,] "No" "NoTreatment" "No" [60,] "Yes" "Treatment" "Yes" [61,] "Yes" "Treatment" "No" [62,] "No" "NoTreatment" "No" [63,] "No" "NoTreatment" "No" [64,] "Yes" "Treatment" "No" [65,] "No" "NoTreatment" "No" [66,] "No" "NoTreatment" "No" [67,] "No" "Treatment" "Yes" [68,] "Yes" "NoTreatment" "No" [69,] "No" "NoTreatment" "No" [70,] "No" "NoTreatment" "No" [71,] "No" "NoTreatment" "No" [72,] "No" "NoTreatment" "No" [73,] "No" "NoTreatment" "No" [74,] "Yes" "NoTreatment" "No" [75,] "No" "NoTreatment" "No" [76,] "No" "Treatment" "No" [77,] "No" "NoTreatment" "No" [78,] "No" "NoTreatment" "No" [79,] "No" "Treatment" "Yes" [80,] "No" "Treatment" "No" [81,] "No" "NoTreatment" "No" [82,] "Yes" "NoTreatment" "No" [83,] "No" "NoTreatment" "No" [84,] "No" "NoTreatment" "Yes" [85,] "No" "NoTreatment" "No" [86,] "Yes" "NoTreatment" "No" [87,] "Yes" NA "No" [88,] "Yes" NA "No" [89,] "No" NA "No" [90,] "No" NA "No" [91,] "No" NA "No" [92,] "Yes" NA "No" [93,] "Yes" NA "No" [94,] "No" NA "No" [95,] "No" NA "No" [96,] "No" NA "No" [97,] "Yes" NA "No" [98,] "No" NA "No" [99,] "Yes" NA "No" [100,] "No" NA "No" [101,] "Yes" NA "No" [102,] "No" NA "No" [103,] "No" NA "No" [104,] "No" NA "No" [105,] "No" NA "No" [106,] "No" NA "No" [107,] "No" NA "No" [108,] "Yes" NA "No" [109,] "No" NA "No" [110,] "Yes" NA "No" [111,] "Yes" NA "No" [112,] "No" NA "No" [113,] "No" NA "No" [114,] "Yes" NA "No" [115,] "Yes" NA "No" [116,] "No" NA "No" [117,] "Yes" NA "No" [118,] "Yes" NA "No" [119,] "No" NA "No" [120,] "No" NA "No" [121,] "Yes" NA "No" [122,] "No" NA "No" [123,] "Yes" NA "No" [124,] "No" NA "No" [125,] "No" NA "No" [126,] "No" NA "No" [127,] "No" NA "No" [128,] "No" NA "No" [129,] "No" NA "No" [130,] "No" NA "No" [131,] "Yes" NA "No" [132,] "Yes" NA "No" [133,] "Yes" NA "No" [134,] "No" NA "No" [135,] "No" NA "No" [136,] "No" NA "No" [137,] "Yes" NA "No" [138,] "Yes" NA "No" [139,] "No" NA "No" [140,] "No" NA "No" [141,] "No" NA "Yes" [142,] "No" NA "No" [143,] "Yes" NA "No" [144,] "No" NA "No" [145,] "No" NA "No" [146,] "No" NA "No" [147,] "No" NA "No" [148,] "No" NA "No" [149,] "Yes" NA "No" [150,] "No" NA "No" [151,] "No" NA "No" [152,] "Yes" NA "Yes" [153,] "Yes" NA "Yes" [154,] "Yes" NA "No" > (table1 <- table(z[,cat1],z[,cat2])) NoTreatment Treatment No 50 12 Yes 13 11 > (V1<-dimnames(y)[[1]][cat1]) [1] "T40" > (V2<-dimnames(y)[[1]][cat2]) [1] "T20" > postscript(file="/var/wessaorg/rcomp/tmp/17fui1356095642.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/2bsg61356095642.tab") > (cst<-chisq.test(table1, simulate.p.value=simulate.p.value) ) Pearson's Chi-squared test with Yates' continuity correction data: table1 X-squared = 4.9141, df = 1, p-value = 0.02664 > 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/32k031356095642.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/41q7u1356095642.tab") > > try(system("convert tmp/17fui1356095642.ps tmp/17fui1356095642.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.785 0.184 1.995