R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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(0.6666666667 + ,1 + ,3 + ,4 + ,4 + ,0 + ,0 + ,0 + ,-1 + ,0.5 + ,0 + ,2 + ,2 + ,0 + ,0 + ,0 + ,0 + ,-1 + ,0 + ,0 + ,2 + ,2 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0.4 + ,0 + ,1 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0.5555555556 + ,1 + ,1 + ,1 + ,0 + ,0 + ,0 + ,0 + ,1 + ,0.1666666667 + ,0 + ,2 + ,2 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0.1666666667 + ,0 + ,3 + ,4 + ,4 + ,0 + ,0 + ,0 + ,-1 + ,0.4444444444 + ,0 + ,2 + ,2 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1 + ,1 + ,2 + ,2 + ,0 + ,0 + ,0 + ,0 + ,-1 + ,1 + ,1 + ,3 + ,4 + ,4 + ,0 + ,0 + ,0 + ,-1 + ,0.375 + ,0 + ,1 + ,1 + ,0 + ,0 + ,0 + ,0 + ,-1 + ,0.5 + ,0 + ,1 + ,1 + ,0 + ,2 + ,1 + ,0 + ,1 + ,0.8 + ,1 + ,3 + ,4 + ,4 + ,0 + ,0 + ,0 + ,0 + ,0.3846153846 + ,0 + ,1 + ,1 + ,0 + ,1 + ,1 + ,0 + ,1 + ,0 + ,0 + ,3 + ,4 + ,4 + ,1 + ,1 + ,0 + ,1 + ,1 + ,1 + ,3 + ,4 + ,4 + ,3 + ,1 + ,1 + ,1 + ,0.625 +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,0 + ,1 + ,1 + ,1 + ,-1 + ,0.5454545455 + ,1 + ,2 + ,2 + ,0 + ,0 + ,0 + ,0 + ,-1) + ,dim=c(9 + ,82) + ,dimnames=list(c('LoM' + ,'Lim' + ,'T' + ,'Tnfm' + ,'T40' + ,'NumStat' + ,'Stat' + ,'Analysis' + ,'Useful') + ,1:82)) > y <- array(NA,dim=c(9,82),dimnames=list(c('LoM','Lim','T','Tnfm','T40','NumStat','Stat','Analysis','Useful'),1:82)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'Exact Pearson Chi-Squared by Simulation' > par2 = '8' > par1 = '4' > main = 'Association Plot' > #'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] [,9] [1,] 0.66666667 1 3 4 4 0 0 0 -1 [2,] 0.50000000 0 2 2 0 0 0 0 -1 [3,] 0.00000000 0 2 2 0 0 0 0 0 [4,] 0.40000000 0 1 1 0 0 0 0 0 [5,] 0.55555556 1 1 1 0 0 0 0 1 [6,] 0.16666667 0 2 2 0 0 0 0 0 [7,] 0.16666667 0 3 4 4 0 0 0 -1 [8,] 0.44444444 0 2 2 0 0 0 0 0 [9,] 1.00000000 1 2 2 0 0 0 0 -1 [10,] 1.00000000 1 3 4 4 0 0 0 -1 [11,] 0.37500000 0 1 1 0 0 0 0 -1 [12,] 0.50000000 0 1 1 0 2 1 0 1 [13,] 0.80000000 1 3 4 4 0 0 0 0 [14,] 0.38461538 0 1 1 0 1 1 0 1 [15,] 0.00000000 0 3 4 4 1 1 0 1 [16,] 1.00000000 1 3 4 4 3 1 1 1 [17,] 0.62500000 1 3 4 4 0 0 0 -1 [18,] 0.14285714 0 1 1 0 0 0 0 -1 [19,] 0.50000000 0 3 4 4 1 1 1 1 [20,] 1.00000000 1 1 1 0 0 0 0 1 [21,] 0.62500000 1 1 1 0 1 1 0 1 [22,] 0.00000000 0 1 1 0 0 0 0 1 [23,] 1.00000000 1 1 1 0 0 0 0 1 [24,] 0.40000000 0 3 4 4 3 1 0 0 [25,] 0.00000000 0 2 2 0 1 1 0 1 [26,] 0.81818182 1 1 1 0 0 0 0 -1 [27,] 0.20000000 0 2 2 0 2 1 0 0 [28,] 0.50000000 0 1 1 0 0 0 0 -1 [29,] 0.00000000 0 1 1 0 0 0 0 1 [30,] 0.00000000 0 2 2 0 0 0 0 0 [31,] 0.57142857 1 2 2 0 0 0 0 -1 [32,] 0.71428571 1 2 2 0 0 0 0 1 [33,] 0.00000000 0 3 4 4 0 0 0 -1 [34,] 0.50000000 0 3 2 0 0 0 0 0 [35,] 0.45454545 0 2 2 0 0 0 0 0 [36,] 0.72727273 1 3 4 4 4 1 0 1 [37,] 0.00000000 0 1 1 0 4 1 0 0 [38,] 0.00000000 0 2 2 0 0 0 0 1 [39,] 0.00000000 0 3 4 4 0 0 0 1 [40,] 0.37500000 0 2 2 0 1 1 1 1 [41,] 0.00000000 0 1 1 0 2 1 0 0 [42,] 0.66666667 1 3 4 4 0 0 0 0 [43,] 0.38461538 0 1 1 0 0 0 0 1 [44,] 0.35714286 0 1 1 0 0 0 0 1 [45,] 0.27272727 0 2 2 0 0 0 0 -1 [46,] 0.44444444 0 1 1 0 0 0 0 0 [47,] 0.28571429 0 1 1 0 0 0 0 1 [48,] 0.00000000 0 2 2 0 0 0 0 -1 [49,] 0.07692308 0 3 4 4 1 1 0 0 [50,] 0.94736842 1 3 4 4 2 1 1 1 [51,] 0.42105263 0 3 2 0 0 0 0 -1 [52,] 0.09090909 0 1 1 0 1 1 1 0 [53,] 0.00000000 0 3 2 0 0 0 0 0 [54,] 0.22727273 0 3 4 4 2 1 0 -1 [55,] 0.50000000 0 2 2 0 3 1 0 1 [56,] 0.41666667 0 1 1 0 0 0 0 -1 [57,] 1.00000000 1 3 4 4 3 1 1 1 [58,] 0.90000000 1 3 4 4 0 0 0 -1 [59,] 0.00000000 0 1 1 0 3 1 0 1 [60,] 0.33333333 0 1 1 0 0 0 0 -1 [61,] 1.00000000 1 3 4 4 0 0 0 -1 [62,] 0.00000000 0 1 1 0 0 0 0 -1 [63,] 0.23076923 0 1 1 0 0 0 0 -1 [64,] 0.50000000 0 3 4 4 4 1 1 1 [65,] 0.60000000 1 1 1 0 0 0 0 0 [66,] 0.00000000 0 2 2 0 0 0 0 0 [67,] 0.00000000 0 2 2 0 1 1 0 0 [68,] 0.47058824 0 1 1 0 0 0 0 0 [69,] 0.00000000 0 2 2 0 0 0 0 0 [70,] 0.00000000 0 2 2 0 3 1 0 -1 [71,] 0.57142857 1 3 2 0 2 1 0 -1 [72,] 0.00000000 0 1 1 0 0 0 0 -1 [73,] 0.36363636 0 3 4 4 0 0 0 1 [74,] 0.31578947 0 2 2 0 0 0 0 0 [75,] 0.00000000 0 2 2 0 1 1 0 1 [76,] 0.10000000 0 3 4 4 1 1 1 0 [77,] 0.46153846 0 3 4 4 0 0 0 1 [78,] 0.50000000 0 1 1 0 0 0 0 -1 [79,] 0.64000000 1 2 2 0 2 1 0 -1 [80,] 0.37500000 0 1 1 0 0 0 0 -1 [81,] 0.00000000 0 1 1 0 1 1 1 -1 [82,] 0.54545455 1 2 2 0 0 0 0 -1 > (table1 <- table(z[,cat1],z[,cat2])) 0 1 1 29 2 2 27 1 4 17 6 > (V1<-dimnames(y)[[1]][cat1]) [1] "Tnfm" > (V2<-dimnames(y)[[1]][cat2]) [1] "Analysis" > postscript(file="/var/www/rcomp/tmp/1vc571292236219.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/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/www/rcomp/tmp/2zc4u1292236219.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 = 7.5956, df = NA, p-value = 0.02249 > 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/www/rcomp/tmp/3d4jl1292236219.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/www/rcomp/tmp/4g4091292236219.tab") > > try(system("convert tmp/1vc571292236219.ps tmp/1vc571292236219.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.870 0.270 1.122