[Rd] predict.lm is broken in 1.1.0-patched (2000-August-7) (PR#626)

Peter Dalgaard BSA p.dalgaard@biostat.ku.dk
07 Aug 2000 21:30:43 +0200


ripley@stats.ox.ac.uk writes:

> predict.lm has been broken by recent changes to the patched branch.
> 
> It fails for all singular fits.  An example:
> 
> library(MASS)
> data(quine)
> quine.hi <- aov(log(Days + 2.5) ~ .^4, quine)
> quine.nxt <- update(quine.hi, . ~ . - Eth:Sex:Age:Lrn)
> predict(quine.nxt)
>   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20 
>  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA 
...
> I believe this is a lot worse than that which the changes were intended to
> fix. (Are we not supposed to be ultra-cautious about not making things
> worse in that branch?)

Sometimes the fix for one bug uncovers another. We have

> coef.aov
function (object, ...) 
{
    z <- object$coef
    z[!is.na(z)]
}
> coef.lm 
function (object, ...) 
object$coefficients

and both of these cannot be right when predict.lm calls coef(object)
and object$coefficients contains NA's. Using object$coefficients
inside predict.lm fixes things, but I'm still not happy with the two
different conventions for coef...

-- 
   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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._