Strange behaviour of lm

Peter Dalgaard BSA p.dalgaard@biostat.ku.dk
08 Nov 1998 23:19:20 +0100


Guido Masarotto <guido@sirio.stat.unipd.it> writes:

> R-0.62.4 running under linux
> -------------------------------------------------------------------------------
> > x <- rnorm(10)
> > lm(x~x)
> Error: length of namelist must equal dims

That one is a bug...

> > x <- c(1,2,3)
> > lm(x~x)
> 
> Call:
> lm(formula = x ~ x)
> 
> Coefficients:
> (Intercept)
>           2
> 	  
> > y <- x
> > lm(y~x)
>   
> Call:
> lm(formula = y ~ x)
> 	  
> Coefficients:
> (Intercept)            x
>           0            1

...but the rest is Splus compatible. The dependent is removed from the
right hand side of model formulas. I seem to remember that there's a
reason for that.

-- 
   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
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._