[R] Fractional Factorial - Wrong values using lm-function

Simon Knapp sleepingwell at gmail.com
Mon Jun 25 16:18:10 CEST 2012


They are coding the variables as factors and using orthogonal
polynomial contrasts. This:

data.catapult <- data.frame(data.catapult$Distance,
do.call(data.frame, lapply(data.catapult[-1], factor, ordered=T)))
contrasts(data.catapult$h) <-
contrasts(data.catapult$s) <-
contrasts(data.catapult$l) <-
contrasts(data.catapult$e) <-
contr.poly(3, contrasts=F)
contrasts(data.catapult$b) <- contr.poly(2, contrasts=F)
lm1 <- lm(Distance ~ .^2, data=data.catapult)
summary(lm1)

gets you closer (same intercept at least), but I can't explain the
remaining differences. I'm not even sure why the results to look like
they do (interaction terms like "a*b" not "a:b" and one level for each
interaction).

Hope that helps,
Simon Knapp



More information about the R-help mailing list