R version 2.9.0 (2009-04-17) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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(3 + ,4 + ,3 + ,3 + ,4 + ,4 + ,4 + ,3 + ,4 + ,5 + ,5 + ,5 + ,4 + ,2 + ,4 + ,2 + ,4 + ,5 + ,3 + ,4 + ,3 + ,3 + ,3 + ,4 + ,5 + ,3 + ,4 + ,4 + ,4 + ,5 + ,4 + ,4 + ,3 + ,3 + ,3 + ,5 + ,4 + ,4 + ,4 + ,4 + ,4 + ,4 + ,4 + ,4 + ,4 + ,4 + ,4 + ,4 + ,4 + ,3 + ,4 + ,4 + ,4 + ,5 + ,4 + ,5 + ,4 + ,4 + ,4 + ,3 + ,4 + ,4 + ,4 + ,2 + ,5 + ,4 + ,5 + ,4 + ,4 + ,4 + ,5 + ,3 + ,4 + ,4 + ,4 + ,4 + ,4 + ,4 + ,4 + ,3 + ,4 + ,4 + ,4 + ,4 + ,5 + ,4 + ,5 + ,4 + ,4 + ,4 + ,4 + ,4 + ,4 + ,4 + ,4 + ,5 + ,4 + ,3 + ,4 + ,3 + ,4 + ,5 + ,4 + ,4 + ,4 + ,4 + ,4 + ,4 + ,4 + ,4 + ,3 + ,3 + ,4 + ,4 + ,3 + ,4 + ,3 + ,2 + ,3 + ,2 + ,4 + ,3 + ,4 + ,3 + ,4 + ,4 + ,4 + ,4 + ,3 + ,4 + ,3 + ,4 + ,3 + ,2 + ,2 + ,3 + ,3 + ,4 + ,3 + ,4 + ,4 + ,4 + ,4 + ,3 + ,4 + ,3 + ,4 + ,3 + ,4 + ,4 + ,4 + ,4 + ,4 + ,4 + ,4 + ,4 + ,5 + ,5 + ,5 +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 + ,4 + ,3 + ,2 + ,4 + ,4 + ,5 + ,4 + ,3 + ,4 + ,3 + ,4 + ,4 + ,4 + ,4 + ,4 + ,4 + ,3 + ,3 + ,4 + ,3 + ,2 + ,2 + ,2 + ,4 + ,4 + ,4 + ,4 + ,4 + ,2 + ,4 + ,3 + ,4 + ,2 + ,4 + ,2 + ,4 + ,3 + ,3 + ,3 + ,3 + ,3 + ,3 + ,3 + ,4 + ,5 + ,5 + ,5 + ,3 + ,2 + ,2 + ,2 + ,4 + ,3 + ,3 + ,2 + ,4 + ,4 + ,4 + ,3 + ,3 + ,2 + ,3 + ,4 + ,4 + ,3 + ,4 + ,3) + ,dim=c(4 + ,159) + ,dimnames=list(c('learning' + ,'handling' + ,'goals' + ,'do') + ,1:159)) > y <- array(NA,dim=c(4,159),dimnames=list(c('learning','handling','goals','do'),1:159)) > 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 = '4' > par1 = '1' > 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] [1,] 3 4 3 3 [2,] 4 4 4 3 [3,] 4 5 5 5 [4,] 4 2 4 2 [5,] 4 5 3 4 [6,] 3 3 3 4 [7,] 5 3 4 4 [8,] 4 5 4 4 [9,] 3 3 3 5 [10,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[89,] 4 5 5 5 [90,] 4 4 4 4 [91,] 4 4 4 4 [92,] 4 4 3 4 [93,] 4 4 4 2 [94,] 4 4 4 4 [95,] 4 3 4 2 [96,] 4 4 4 4 [97,] 4 4 4 4 [98,] 4 5 4 4 [99,] 5 4 3 3 [100,] 5 5 5 5 [101,] 4 4 3 3 [102,] 4 4 4 3 [103,] 3 4 3 4 [104,] 4 4 4 4 [105,] 4 4 4 4 [106,] 4 3 3 4 [107,] 2 4 3 1 [108,] 4 4 4 4 [109,] 4 5 4 4 [110,] 4 4 5 3 [111,] 3 3 3 4 [112,] 4 4 2 4 [113,] 4 4 5 4 [114,] 3 5 3 3 [115,] 4 2 4 4 [116,] 4 4 3 3 [117,] 4 4 4 4 [118,] 4 4 3 3 [119,] 4 4 4 4 [120,] 4 4 3 4 [121,] 4 5 4 4 [122,] 4 4 3 4 [123,] 4 5 4 5 [124,] 4 3 4 4 [125,] 4 4 4 3 [126,] 4 3 3 2 [127,] 3 4 3 3 [128,] 4 4 4 3 [129,] 3 4 3 3 [130,] 4 2 4 2 [131,] 3 4 3 3 [132,] 3 4 4 4 [133,] 3 4 4 4 [134,] 4 3 3 2 [135,] 4 4 4 3 [136,] 4 4 3 3 [137,] 4 3 3 3 [138,] 3 3 3 4 [139,] 4 2 4 2 [140,] 4 4 5 3 [141,] 5 5 5 5 [142,] 4 4 4 4 [143,] 3 4 3 2 [144,] 4 4 5 4 [145,] 3 4 3 4 [146,] 4 4 4 4 [147,] 4 3 3 4 [148,] 3 2 2 2 [149,] 4 4 4 4 [150,] 4 2 4 3 [151,] 4 2 4 2 [152,] 4 3 3 3 [153,] 3 3 3 3 [154,] 4 5 5 5 [155,] 3 2 2 2 [156,] 4 3 3 2 [157,] 4 4 4 3 [158,] 3 2 3 4 [159,] 4 3 4 3 > (table1 <- table(z[,cat1],z[,cat2])) 1 2 3 4 5 2 1 1 0 0 0 3 0 4 10 16 1 4 0 13 29 64 7 5 0 0 2 7 4 > (V1<-dimnames(y)[[1]][cat1]) [1] "learning" > (V2<-dimnames(y)[[1]][cat2]) [1] "do" > postscript(file="/var/www/html/rcomp/tmp/1jhhd1290597616.ps",horizontal=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/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/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/html/rcomp/tmp/240yj1290597616.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 = 95.9597, df = NA, p-value = 0.001499 > if (par3 == 'McNemar Chi-Squared') { + (cst <- mcnemar.test(table1)) + } > if (par3 != 'McNemar Chi-Squared') { + 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/html/rcomp/tmp/380e71290597616.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) > a<-table.element(a, 'Chi Square Statistic', 1, TRUE) > a<-table.element(a, round(cst$statistic, digits=2), 1,FALSE) > a<-table.row.end(a) > if(!simulate.p.value){ + 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/html/rcomp/tmp/4gm2j1290597616.tab") > > try(system("convert tmp/1jhhd1290597616.ps tmp/1jhhd1290597616.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.983 0.203 2.370