From p.dalgaard@biostat.ku.dk  Wed Oct 10 12:13:41 2001
From: p.dalgaard@biostat.ku.dk (Peter Dalgaard BSA)
Date: 10 Oct 2001 13:13:41 +0200
Subject: [Rd] Pearson residuals (PR#1123)
In-Reply-To: <200110101005.MAA25819@pubhealth.ku.dk>
References: <200110101005.MAA25819@pubhealth.ku.dk>
Message-ID: <x2669noihm.fsf@blueberry.kubism.ku.dk>

carmen@mcs.st-and.ac.uk writes:

> I think there is a problem when computing Pearson residuals, in that they seem
> to be computed at the raw residuals divided by the square root of the
> corresponding diagonal element of the weight matrix W evaluated at the last step
> of the iterative model fitting procedure (IWLS), instead of dividing by the
> square root of the model variance. Here's an example of the weird effects it
> produces:
> 
> > me <- c(1:100)/2
> > y <- rpois(100,me)
> > yglm <- glm(y~me-1, family=poisson(link="identity"))
> > plot(fitted(yglm), residuals(yglm,type="response"))
>  
> plots the raw residuals... but
>  
> > plot(fitted(yglm), residuals(yglm,type="pearson"))
>  
> plots the raw residuals MULTIPLIED by sqrt(fitted(yglm))... because it
> computes the Pearson residuals dividing by the square root of the diagonal
> element of the weight matrix W (at the end of the iterative fitting process)
> rather than dividing by the sqrt of variance.

Um, right... At the very least, there's a "/" that should have been
"*". But do we also divide by the dispersion (when it is estimated)? I
forget what the definition says.


-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] Pearson residuals (PR#1123)
Peter Dalgaard BSA