df.residual | R Documentation |
Returns the residual degrees-of-freedom extracted from a fitted VGLM object.
df.residual_vlm(object, type = c("vlm", "lm"), ...)
object |
an object for which the degrees-of-freedom are desired,
e.g., a |
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. |
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.
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.
vglm
,
deviance
,
lm
,
anova.vglm
,
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.