# NOT RUN {
data(besag.triticale)
dat <- besag.triticale
require(lattice)
# desplot(yield ~ col*row, data=dat, main="besag.triticale")
# Besag & Kempton are not perfectly clear on the model, but
# indicate that there was no evidence of any two-way interactions.
# A reduced, main-effect model had genotype effects that were
# "close to significant" at the five percent level.
# The model below has p-value of gen at .04, so must be slightly
# different than their model.
dat <- transform(dat, rate=factor(rate), nitro=factor(nitro))
dat <- transform(dat, xf=factor(col), yf=factor(row))
m2 <- lm(yield ~ gen + rate + nitro + regulator + yf, data=dat)
anova(m2)
# Similar, but not exact, to Besag figure 5
dat$res <- resid(m2)
xyplot(res ~ col|as.character(row), data=dat,
as.table=TRUE, type="s", layout=c(1,3),
main="besag.tritical")
# }
# NOT RUN {
# Besag uses an adjustment based on neighboring plots.
# This analysis fits the standard AR1xAR1 residual model
# Needs asreml package (not on CRAN)
require(asreml)
dat <- dat[order(dat$xf, dat$yf), ]
m3 <- asreml(yield ~ gen + rate + nitro + regulator +
gen:rate + gen:nitro + gen:regulator +
rate:nitro + rate:regulator +
nitro:regulator + yf, data=dat,
rcov = ~ ar1(xf):ar1(yf))
anova(m3) # Strongly significant gen, rate, regulator
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab