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,
main="archbold.apple")
library(lme4)
m1 <- lmer(yield ~ -1 + trt + (1|rep/mp/sp), dat)
print(VarCorr(m1), comp=c("Variance","Std.Dev.")) # Variances/means on page 59
## Random effects:
## Groups Name Variance Std.Dev.
## sp:(mp:rep) (Intercept) 193.31 13.903
## mp:rep (Intercept) 203.78 14.275
## rep (Intercept) 197.32 14.047
## Residual 1015.28 31.863
## library(HH)
## interaction2wt(yield~spacing+stock+gen, dat)Run the code above in your browser using DataLab