if (FALSE) {
library(agridat)
data(clewer.wheat)
dat <- clewer.wheat
# Field layout
libs(desplot)
desplot(dat, yield ~ col*row,
out1 = block, text = gen, cex = 1,
main = "clewer.wheat")
# Verify variety means
aggregate(yield ~ gen, data = dat, FUN = mean)
## gen yield
## 1 V1 6.50
## 2 V2 7.60
## 3 V3 6.60
## 4 V4 8.30
# RCBD analysis
m1 <- aov(yield ~ block + gen, data = dat)
anova(m1)
## Response: yield
## Df Sum Sq Mean Sq F value Pr(>F)
## block 2 9.780 4.8900 12.225 0.007626 **
## gen 3 6.630 2.2100 5.525 0.036692 *
## Residuals 6 2.400 0.4000
# Matches book: Block SS=9.78, Variety SS=6.63, Error SS=2.40, MSE=0.40
# Compare ignoring blocks (CRD analysis)
m0 <- aov(yield ~ gen, data = dat)
anova(m0)
## Response: yield
## Df Sum Sq Mean Sq F value Pr(>F)
## gen 3 6.6300 2.2100 1.4517 0.297
## Residuals 8 12.1800 1.5225
# Matches book: Without blocking, VR=1.45, not significant
# Blocking reduced error variance from 1.52 to 0.40
}
Run the code above in your browser using DataLab