Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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.

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

Examples

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)

VGAM

Vector Generalized Linear and Additive Models

v1.1-5
GPL-3
Authors
Thomas Yee [aut, cre], Cleve Moler [ctb] (author of several LINPACK routines)
Initial release
2021-01-13

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.