residuals.glmGamPoi {glmGamPoi} | R Documentation |
Extract Residuals of Gamma Poisson Model
## S3 method for class 'glmGamPoi' residuals( object, Y, type = c("deviance", "pearson", "randomized_quantile", "working", "response"), ... )
object |
a fit of type |
Y |
any matrix-like object (e.g. |
type |
the type of residual that is calculated. See details for more information.
Default: |
... |
currently ignored. |
This method can calculate a range of different residuals:
The deviance for the Gamma-Poisson model is
dev = 2 * (1/theta log((1 + µ theta) / (1 + y theta)) - y log((µ + y µ theta) / (y + y µ theta)))
and the residual accordingly is
res = sign(y - µ) sqrt(dev).
The Pearson residual is res = (y - µ) / sqrt(µ + µ^2 theta)
The randomized quantile residual was originally developed
by Dunn & Smyth, 1995. Please see that publication or statmod::qresiduals()
for more
information.
The working residuals are res = (y - µ) / µ.
The response residuals are res = y - µ
a matrix with the same size as Y
. If Y
is a DelayedArray
than the
result will be as well.
glm_gp()
and 'stats::residuals.glm()