library(reshape2) library(gplots) library(multcomp) DF = read.csv('../../Data/ASCII_Comma/Chapter_12/linseed.txt', quote='\'', header=TRUE) DF$Plot = as.factor(DF$Plot) fit = aov(Yield ~ Plot * Variety, data=DF) print(summary(fit)) fit = aov(Yield ~ Plot + Variety, data=DF) print(summary(fit)) fit = aov(Yield ~ Variety, data=DF) print(summary(fit)) #postscript("../../WriteUp/Graphics/Chapter12/prob_30_plotmeans.eps", onefile=FALSE, horizontal=FALSE) plotmeans(Yield ~ Variety, data=DF) #dev.off() # A Tukey comparison of means test: # TukeyHSD(fit) par(las=2) par(mar=c(5, 8, 4, 2)) plot(TukeyHSD(fit)) # Use the multcomp package: # par(las=2) par(mar=c(5, 4, 6, 2)) tuk = glht(fit, linfct=mcp(Variety='Tukey')) plot(cld(tuk, level=0.05), col='lightgrey') # A nonparametric test for one-way ANOVA: # print(kruskal.test(Yield ~ Variety, data=DF))