if (FALSE) {
library(agridat)
data(federer.tobacco)
dat <- federer.tobacco
# RCB analysis. Treatment factor not signficant.
dat <- transform(dat, dosef=factor(dose), rowf=factor(row),
blockf=factor(block))
m1 <- lm(height ~ blockf + dosef, data=dat)
anova(m1)
# RCB residuals show strong spatial trends
libs(desplot)
dat$resid <- resid(m1)
desplot(dat, resid ~ row * block,
# aspect unknown
main="federer.tobacco")
# Row-column analysis. Treatment now significant
m2 <- lm(height ~ rowf + blockf + dosef, data=dat)
anova(m2)
}
Run the code above in your browser using DataLab