[R] Understanding lm-based analysis of fractional factorial experiments

Ista Zahn istazahn at gmail.com
Thu Mar 7 14:01:19 CET 2013


On Thu, Mar 7, 2013 at 5:47 AM, Kjetil Kjernsmo <kjekje at ifi.uio.no> wrote:
> On Wednesday 6. March 2013 16.33.34 Peter Claussen wrote:
>> But you don't have enough data points to estimate all of the possible
>> interactions; that's why you have NA in your original results.
>
> Yes, but it seems to me that lm is doing the right thing, or at least the
> expected thing, here, the NA's are simply telling me these are aliased, which
> is correct and expected.

I agree lm is doing the correct thing, but I think you are not. It
simply does not make sense:

# your model tries to estimate means for all 32 of these groups
pm <- c("+", "-")
tmp <- expand.grid(B=pm, C=pm, D=pm, E=pm, Q=pm)
dim(tmp)

# but your data has only 16 of them!
interaction(tmp) %in% interaction(leaf[c("B", "C", "D", "E", "Q")])

# you model asks for estimates for these groups, but they do not exist
in your data
tmp[!interaction(tmp) %in% interaction(leaf[c("B", "C", "D", "E", "Q")]), ]


>
>> You could
>> add the just the first order interactions manually, i.e.,  + B:C + B:D …
>
> Yeah, I tried that, but then it returns to the "unexpected" result, i.e., I
> get the same result as with the yavg ~ B * C * D * E * Q formula. Therefore, I
> think the problem doesn't lie with the formula, nor does it lie with any of
> the code, it is just a matter of understanding defaults...
>
> I have consulted local help (of course), but what they say is that "R has some
> odd defaults, you need to ask them or use something different". I don't want to
> use something different, I like R, I have contributed to R in the past and will
> do so again if only I can get my head around this... :-)

Start again, and forget the book which most of us do not have. Explain
what you are trying to do. Base the explanation on the data and
example at hand, and explain what you consider to be the expected
result and why.

Best,
Ista

>
> Kjetil
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list