From p.dalgaard at biostat.ku.dk  Mon Aug  4 21:39:21 2003
From: p.dalgaard at biostat.ku.dk (Peter Dalgaard BSA)
Date: Mon Aug  4 22:39:23 2003
Subject: [Rd] unexpected behaviour in lm() (PR#3657)
In-Reply-To: <200308042011.h74KBrJH006556@pubhealth.ku.dk>
References: <200308042011.h74KBrJH006556@pubhealth.ku.dk>
Message-ID: <x21xw1w3s1.fsf@biostat.ku.dk>

ottk@bms.com writes:

> > lm(c(1:10) ~ c(1:10))
> 
> Call:
> lm(formula = c(1:10) ~ c(1:10))
> 
> Coefficients:
> (Intercept)  
>         5.5  

Unexpected: yes, bug: no.

Thing is that the lm logic removes the resonse from the set of
predictors. This is to support stuff like "y ~ .", I believe.

You get the same effect from

> x <- c(1:10)
> lm(x~x)

Call:
lm(formula = x ~ x)

Coefficients:
(Intercept)
        5.5


-- 
   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] unexpected behaviour in lm() (PR#3657)
Peter Dalgaard BSA