View source: R/residuals.vlm.q
residualsvglm | R Documentation |
Residuals for a vector generalized linear model (VGLM) object.
residualsvglm(object, type = c("working", "pearson", "response",
"deviance", "ldot", "stdres", "rquantile"), matrix.arg = TRUE)
object |
Object of class |
type |
The value of this argument can be abbreviated.
The type of residuals to be returned.
The default is the first one: working residuals
corresponding to
the IRLS algorithm. These are defined for all models.
They are sometimes added to VGAM plots of estimated
component functions (see Pearson residuals for GLMs, when squared and summed over the data set, total to the Pearson chi-squared statistic. For VGLMs, Pearson residuals involve the working weight matrices and the score vectors. Under certain limiting conditions, Pearson residuals have 0 means and identity matrix as the variance-covariance matrix. Response residuals are simply the difference between the observed values and the fitted values. Both have to be of the same dimension, hence not all families have response residuals defined. Deviance residuals are only defined for models with
a deviance function. They tend to GLMs mainly.
This function returns a Randomized quantile residuals (RQRs)
(Dunn and Smyth, 1996)
are based on
the The choice Standardized residuals are currently
only defined for 2 types of models:
(i) GLMs
( |
matrix.arg |
Logical, which applies when if the pre-processed
answer is a vector or a 1-column matrix.
If |
This function returns various kinds of residuals, sometimes depending on the specific type of model having been fitted. Section 3.7 of Yee (2015) gives some details on several types of residuals defined for the VGLM class.
Standardized residuals for GLMs are described in
Section 4.5.6 of Agresti (2013) as the ratio of
the raw (response) residuals divided by their
standard error.
They involve the generalized hat matrix evaluated
at the final IRLS iteration.
When applied to the LM,
standardized residuals for GLMs simplify to
rstandard
.
For GLMs they are basically
the Pearson residual divided by the square root of 1 minus the
leverage.
If that residual type is undefined or inappropriate
or not yet implemented,
then NULL
is returned,
otherwise a matrix or vector of residuals is returned.
This function may change in the future, especially those whose definitions may change.
Agresti, A. (2007). An Introduction to Categorical Data Analysis, 2nd ed., New York: John Wiley & Sons. Page 38.
Agresti, A. (2013). Categorical Data Analysis, 3rd ed., New York: John Wiley & Sons.
Agresti, A. (2018). An Introduction to Categorical Data Analysis, 3rd ed., New York: John Wiley & Sons.
Dunn, P. K. and Smyth, G. K. (1996). Randomized quantile residuals. Journal of Computational and Graphical Statistics, 5, 236–244.
resid
,
vglm
,
chisq.test
,
hatvalues
.
pneumo <- transform(pneumo, let = log(exposure.time))
fit <- vglm(cbind(normal, mild, severe) ~ let, propodds, pneumo)
resid(fit) # Same as having type = "working" (the default)
resid(fit, type = "response")
resid(fit, type = "pearson")
resid(fit, type = "stdres") # Test for independence
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.