# NOT RUN {
data(gomez.fractionalfactorial)
dat <- gomez.fractionalfactorial
# trt abcdef has the highest yield
# Gomez, Figure 4.8
desplot(yield~x*y, dat, main="gomez.fractionalfactorial - treatment & yield",
text=trt, shorten="none", show.key=FALSE, cex=1)
# Split treatment into individual factors
dat <- transform(dat,
a = -1 + 2 * grepl('a',trt),
b = -1 + 2 * grepl('b',trt),
c = -1 + 2 * grepl('c',trt),
d = -1 + 2 * grepl('d',trt),
e = -1 + 2 * grepl('e',trt),
f = -1 + 2 * grepl('f',trt))
# Gomez table 4.24, trt SS totalled together.
# Why didn't Gomez nest block within rep?
m0 <- lm(yield ~ rep * block + trt, dat)
anova(m0)
# Gomez table 4.24, trt SS split apart
m1 <- lm(yield ~ rep * block + (a+b+c+d+e+f)^3, dat)
anova(m1)
if(require(FrF2)){
aliases(m1)
MEPlot(m1, select=3:8,
main="gomez.fractionalfactorial - main effects plot")
#IAPlot(m1, select=3:8)
}
# }
Run the code above in your browser using DataLab