dat <- wiebe.wheat.uniformity
require("lattice")
# 125 rows = 125 feet tall. 12 cols * 15 feet = 180 feet wide.
desplot(yield~col+row, dat, aspect=125/180, flip=TRUE,
main="Plot yields of wheat uniformity trial") # row 1 is at south
# Preece (1981) found the last digits have an interesting distribution.
dig <- substring(dat$yield, nchar(dat$yield))
dig <- as.numeric(dig)
hist(dig, breaks=0:10-.5, main="Histogram of last digit")
table(dat$col, dig) # Table 3 of Preece
# Median yields of rows/cols show obvious trends
plot(tapply(dat$yield, dat$row, median), xlab="Row", ylab="Yield")
plot(tapply(dat$yield, dat$col, median), xlab="Column", ylab="Yield")
# Spatial trends are obvious
xyplot(yield~col, dat, type=c('p','smooth'))
# Loess
m3 <- loess(yield~row+col, dat)
plot(fitted(m3), resid(m3), ylim=c(-300,300))Run the code above in your browser using DataLab