dat <- cochran.wireworms
# desplot(worms ~ col*row, data=dat, text=trt, cex=1)
# Trt K is effective, but not the others. Really, this says it all.
bwplot(worms ~ trt, dat)
# Snedecor and Cochran do ANOVA on sqrt(x+1).
dat <- transform(dat, rowf=factor(row), colf=factor(col))
m1 <- aov(sqrt(worms+1) ~ rowf + colf + trt, data=dat)
anova(m1)
# Instead of transforming, use glm
m2 <- glm(worms ~ trt + rowf + colf, data=dat, family="poisson")
anova(m2)
# GLM with random blocking.
require(lme4)
m3 <- glmer(worms ~ -1 + trt + (1|rowf) + (1|colf),
data=dat, family="poisson")
summary(m3)Run the code above in your browser using DataLab