From p.dalgaard at biostat.ku.dk  Tue Apr 15 23:09:11 2003
From: p.dalgaard at biostat.ku.dk (Peter Dalgaard BSA)
Date: Tue Apr 15 22:07:44 2003
Subject: [Rd] Labeling in lm() (PR#2785)
In-Reply-To: <200304151933.h3FJXopD007746@pubhealth.ku.dk>
References: <200304151933.h3FJXopD007746@pubhealth.ku.dk>
Message-ID: <x2n0irzfo8.fsf@biostat.ku.dk>

veraf@stat.sc.edu writes:

> 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.

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.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907


[Rd] Labeling in lm() (PR#2785)
Peter Dalgaard BSA