R version 2.10.0 (2009-10-26) 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(36 + ,36 + ,36 + ,36 + ,56 + ,56 + ,48 + ,48 + ,32 + ,32 + ,44 + ,44 + ,39 + ,39 + ,34 + ,34 + ,41 + ,41 + ,50 + ,50 + ,39 + ,39 + ,62 + ,62 + ,52 + ,52 + ,37 + ,37 + ,50 + ,50 + ,41 + ,41 + ,55 + ,55 + ,41 + ,41 + ,56 + ,56 + ,39 + ,39 + ,52 + ,52 + ,46 + ,46 + ,44 + ,44 + ,48 + ,48 + ,41 + ,41 + ,50 + ,50 + ,50 + ,50 + ,44 + ,44 + ,52 + ,52 + ,54 + ,54 + ,44 + ,44 + ,52 + ,52 + ,37 + ,37 + ,52 + ,52 + ,50 + ,50 + ,36 + ,36 + ,50 + ,50 + ,52 + ,52 + ,55 + ,55 + ,31 + ,31 + ,36 + ,36 + ,49 + ,49 + ,42 + ,42 + ,37 + ,37 + ,41 + ,41 + ,30 + ,30 + ,52 + ,52 + ,30 + ,30 + ,41 + ,41 + ,44 + ,44 + ,66 + ,66 + ,48 + ,48 + ,43 + ,43 + ,57 + ,57 + ,46 + ,46 + ,54 + ,54 + ,48 + ,48 + ,48 + ,48 + ,52 + ,52 + ,62 + ,62 + ,58 + ,58 + ,58 + ,58 + ,62 + ,62 + ,48 + ,48 + ,46 + ,46 + ,34 + ,34 + ,66 + ,66 + ,52 + ,52 + ,55 + ,55 + ,55 + ,55 + ,57 + ,57 + ,56 + ,56 + ,55 + ,55 + ,56 + ,56 + ,54 + ,54 + ,55 + ,55 + ,46 + ,46 + ,52 + ,52 + ,32 + ,32 + ,44 + ,44 + ,46 + ,46 + ,59 + ,59 + ,46 + ,46 + ,46 + ,46 + ,54 + ,54 + ,66 + ,66 + ,56 + ,56 + ,59 + ,59 + ,57 + ,57 + ,52 + ,52 + ,48 + ,48 + ,44 + ,44 + ,41 + ,41 + ,50 + ,50 + ,48 + ,48 + ,48 + ,48 + ,59 + ,59 + ,34 + ,34 + ,46 + ,46 + ,54 + ,54 + ,55 + ,55 + ,54 + ,54 + ,59 + ,59 + ,44 + ,44 + ,54 + ,54 + ,52 + ,52 + ,66 + ,66 + ,44 + ,44 + ,57 + ,57 + ,39 + ,39 + ,60 + ,60 + ,45 + ,45 + ,41 + ,41 + ,50 + ,50 + ,39 + ,39 + ,43 + ,43 + ,48 + ,48 + ,37 + ,37 + ,58 + ,58 + ,46 + ,46 + ,43 + ,43 + ,44 + ,44 + ,34 + ,34 + ,30 + ,30 + ,50 + ,50 + ,39 + ,39 + ,37 + ,37 + ,55 + ,55 + ,48 + ,48 + ,41 + ,41 + ,39 + ,39 + ,36 + ,36 + ,43 + ,43 + ,50 + ,50 + ,55 + ,55 + ,43 + ,43 + ,60 + ,60 + ,48 + ,48 + ,30 + ,30 + ,43 + ,43 + ,39 + ,39 + ,52 + ,52 + ,39 + ,39 + ,39 + ,39 + ,56 + ,56 + ,59 + ,59 + ,46 + ,46 + ,57 + ,57 + ,50 + ,50 + ,54 + ,54 + ,50 + ,50 + ,60 + ,60 + ,59 + ,59 + ,41 + ,41 + ,48 + ,48 + ,59 + ,59 + ,60 + ,60 + ,56 + ,56 + ,56 + ,56 + ,51 + ,51) + ,dim=c(2 + ,160) + ,dimnames=list(c('30monthIQ' + ,'MUMIQ') + ,1:160)) > y <- array(NA,dim=c(2,160),dimnames=list(c('30monthIQ','MUMIQ'),1:160)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'TRUE' > par2 = '2' > par1 = '1' > ylab = 'child 30 month IQ' > xlab = 'Mum verbal IQ' > main = 'mothers verbal iq and 30 month IQ' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Dr. Ian E. Holliday > #To cite this work: Ian E. Holliday, 2009, STARS Bullying Study (v1.0.1) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/Ian.Holliday/rwasp_STARS_Bullying_Study_alt.wasp/ > #Source of accompanying publication: > #Technical description: > 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] "30monthIQ" > (V2<-dimnames(y)[[1]][cat2]) [1] "MUMIQ" > 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) Treatment31 Treatment32 Treatment34 Treatment36 Treatment37 30 1 2 4 6 7 Treatment39 Treatment41 Treatment42 Treatment43 Treatment44 Treatment45 9 11 12 13 14 15 Treatment46 Treatment48 Treatment49 Treatment50 Treatment51 Treatment52 16 18 19 20 21 22 Treatment54 Treatment55 Treatment56 Treatment57 Treatment58 Treatment59 24 25 26 27 28 29 Treatment60 Treatment62 Treatment66 30 32 36 > (aov.xdf<-aov(lmxdf) ) Call: aov(formula = lmxdf) Terms: Treatment Residuals Sum of Squares 11417.98 0.00 Deg. of Freedom 26 133 Residual standard error: 4.168612e-15 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 26 11418 439.15 2.5272e+31 < 2.2e-16 *** Residuals 133 0 0.00 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Warning message: In anova.lm(lmxdf) : ANOVA F-tests on an essentially perfect fit are unreliable > > #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,'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/www/rcomp/tmp/1e8w01259848176.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/www/rcomp/tmp/2xu8b1259848176.tab") > postscript(file="/var/www/rcomp/tmp/38knh1259848176.ps",horizontal=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){ + thsd<-TukeyHSD(aov.xdf) + postscript(file="/var/www/rcomp/tmp/4h7e81259848176.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) + plot(thsd) + dev.off() + 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/www/rcomp/tmp/54n8m1259848176.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/www/rcomp/tmp/6ns5f1259848176.tab") + } > library(car) > lt.lmxdf<-levene.test(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/www/rcomp/tmp/7bxe81259848176.tab") > > system("convert tmp/38knh1259848176.ps tmp/38knh1259848176.png") > system("convert tmp/4h7e81259848176.ps tmp/4h7e81259848176.png") > > > proc.time() user system elapsed 2.790 0.810 3.403