[R] Error in plot.lm

Peter Ehlers ehlers at ucalgary.ca
Fri Mar 11 22:55:53 CET 2011


On 2011-03-11 13:33, Jeff Newmiller wrote:
> Thank you for indicating more precisely where the bug arises.
>
> I disagree with the blanket assertion that the I() is not needed. The
> example is purposely simplified to illustrate the problem, which lm has
> no difficulty with but which plot.lm does. plot.lm manages to deal with
> I() on the right side, why doesn't it deal similarly with the left side?

As pd says, you can always wrap your I() in unclass().
Other alternatives are:
- skip the QQ-plot with plot(model, which=c(1,3:5))
   and then do the QQ-plot separately with

   qqnorm(c(resid(model)); qqline(c(resid(model))

- remove the class attribute from the residuals
   component of the model with

   class(model$residuals) <- NULL

Curiously, the code for abline used to handle this,
but somewhere along the line it gained the class check.
(I haven't bothered to check the NEWS.)

Peter Ehlers

>
> ---------------------------------------------------------------------------
> Jeff Newmiller The ..... ..... Go Live...
> DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
> Live: OO#.. Dead: OO#.. Playing
> Research Engineer (Solar/Batteries O.O#. #.O#. with
> /Software/Embedded Controllers) .OO#. .OO#. rocks...1k
> ---------------------------------------------------------------------------

<snip>



More information about the R-help mailing list