From jfox at mcmaster.ca  Thu Mar 17 20:22:08 2011
From: jfox at mcmaster.ca (John Fox)
Date: Thu, 17 Mar 2011 15:22:08 -0400
Subject: [Rd] Standardized Pearson residuals
In-Reply-To: <6C41520B-D086-45C1-969D-7B79BAFC0D8B@gmail.com>
References: <mailman.28.1300186808.4951.r-devel@r-project.org>
	<9E1DF5E9-0B03-441C-9157-B9A7A16A0F53@anu.edu.au>
	<4DB19694-B58A-44BC-B779-CC086F223605@gmail.com>
	<325E2604-06E3-4C1A-9D2B-08A42A894025@anu.edu.au>
	<C1D939A1-DBE7-4196-AC50-972B9E0B9B07@gmail.com>
	<19842.9537.824806.962418@stat.math.ethz.ch>
	<6C41520B-D086-45C1-969D-7B79BAFC0D8B@gmail.com>
Message-ID: <web-346770472@cgpsrv2.cis.mcmaster.ca>

Dear Peter and Martin,

On Thu, 17 Mar 2011 18:08:18 +0100
 peter dalgaard <pdalgd at gmail.com> wrote:
> 
> On Mar 17, 2011, at 16:14 , Martin Maechler wrote:
> 
> >>>>>> peter dalgaard <pdalgd at gmail.com>
> >>>>>>    on Thu, 17 Mar 2011 15:45:01 +0100 writes:
> >> 
> > 
> >> Back to the original question:
> > 
> >> The current rstandard() code reads
> > 
> > ## FIXME ! -- make sure we are following "the literature":
> > rstandard.glm <- function(model, infl = lm.influence(model, do.coef=FALSE), ...)
> > {
> >    res <- infl$wt.res # = "dev.res"  really
> >    res <- res / sqrt(summary(model)$dispersion * (1 - infl$hat))
> >    res[is.infinite(res)] <- NaN
> >    res
> > }
> > 
> >> which is "svn blame" to ripley but that is due to the 2003
> >> code reorganization (except for the infinity check from
> >> 2005). So apparently, we have had that FIXME since
> >> forever... and finding its author appears to be awkward
> >> (Maechler, perhaps?).
> > 
> > yes, almost surely
> > 
> >> I did try Bretts code in lieu of the above (with a mod to
> >> handle $dispersion) and even switched the default to use
> >> the Pearson residuals. Make check-devel sailed straight
> >> through apart from the obvious code/doc mismatch, so we
> >> don't have any checks in place nor any examples using
> >> rstandard(). I rather strongly suspect that there aren't
> >> many user codes using it either.
> > 
> >> It is quite tempting simply to commit the change (after
> >> updating the docs). One thing holding me back though: I
> >> don't know what "the literature" refers to.
> > 
> > well, "the relevant publications on the topic" ...
> > and now define that (e.g. using the three 'References' on the
> > help page).
> 
> I count 5 actually... IIRC, the first two do not deal with glm diagnostics. The last two are by Fox, and, presumably, he is around to chime in if he wants. The middle one, by Williams, does define both standardized Pearson and standardized deviance residuals.

Though I don't have it in front of me, I recall that my Applied Regression text follows Williams and defines both standardized deviance and standardized Pearson residuals. As well, there are new editions of both these sources: 

Fox, J. (2008) Applied Regression Analysis and Generalized Linear Models, Second Edition (Sage)

Fox, J. and S. Weisberg (2011) An R Companion to Applied Regression, Second Edition (Sage)

I'd take Williams as the definitive reference. I'll send a follow-up message if my memory proves faulty.

Best,
 John

> 
> Or did you mean the three on ?glm.summaries? I would assume Davison and Snell to be the operative one, but I don't have it to hand.
>  
> Anyways, given that de default for residuals.glm is deviance residuals, I suppose that rstandard.glm should have the same default for consistency, and that is also the least disruptive variant. I see no reason not to make standardized Pearson residuals an option. 
> 
> > Really, that's what I think I meant when I (think I) wrote that FIXME.
> > The point then I think was that we had code "donations", and they
> > partly were clearly providing functionality that was (tested)
> > "correct" (according to e.g. McCoullagh & Nelder and probably
> > another one or two text books I would have consulted ... no
> > large Wikipedia back then), 
> > but also provided things for which there was nothing in "the
> > literature", but as the author provided them with other good
> > code, we would have put it in, as well....
> > == my vague recollection from the past
> > 
> > Martin
> > 
> >> -- 
> >> Peter Dalgaard Center for Statistics, Copenhagen Business
> >> School Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> >> Phone: (+45)38153501 Email: pd.mes at cbs.dk Priv:
> >> PDalgd at gmail.com
> > 
> >> ______________________________________________
> >> R-devel at r-project.org mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-devel
> 
> -- 
> Peter Dalgaard
> Center for Statistics, Copenhagen Business School
> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> Phone: (+45)38153501
> Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

------------------------------------------------
John Fox
Sen. William McMaster Prof. of Social Statistics
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/



[Rd] Standardized Pearson residuals
John Fox