if (FALSE) {
library(agridat)
data(wyatt.multi.uniformity)
dat <- wyatt.multi.uniformity
# range of yields. Wyatt has 48.6 bu/ac for oats, 10.4 for wheat
# diff(range(na.omit(subset(dat, crop=="oats")$yield)/100*88)) # 48.4
# diff(range(na.omit(subset(dat, crop=="wheat")$yield)/100*32.8)) # 10.5
# std dev. Wyatt has 9.18 bu/ac for oats, 2.06 for wheat, 2.06 for wheat
# sd(na.omit(subset(dat, crop=="oats")$yield)/100*88) # 9.11
# sd(na.omit(subset(dat, crop=="wheat")$yield)/100*32.8) # 2.14
# correlation across years. Wyatt has .08
# cor(reshape2::acast(dat, row+col ~ crop, value.var="yield"), use="pair")
# Fig 3
libs(lattice)
xyplot(yield ~ col|factor(row), dat, group=crop,
main="wyatt.multi.uniformity",
type='l', layout=c(1,3), auto.key=TRUE )
libs(desplot)
desplot(dat, yield ~ col*row, subset=crop=="oats",
tick=TRUE,
aspect=(440)/(1591), # true aspect
main="wyatt.multi.uniformity - 1925 oats")
desplot(dat, yield ~ col*row, subset=crop=="wheat",
aspect=(440)/(1591), # true aspect
main="wyatt.multi.uniformity - 1926 wheat")
}
Run the code above in your browser using DataLab