dat <- jenkyn.mildew
require(lattice)
bwplot(yield ~ trt, dat)
# Residuals from treatment model show obvious spatial trends
m0 <- lm(yield ~ trt, dat)
xyplot(resid(m0)~plot, dat)
# The blocks explain most of the variation
m1 <- lm(yield ~ trt + block, dat)
xyplot(resid(m1)~plot, dat)Run the code above in your browser using DataLab