Last chance! 50% off unlimited learning
Sale ends in
Calculates different types of residuals, Cook's distance and the leverages for a regression-scale model.
rsm.diag(rsmfit, weighting = "observed")
an rsm
object, i.e. the result of a call to rsm
.
character string; defines the weight matrix that should be used
in the calculation of the residuals and diagnostics. Possible
choices are "observed"
, "score"
, "deviance"
and "max"
; see Jorgensen (1984) for their
definition. The default is "observed"
.
Returns a list with the following components:
the response residuals on the response scale.
the standardized deviance residuals from the IRLS fit.
the standardized Pearson residuals from the IRLS fit.
the deletion residuals from the IRLS fit.
the
the probability transform residuals from the IRLS fit.
Cook's distance.
the leverages of the observations.
the value of the scale parameter.
This function is based on A.J. Canty's function glm.diag
contained in the package boot.
If the weighting scheme is "observed"
, the weights used are
the values stored in the q2
component of the rsm
object rsmfit
. Otherwise, they are calculated by
rsm.diag
. Some of the IRLS weights returned by
rsm
may be negative if the error distribution is Student's
t or user-defined. In order to avoid missing values in the
residuals and regression diagnostics, the default weighting scheme
used in rsm.diag
switches automatically from
"observed"
to "score"
unless otherwise specified. The
"score"
weights are also used by default if Huber's least
favourable error distribution is used.
There are three types of residuals. The response residuals are
taken on the response scale, whereas the probability transform
residuals are on the
More details and in particular the definitions of the above residuals and diagnostics can be found in Brazzale (2000, Section 6.3.1).
Brazzale, A. R. (2000) Practical Small-Sample Parametric Inference. Ph.D. Thesis N. 2230, Department of Mathematics, Swiss Federal Institute of Technology Lausanne.
Jorgensen, B. (1984) The delta algorithm and GLIM. Int. Stat. Rev., 52, 283--300.
Davison, A. C. and Snell, E. J. (1991) Residuals and diagnostics. In Statistical Theory and Modelling: In Honour of Sir David Cox (eds. D. V. Hinkley, N. Reid, and E. J. Snell), 83--106. London: Chapman & Hall.
Davison, A. C. and Tsai, C.-L. (1992) Regression model diagnostics. Int. Stat. Rev., 60, 337--353.
# NOT RUN {
## Sea Level Data
data(venice)
attach(venice)
Year <- 1:51/51
c11 <- cos(2*pi*1:51/11) ; s11 <- sin(2*pi*1:51/11)
c19 <- cos(2*pi*1:51/18.62) ; s19 <- sin(2*pi*1:51/18.62)
venice.rsm <- rsm(sea ~ Year + I(Year^2) + c11 + s11 + c19 + s19,
family = extreme)
venice.diag <- rsm.diag(venice.rsm)
## observed weights
detach()
## Darwin's Data on Growth Rates of Plants
data(darwin)
darwin.rsm <- rsm(cross-self ~ pot - 1, family = Huber, data = darwin)
darwin.diag <- rsm.diag(darwin.rsm)
## score weights
# }
Run the code above in your browser using DataLab