# Milliken and Johnson Example 13.1 empty <- read.table("empty.dat",header=T) empty$A <- factor(empty$A) empty$B <- factor(empty$B) # full model for unbalanced data empty.aov <- aov(y~A*B, empty) # Type I SS print(summary(empty.aov)) # Type III SS print(drop1(empty.aov,formula(empty.aov))) # no easy way to do Type IV SS #balanced subsets empty1 <- empty[empty$A != 1 & empty$B != 3,] print(empty1) empty1.aov <- aov(y~A+B, empty1) print(drop1(empty1.aov,formula(empty1.aov))) empty2 <- empty[empty$A != 3 & empty$B != 2,] print(empty2) empty2.aov <- aov(y~A*B, empty2) print(drop1(empty2.aov,formula(empty2.aov))) empty3 <- empty[empty$B == 1,] print(empty3) empty3.aov <- aov(y~B, empty3) print(summary(empty3.aov)) # least squares means library(pda) print(lsmean(empty.aov))