dat <- gomez.multilocsplitplot
# Gomez figure 8.3
xyplot(yield~nitro, dat, group=loc, type=c('p','smooth'), auto.key=TRUE)
# AOV
# Be careful to use the right stratum, 'nf' appears in both strata.
# Still not quite the same as Gomez table 8.21
dat$nf <- factor(dat$nitro)
t1 <- terms(yield ~ loc * nf * gen + Error(loc:rep:nf),
"Error", keep.order=TRUE)
m1 <- aov(t1, data=dat)
summary(m1)
# F values are somewhat similar to Gomez Table 8.21
require(lme4)
m2 <- lmer(yield ~ loc*nf*gen + (1|loc/rep/nf), dat)
anova(m2)Run the code above in your browser using DataLab