# [Rd] Pearson residuals (PR#1123)

**carmen@mcs.st-and.ac.uk
**
carmen@mcs.st-and.ac.uk

*Wed, 10 Oct 2001 12:05:31 +0200 (MET DST)*

Full_Name: Carmen Fernandez
Version: 1.3.1
OS:
Submission from: (NULL) (138.251.202.115)
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.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._