if (FALSE) {
library(agridat)
data(archbold.apple)
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.
libs(desplot)
desplot(dat, spacing~row*pos,
col=stock, cex=1, num=gen, # aspect unknown
main="archbold.apple")
libs(lme4, lucid)
m1 <- lmer(yield ~ -1 + trt + (1|rep/mp/sp), dat)
vc(m1) # Variances/means on Cornelius, page 59
## grp var1 var2 vcov sdcor
## sp:(mp:rep) (Intercept) 193.3 13.9
## mp:rep (Intercept) 203.8 14.28
## rep (Intercept) 197.3 14.05
## Residual 1015 31.86
}
Run the code above in your browser using DataLab