I want to know how R finds standardized residuals or rstandard
when fitting a poisson GLM. I have already found this but it is not talking about standardized residuals. So here is a simple code:
counts <- c(18,17,15,20,10,20,25,13,12)
x=rpois(9,1)
E=counts*10+rpois(9,2)
glm.D93 <- glm(counts ~ x+offset(log(E)), family=poisson)
Now I need to know how R calculates:
> rstandard(glm.D93)
1 2 3 4 5 6
0.018364902 -0.009725560 0.011933387 -0.026455659 -0.036635623 -0.002118836
7 8 9
0.036552236 -0.022033897 0.034771135
I used help on rstandard
to find that there are actually two types of rstandard
. One is based on "deviance" (default) and the other on based on "pearson" residuals. Both of these can be easily obtained by the following functions:
> resid(glm.D93,type="dev")
> resid(glm.D93,type="pear")
I am guessing that to find rstandard
, I should divide above two residuals by the standard deviation of the ith residual. Thanks.