dat <- archbold.apple
# Define main plot and subplot
dat <- transform(dat, rep=factor(rep), spacing=factor(spacing), trt=factor(trt),
mp = factor(paste(row,spacing,sep="")),
sp = factor(paste(row,spacing,stock,sep="")))
# Due to 'spacing', the plots are different sizes, but the following layout
# shows the relative position of the plots and treatments. Note that the
# 'spacing' treatments are not contiguous in some reps.
desplot(spacing~row*pos, dat, col=stock, cex=1, num=gen)
library("lme4")
m1 <- lmer(yield ~ -1 + trt + (1|rep/mp/sp), dat)
summary(m1) # Variances and means on page 59
library("HH")
interaction2wt(yield~spacing+stock+gen, dat)Run the code above in your browser using DataLab