dat <- kempton.competition
# Raw means in Kempton table 2
round(tapply(dat$yield, dat$gen, mean),2)
# Fixed genotype effects, random rep effects,
# Autocorrelation of neighboring plots within the same rep
require("nlme")
m1 <- lme(yield ~ -1+gen, random=~1|rep, data=dat,
corr=corAR1(form=~col|rep))
# Lag 1 autocorrelation is negative--evidence of competition
plot(ACF(m1), alpha=.05, grid=TRUE)
# Genotype effects
round(fixef(m1),2)
# Variance of yield increases with yield
plot(m1)
bwplot(yield~gen, data=dat)Run the code above in your browser using DataLab