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

From: J. Hosking <jh910_at_juno.com>
Date: Wed 26 Apr 2006 - 19:02:08 GMT


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



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu Apr 27 05:06:52 2006

This archive was generated by hypermail 2.1.8 : Wed 26 Apr 2006 - 20:17:55 GMT