dat <- williams.cotton
require("lattice")
asp = (12*12)/(24*1) # true aspect
desplot(yield ~ col*row, dat, aspect=asp)
# Smoothed contour/persp plot like Williams 1988 Fig 1a, 2a
dat$fit <- fitted(loess(yield~col*row, dat, span=.5))
contourplot(fit~col*row, data=dat, cuts=6)
wireframe(fit~col*row, data=dat, zlim=c(100, 250))
# Williams table 1
anova(aov(yield ~ factor(row) + factor(col), dat))Run the code above in your browser using DataLab