[Rd] rstandard.glm() in base/R/lm.influence.R

Martin Maechler maechler at stat.math.ethz.ch
Tue Jan 20 16:04:44 MET 2004

>>>>> "Roger" == Roger Bivand <Roger.Bivand at nhh.no>
>>>>>     on Tue, 20 Jan 2004 14:16:42 +0100 (CET) writes:

    Roger> I contacted John Fox about this first, because parts
    Roger> of the file are attributed to him. He says that he
    Roger> didn't write rstandard.glm(), and suggests asking
    Roger> r-devel.

    Roger> As it stands, rstandard.glm() has
    Roger> summary(model)$dispersion outside the sqrt(), while
    Roger> in rstandard.lm(), the sd is already sqrt()ed. This
    Roger> seems to follow stdres() in VR/MASS/R/stdres.R.

    Roger> Of course for the c("poisson", "binomial") families,
    Roger> summary(model)$dispersion is 1, so sqrt doesn't make
    Roger> a difference, but working with an epidemiologist,
    Roger> Marilia Carvalho, we wanted to map the standardised
    Roger> residuals of a quasipoisson null model of cases
    Roger> offset by log(pop.at.risk), and rstandard.glm()
    Roger> seemed to compress the values more than we'd have
    Roger> expected. Her colleague: "Valeska (L.  Andreozzi)
    Roger> says that she has already noticed that, and as
    Roger> McCullagh & Nelder (2nd ed, pg 397) says, the
    Roger> dispersion is inside the sqrt". (That's the way I
    Roger> read 12.5 on p. 397 too). I can't see that
    Roger> summary(model)$dispersion has already been subject to
    Roger> sqrt() in sum(object$weights *
    Roger> object$residuals^2)/df.r in summary.glm().

    Roger> Should:

    Roger>     res / (summary(model)$dispersion * sqrt(1 -
    Roger> infl$hat))

    Roger> be:

    Roger>     res / (sqrt(summary(model)$dispersion * (1 -
    Roger> infl$hat)))

    Roger> on line 117 in base/R/lm.influence.R?

Yes, to all what you said.
Only "base/" is "stats/" in R-devel where I've just committed
the fix.
It's been kind of a typo I had introduced when making rstandard


More information about the R-devel mailing list