[R] Fractional Factorial - Wrong values using lm-function
Simon Knapp
sleepingwell at gmail.com
Mon Jun 25 16:35:02 CEST 2012
... but this is tantalisingly close:
dat1 <- with(data.catapult,
data.frame(
Distance,
h=C(h, poly, 1),
s=C(s, poly, 1),
l=C(l, poly, 1),
e=C(e, poly, 1),
b=C(b, poly, 1)
)
)
lm4 <- lm(Distance ~ .^2, data = dat1)
summary(lm4)
... wish I knew what it meant.
On Tue, Jun 26, 2012 at 12:18 AM, Simon Knapp <sleepingwell at gmail.com> wrote:
> 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