Learn R Programming

VGAM (version 1.0-5)

df.residual: Residual Degrees-of-Freedom

Description

Returns the residual degrees-of-freedom extracted from a fitted VGLM object.

Usage

df.residual_vlm(object, type = c("vlm", "lm"), …)

Arguments

object

an object for which the degrees-of-freedom are desired, e.g., a vglm object.

type

the type of residual degrees-of-freedom wanted. In some applications the 'usual' LM-type value may be more appropriate. The default is the first choice.

additional optional arguments.

Value

The value of the residual degrees-of-freedom extracted from the object. When type = "vlm" this is a single integer, and when type = "lm" this is a \(M\)-vector of integers.

Details

When a VGLM is fitted, a large (VLM) generalized least squares (GLS) fit is done at each IRLS iteration. To do this, an ordinary least squares (OLS) fit is performed by transforming the GLS using Cholesky factors. The number of rows is \(M\) times the `ordinary' number of rows of the LM-type model: \(nM\). Here, \(M\) is the number of linear/additive predictors. So the formula for the VLM-type residual degrees-of-freedom is \(nM - p^{*}\) where \(p^{*}\) is the number of columns of the `big' VLM matrix. The formula for the LM-type residual degrees-of-freedom is \(n - p_{j}\) where \(p_{j}\) is the number of columns of the `ordinary' LM matrix corresponding to the \(j\)th linear/additive predictor.

See Also

vglm, deviance, lm.

Examples

Run this code
# NOT RUN {
pneumo <- transform(pneumo, let = log(exposure.time))
(fit <- vglm(cbind(normal, mild, severe) ~ let, propodds, data = pneumo))
head(model.matrix(fit, type = "vlm"))
head(model.matrix(fit, type = "lm"))

df.residual(fit, type = "vlm")  # n * M - p_VLM
nobs(fit, type = "vlm")  # n * M
nvar(fit, type = "vlm")  # p_VLM

df.residual(fit, type = "lm")  # n - p_LM(j); Useful in some situations
nobs(fit, type = "lm")  # n
nvar(fit, type = "lm")  # p_LM
nvar_vlm(fit, type = "lm")  # p_LM(j) (<= p_LM elementwise)
# }

Run the code above in your browser using DataLab