dat <- hayman.tobacco
# Reproduce table 3 and figure 2 of Hayman 1954.
d1 <- subset(dat, block=='B1')
d2 <- subset(dat, block=='B2')
m1 <- acast(d1, male~female, value.var='flower')
m2 <- acast(d2, male~female, value.var='flower')
mn1 <- (m1+t(m1))/2
mn2 <- (m2+t(m2))/2
# Variance and covariance of 'rth' offspring
vr1 <- apply(mn1, 1, var)
vr2 <- apply(mn2, 1, var)
wr1 <- apply(mn1, 1, cov, diag(mn1))
wr2 <- apply(mn2, 1, cov, diag(mn2))
summ <- data.frame(rbind(mn1,mn2))
summ$block <- rep(c('B1','B2'), each=8)
summ$vr <- c(vr1,vr2)
summ$wr <- c(wr1,wr2)
summ$male <- rep(1:8,2) # Vr and Wr match Hayman table 3
with(summ, plot(wr~vr, type='n'))
with(summ, text(vr, wr, male)) # Match Hayman figure 2
abline(0,1,col="gray")
# Hayman notes that 1 and 3 do not lie along the line, so modifies them
# and re-analyzes.Run the code above in your browser using DataLab