[R] Understanding glm family documentation: dev.resids

Heather Turner Heather.Turner at warwick.ac.uk
Fri Nov 14 15:52:01 CET 2008


Hi Peter,

You are right, the dev.resids function does compute the square of the
deviance residuals.

Equivalently, dev.resids computes the d_i values, where d_i is the
contribution of the $i$th observation to the deviance. The d_i can be
defined directly and it is useful to have a function that returns these
values rather than their signed square root (the deviance residuals),
since they are used to compute the deviance in the glm algorithm and
elsewhere, as sum(d_i).

The name dev.resids may be a bit misleading, but it is essentially an
internal function, so it's not unreasonable for it to have a loose
interpretation ("a function that returns a function of the deviance
residuals").

However, it is less reasonable for the documentation to say something
misleading, so you could submit a bug report on that I guess.

Best regards,

Heather

Dr H Turner
Senior Research Fellow
Dept. of Statistics
The University of Warwick
Coventry
CV4 7AL

Tel: 024 76575870
Fax: 024 76524532
Url: www.warwick.ac.uk/go/heatherturner


Peter Dunn wrote:
> Hi all
> 
> Consider the  family  function, as used by glm.  The help page says the value of the family object is a list, one element of which is the following:
> 
> 
> dev.resids function giving the deviance residuals as a function of (y, mu, wt). 
> 
> 
> But reading any of the family functions (eg  poisson) shows that  dev.resids  is a function that computes the *square* of the deviance residuals (at least, by every definition I know of).  Further, the deviance residuals returned by  residuals.glm  are essentially computed as the square root of  dev.resids.
> 
> Something seems amiss.  The element  dev.resids  actually seems to compute the deviance residuals squared.  I guess the help file could be changed to read:
> 
> 
> dev.resids function giving the square of the deviance residuals as a function of (y, mu, wt). 
> 
> 
> ...but then,  dev.resids  still seems a misleading label, but that may so entrenched it will never changed.
> 
> (By my definition, the square of the deviance residuals is not quite the unit deviance as the weights need to be incorporated differently, but others may disagree.)
> 
> Of course, I could be way off track.  I would appreciate enlightenment.
> 
> P.
> 
> 
> 
> 
> Peter Dunn
> Biostatistician
> School of Health and Sport Science
> Faculty of Science, Health and Education
> University of the Sunshine Coast
>  
> Tel: +61 7 5456 5085
> Fax: +61 7 5430 2896
> Email: pdunn2 at usc.edu.au
> www.usc.edu.au
> 
> 
> CRICOS Provider Number: 01595D
> 
> This communication is intended for the recipient only and should not be forwarded, distributed or otherwise read by others without express permission. The views expressed in this email are not necessarily those of the University of the Sunshine Coast.
>



More information about the R-help mailing list