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(67 + ,0 + ,86 + ,88 + ,86 + ,94 + ,103 + ,90 + ,74 + ,73 + ,63 + ,68 + ,82 + ,80 + ,93 + ,86 + ,77 + ,86 + ,111 + ,91 + ,71 + ,79 + ,103 + ,96 + ,89 + ,92 + ,75 + ,72 + ,88 + ,96 + ,84 + ,70 + ,85 + ,86 + ,70 + ,87 + ,104 + ,88 + ,88 + ,79 + ,77 + ,90 + ,77 + ,95 + ,72 + ,85 + ,70 + ,0 + ,83 + ,90 + ,110 + ,115 + ,91 + ,84 + ,80 + ,79 + ,91 + ,94 + ,86 + ,97 + ,85 + ,86 + ,107 + ,111 + ,93 + ,87 + ,87 + ,98 + ,84 + ,87 + ,73 + ,68 + ,84 + ,88 + ,86 + ,82 + ,99 + ,111 + ,75 + ,75 + ,87 + ,94 + ,79 + ,95 + ,82 + ,80 + ,95 + ,95 + ,84 + ,68 + ,85 + ,94 + ,95 + ,88 + ,63 + ,84 + ,78 + ,0 + ,85 + ,101 + ,86 + ,98 + ,75 + ,78 + ,98 + ,109 + ,71 + ,102 + ,63 + ,81 + ,71 + ,97 + ,84 + ,75 + ,81 + ,97 + ,93 + ,0 + ,79 + ,101 + ,63 + ,101 + ,93 + ,95 + ,92 + ,95 + ,93 + ,0 + ,83 + ,95 + ,80 + ,90 + ,111 + ,107 + ,92 + ,92 + ,79 + ,86 + ,69 + ,70 + ,83 + ,95 + ,80 + ,96 + ,91 + ,91 + ,97 + ,87 + ,85 + ,92 + ,85 + ,97 + ,99 + ,102 + ,67 + ,91 + ,87 + ,68 + ,68 + ,88 + ,81 + ,97 + ,80 + ,90 + ,93 + ,101 + ,93 + ,94 + ,102 + ,101 + ,104 + ,109 + ,90 + ,100 + ,85 + ,103 + ,92 + ,94 + ,82 + ,97 + ,85 + ,85 + ,89 + ,75 + ,77 + ,77 + ,79 + ,87 + ,76 + ,78 + ,101 + ,108 + ,81 + ,97 + ,92 + ,105 + ,89 + ,106 + ,81 + ,107 + ,77 + ,95 + ,95 + ,107 + ,85 + ,115 + ,81 + ,101 + ,76 + ,85 + ,93 + ,90 + ,104 + ,115 + ,89 + ,95 + ,76 + ,97 + ,77 + ,112 + ,71 + ,97 + ,79 + ,77 + ,89 + ,90 + ,81 + ,94 + ,99 + ,103 + ,81 + ,77 + ,84 + ,98 + ,85 + ,90 + ,111 + ,111 + ,78 + ,77 + ,111 + ,88 + ,78 + ,75 + ,87 + ,92 + ,92 + ,78 + ,93 + ,106 + ,70 + ,80 + ,84 + ,87 + ,75 + ,92 + ,105 + ,0 + ,96 + ,111 + ,85 + ,86 + ,87 + ,85 + ,75 + ,90 + ,103 + ,101 + ,86 + ,94 + ,77 + ,86 + ,74 + ,86 + ,74 + ,90 + ,76 + ,75 + ,83 + ,86 + ,101 + ,91 + ,83 + ,97 + ,92 + ,91 + ,74 + ,70 + ,87 + ,98 + ,71 + ,96 + ,79 + ,95 + ,83 + ,100 + ,80 + ,95 + ,90 + ,97 + ,80 + ,97 + ,96 + ,92 + ,109 + ,115 + ,98 + ,88 + ,85 + ,87 + ,83 + ,100 + ,86 + ,98 + ,72 + ,102 + ,83 + ,0 + ,75 + ,96) + ,dim=c(2 + ,160) + ,dimnames=list(c('mviq' + ,'wiscvriq7') + ,1:160)) > y <- array(NA,dim=c(2,160),dimnames=list(c('mviq','wiscvriq7'),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 = 'childs iq' > xlab = 'mothers verbal iq' > main = 'mothers verbal iq and childs-year7' > #'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] "mviq" > (V2<-dimnames(y)[[1]][cat2]) [1] "wiscvriq7" > 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) Treatment100 Treatment101 Treatment102 Treatment103 84.1429 1.1905 2.4286 -3.4762 7.8571 Treatment105 Treatment106 Treatment107 Treatment108 Treatment109 7.8571 6.8571 11.5238 16.8571 16.8571 Treatment111 Treatment112 Treatment115 Treatment68 Treatment70 19.1071 -7.1429 17.8571 -7.3929 -8.4762 Treatment72 Treatment73 Treatment75 Treatment77 Treatment78 -9.1429 -10.1429 -3.7429 -5.3929 -3.1429 Treatment79 Treatment80 Treatment81 Treatment82 Treatment84 -4.4762 -6.1429 -21.1429 1.8571 -7.1429 Treatment85 Treatment86 Treatment87 Treatment88 Treatment90 -4.1429 -2.1429 0.4286 8.1429 -0.2429 Treatment91 Treatment92 Treatment94 Treatment95 Treatment96 8.2571 3.1905 3.4821 0.1299 -0.7429 Treatment97 Treatment98 -3.5595 1.8571 > (aov.xdf<-aov(lmxdf) ) Call: aov(formula = lmxdf) Terms: Treatment Residuals Sum of Squares 7052.139 11172.104 Deg. of Freedom 36 123 Residual standard error: 9.530484 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 36 7052.1 195.9 2.1567 0.001002 ** Residuals 123 11172.1 90.8 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 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,'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/html/rcomp/tmp/1j2fr1260832208.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/html/rcomp/tmp/2nuv31260832208.tab") > postscript(file="/var/www/html/rcomp/tmp/3urby1260832208.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/html/rcomp/tmp/4rk121260832208.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/html/rcomp/tmp/5tgxj1260832208.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/html/rcomp/tmp/6q1vp1260832208.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/html/rcomp/tmp/7sdv51260832208.tab") > > try(system("convert tmp/3urby1260832208.ps tmp/3urby1260832208.png",intern=TRUE)) character(0) > try(system("convert tmp/4rk121260832208.ps tmp/4rk121260832208.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 7.878 0.597 8.243