I contacted John Fox about this first, because parts of the file are attributed to him. He says that he didn't write rstandard.glm(), and suggests asking r-devel. As it stands, rstandard.glm() has summary(model)$dispersion outside the sqrt(), while in rstandard.lm(), the sd is already sqrt()ed. This seems to follow stdres() in VR/MASS/R/stdres.R. Of course for the c("poisson", "binomial") families, summary(model)$dispersion is 1, so sqrt doesn't make a difference, but working with an epidemiologist, Marilia Carvalho, we wanted to map the standardised residuals of a quasipoisson null model of cases offset by log(pop.at.risk), and rstandard.glm() seemed to compress the values more than we'd have expected. Her colleague: "Valeska (L. Andreozzi) says that she has already noticed that, and as McCullagh & Nelder (2nd ed, pg 397) says, the dispersion is inside the sqrt". (That's the way I read 12.5 on p. 397 too). I can't see that summary(model)$dispersion has already been subject to sqrt() in sum(object$weights * object$residuals^2)/df.r in summary.glm(). Should: res / (summary(model)$dispersion * sqrt(1 - infl$hat)) be: res / (sqrt(summary(model)$dispersion * (1 - infl$hat))) on line 117 in base/R/lm.influence.R? Best wishes, Roger -- Roger Bivand Econonic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Breiviksveien 40, N-5045 Bergen, Norway, voice: +47-55959355, fax: +47-55959393; Roger.Bivand@nhh.no
By the way, it looks to me like Roger is right. John At 02:16 PM 1/20/2004 +0100, Roger Bivand wrote:>I contacted John Fox about this first, because parts of the file are >attributed to him. He says that he didn't write rstandard.glm(), and >suggests asking r-devel. > >As it stands, rstandard.glm() has summary(model)$dispersion outside the >sqrt(), while in rstandard.lm(), the sd is already sqrt()ed. This seems to >follow stdres() in VR/MASS/R/stdres.R. > >Of course for the c("poisson", "binomial") families, >summary(model)$dispersion is 1, so sqrt doesn't make a difference, but >working with an epidemiologist, Marilia Carvalho, we wanted to map the >standardised residuals of a quasipoisson null model of cases offset by >log(pop.at.risk), and rstandard.glm() seemed to compress the values more >than we'd have expected. Her colleague: "Valeska (L. Andreozzi) says that >she has already noticed that, and as McCullagh & Nelder (2nd ed, pg 397) >says, the dispersion is inside the sqrt". (That's the way I read 12.5 on >p. 397 too). I can't see that summary(model)$dispersion has already been >subject to sqrt() in sum(object$weights * object$residuals^2)/df.r in >summary.glm(). > >Should: > > res / (summary(model)$dispersion * sqrt(1 - infl$hat)) > >be: > > res / (sqrt(summary(model)$dispersion * (1 - infl$hat))) > >on line 117 in base/R/lm.influence.R? > >Best wishes, > >Roger > >-- >Roger Bivand >Econonic Geography Section, Department of Economics, Norwegian School of >Economics and Business Administration, Breiviksveien 40, N-5045 Bergen, >Norway, voice: +47-55959355, fax: +47-55959393; Roger.Bivand@nhh.no > >______________________________________________ >R-devel@stat.math.ethz.ch mailing list >https://www.stat.math.ethz.ch/mailman/listinfo/r-devel----------------------------------------------------- John Fox Department of Sociology McMaster University Hamilton, Ontario, Canada L8S 4M4 email: jfox@mcmaster.ca phone: 905-525-9140x23604 web: www.socsci.mcmaster.ca/jfox
>>>>> "Roger" == Roger Bivand <Roger.Bivand@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 generic. Martin