Skip to content

Labeling in lm() (PR#2785)

2 messages · veraf@stat.sc.edu, Peter Dalgaard

#
Full_Name: Francisco Vera
Version: 1.6.2
OS: Windows XP
Submission from: (NULL) (66.20.153.135)


When I run the following code:

m1<-lm(y~A*B)
m2<-lm(y~A/B)
anova(m1)
anova(m2)

I obtain the results I want from both, the cross classified and the nested
model, except for the labeling. The terms for m1 are A, B and A:B (good); the
terms for m2 are A and A:B (wrong). I would expect for terms in m2 to be A and
B%in%A. The same mistake happens if I use the formula "y~A+B%in%A" instead of
"y~A/B". The values for the term A:B in m2 are correct, they correspond to
B%in%A and are different from A:B of m1. The only problem is the labeling.
#
veraf@stat.sc.edu writes:
This is not a bug. The colon operator is equivalent to %in% (b%in%a is
the same as a:b), and in both cases it describes the cross-terms
effect after removal of the specified main effects. In the nested
case, you just don't remove main efects of B because that doesn't make
sense. Just because S-PLUS uses a different labeling it doesn't mean
that R's is wrong.