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(36,1,36,2,56,2,48,3,32,1,44,1,39,2,34,2,41,1,50,3,39,1,62,3,52,2,37,1,50,2,41,2,55,2,41,1,56,3,39,2,52,1,46,1,44,1,48,1,41,2,50,3,50,2,44,2,52,2,54,2,44,2,52,3,37,2,52,2,50,2,36,1,50,2,52,2,55,3,31,1,36,2,49,1,42,2,37,2,41,2,30,2,52,2,30,1,41,1,44,2,66,2,48,1,43,3,57,1,46,1,54,1,48,2,48,2,52,2,62,1,58,1,58,2,62,2,48,2,46,2,34,2,66,3,52,2,55,1,55,1,57,2,56,2,55,2,56,3,54,2,55,2,46,3,52,1,32,2,44,1,46,2,59,2,46,2,46,2,54,3,66,3,56,2,59,2,57,2,52,2,48,2,44,2,41,1,50,1,48,1,48,3,59,2,34,2,46,2,54,2,55,1,54,2,59,2,44,2,54,1,52,2,66,3,44,2,57,1,39,1,60,1,45,1,41,2,50,2,39,3,43,2,48,2,37,2,58,3,46,1,43,3,44,1,34,2,30,2,50,2,39,1,37,2,55,1,48,3,41,3,39,2,36,2,43,1,50,3,55,2,43,1,60,1,48,1,30,1,43,2,39,3,52,2,39,2,39,1,56,3,59,1,46,1,57,2,50,2,54,2,50,2,60,3,59,3,41,3,48,2,59,2,60,2,56,1,56,2,51,1),dim=c(2,160),dimnames=list(c('WISCRY7V','MOMAGE'),1:160)) > y <- array(NA,dim=c(2,160),dimnames=list(c('WISCRY7V','MOMAGE'),1:160)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par20 = '' > par19 = '' > par18 = '' > par17 = '' > par16 = '' > par15 = '' > par14 = '' > par13 = '' > par12 = '' > par11 = '' > par10 = '' > par9 = '' > par8 = '' > par7 = '' > par6 = '' > par5 = '' > par4 = '' > par3 = 'TRUE' > par2 = '2' > par1 = '1' > ylab = 'Y Variable Name' > xlab = 'X Variable Name' > main = 'Title Goes Here' > cat1 <- as.numeric(par1) # > cat2<- as.numeric(par2) # > intercept<-as.logical(par3) > x <- t(x) > x1<-as.numeric(x[,cat1]) > f1<-as.character(x[,cat2]) > xdf<-data.frame(x1,f1) > (V1<-dimnames(y)[[1]][cat1]) [1] "WISCRY7V" > (V2<-dimnames(y)[[1]][cat2]) [1] "MOMAGE" > names(xdf)<-c('Response', 'Treatment') > if(intercept == FALSE) (lmxdf<-lm(Response ~ Treatment - 1, data = xdf) ) else (lmxdf<-lm(Response ~ Treatment, data = xdf) ) Call: lm(formula = Response ~ Treatment, data = xdf) Coefficients: (Intercept) Treatment2 Treatment3 46.653 1.112 5.347 > (aov.xdf<-aov(lmxdf) ) Call: aov(formula = lmxdf) Terms: Treatment Residuals Sum of Squares 507.579 10910.396 Deg. of Freedom 2 157 Residual standard error: 8.336244 Estimated effects may be unbalanced > (anova.xdf<-anova(lmxdf) ) Analysis of Variance Table Response: Response Df Sum Sq Mean Sq F value Pr(>F) Treatment 2 507.6 253.789 3.652 0.02817 * Residuals 157 10910.4 69.493 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 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,'ANOVA Model', length(lmxdf$coefficients)+1,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, paste(V1, ' ~ ', V2), length(lmxdf$coefficients)+1,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'means',,TRUE) > for(i in 1:length(lmxdf$coefficients)){ + a<-table.element(a, round(lmxdf$coefficients[i], digits=3),,FALSE) + } > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/12wki1352123395.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'ANOVA Statistics', 5+1,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, ' ',,TRUE) > a<-table.element(a, 'Df',,FALSE) > a<-table.element(a, 'Sum Sq',,FALSE) > a<-table.element(a, 'Mean Sq',,FALSE) > a<-table.element(a, 'F value',,FALSE) > a<-table.element(a, 'Pr(>F)',,FALSE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, V2,,TRUE) > a<-table.element(a, anova.xdf$Df[1],,FALSE) > a<-table.element(a, round(anova.xdf$'Sum Sq'[1], digits=3),,FALSE) > a<-table.element(a, round(anova.xdf$'Mean Sq'[1], digits=3),,FALSE) > a<-table.element(a, round(anova.xdf$'F value'[1], digits=3),,FALSE) > a<-table.element(a, round(anova.xdf$'Pr(>F)'[1], digits=3),,FALSE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Residuals',,TRUE) > a<-table.element(a, anova.xdf$Df[2],,FALSE) > a<-table.element(a, round(anova.xdf$'Sum Sq'[2], digits=3),,FALSE) > a<-table.element(a, round(anova.xdf$'Mean Sq'[2], digits=3),,FALSE) > a<-table.element(a, ' ',,FALSE) > a<-table.element(a, ' ',,FALSE) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/27hz71352123395.tab") > postscript(file="/var/wessaorg/rcomp/tmp/3jn7h1352123395.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > boxplot(Response ~ Treatment, data=xdf, xlab=V2, ylab=V1) > dev.off() null device 1 > if(intercept==TRUE){ + 'Tukey Plot' + thsd<-TukeyHSD(aov.xdf) + postscript(file="/var/wessaorg/rcomp/tmp/4spzs1352123395.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) + plot(thsd) + dev.off() + } null device 1 > if(intercept==TRUE){ + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Tukey Honest Significant Difference Comparisons', 5,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a, ' ', 1, TRUE) + for(i in 1:4){ + a<-table.element(a,colnames(thsd[[1]])[i], 1, TRUE) + } + a<-table.row.end(a) + for(i in 1:length(rownames(thsd[[1]]))){ + a<-table.row.start(a) + a<-table.element(a,rownames(thsd[[1]])[i], 1, TRUE) + for(j in 1:4){ + a<-table.element(a,round(thsd[[1]][i,j], digits=3), 1, FALSE) + } + a<-table.row.end(a) + } + a<-table.end(a) + table.save(a,file="/var/wessaorg/rcomp/tmp/53p631352123395.tab") + } > if(intercept==FALSE){ + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'TukeyHSD Message', 1,TRUE) + a<-table.row.end(a) + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Must Include Intercept to use Tukey Test ', 1, FALSE) + a<-table.row.end(a) + a<-table.end(a) + table.save(a,file="/var/wessaorg/rcomp/tmp/6fgij1352123395.tab") + } > library(car) Loading required package: MASS Loading required package: nnet > lt.lmxdf<-leveneTest(lmxdf) > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Levenes Test for Homogeneity of Variance', 4,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,' ', 1, TRUE) > for (i in 1:3){ + a<-table.element(a,names(lt.lmxdf)[i], 1, FALSE) + } > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Group', 1, TRUE) > for (i in 1:3){ + a<-table.element(a,round(lt.lmxdf[[i]][1], digits=3), 1, FALSE) + } > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,' ', 1, TRUE) > a<-table.element(a,lt.lmxdf[[1]][2], 1, FALSE) > a<-table.element(a,' ', 1, FALSE) > a<-table.element(a,' ', 1, FALSE) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/7y4671352123396.tab") > > try(system("convert tmp/3jn7h1352123395.ps tmp/3jn7h1352123395.png",intern=TRUE)) character(0) > try(system("convert tmp/4spzs1352123395.ps tmp/4spzs1352123395.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.588 0.299 1.859