df.residual: Residual Degrees-of-Freedom

df.residualR Documentation

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.

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 jth linear/additive predictor.

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.

See Also

vglm, deviance, lm, anova.vglm,

Examples

pneumo <- transform(pneumo, let = log(exposure.time))
(fit <- vglm(cbind(normal, mild, severe) ~ let, propodds, 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)
nobs(fit, type = "lm")  # n
nvar(fit, type = "lm")  # p_LM
nvar_vlm(fit, type = "lm")  # p_LM(j) (<= p_LM elementwise)

VGAM documentation built on Sept. 18, 2024, 9:09 a.m.