[Rd] Problems after lm(..., qr=FALSE)

J. Hosking jh910 at juno.com
Wed Apr 26 21:02:08 CEST 2006


The documentation for lm() indicates that the 'qr' component of an
lm object is optional.  But some functions do not behave well when
this component is absent: summary() gives an error and predict()
returns all zeroes.

Example:

   > x <- 1:10;  y <- x^2
   > mm <- lm(y~x, qr=FALSE)
   > summary(mm)
   Error in summary.lm(mm) : invalid 'lm' object:  no 'terms' nor 'qr' 
component
   > predict(mm, newdata=data.frame(x=11:15))
   1 2 3 4 5
   0 0 0 0 0
   > predict(mm, newdata=data.frame(x=11:15), se=TRUE)
   Error in qr.R(object$qr) : argument is not a QR decomposition

   > R.version
                  _
   platform       i386-pc-mingw32
   arch           i386
   os             mingw32
   system         i386, mingw32
   status
   major          2
   minor          3.0
   year           2006
   month          04
   day            24
   svn rev        37909
   language       R
   version.string Version 2.3.0 (2006-04-24)



J. R. M. Hosking



More information about the R-devel mailing list