Skip to content
Back to formatted view

Raw Message

Message-ID: <x21xw1w3s1.fsf@biostat.ku.dk>
Date: 2003-08-04T22:39:23Z
From: Peter Dalgaard
Subject: unexpected behaviour in lm() (PR#3657)
In-Reply-To: <200308042011.h74KBrJH006556@pubhealth.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