# NOT RUN {
data(steel.soybean)
dat <- steel.soybean
require(lattice)
dotplot(gen~yield|loc, dat, main="steele.soybean - yield by location")
if(require(lme4)){
# REML analysis as in O'Neill, p. 130.
m1 <- lmer(yield ~ loc + (1|gen) + (1|gen:loc) + (1|loc:block), data=dat)
# Are gen:loc effects significant? No.
m2 <- lmer(yield ~ loc + (1|gen) + (1|loc:block), data=dat)
anova(m1,m2)
# h^2 deviations
ranef(m2)$gen
}
# }
Run the code above in your browser using DataLab