Description Usage Arguments Details Value Examples
Degrees of freedom for the model in an object of class 'lmvar'. The degrees of freedom are defined as the rank of the model matrix X_μ for the expectation values, plus the rank of the model matrix X_σ for the standard deviations.
1 |
object |
Object of class 'lmvar_no_fit' (hence it can also be of class 'lmvar') |
mu |
Boolean, specifies whether the degrees of freedom for the model for the expectation values must be included. |
sigma |
Boolean, specifies whether the degrees of freedom for the model for the standard deviations must be included. |
... |
Additional arguments, not used in the current implementation |
If mu = TRUE
and sigma = TRUE
, the function returns the rank of the model-matrix X_μ plus the
rank of the model matrix X_σ.
If mu = TRUE
and sigma = FALSE
, the function returns the rank of the model-matrix X_μ.
If mu = FALSE
and sigma = TRUE
, the function returns the rank of the model-matrix X_σ.
Both model matrices contain a column corresponding to an intercept term. This column is added by lmvar
.
See also the vignette 'Intro'.
An integer containing the degrees of freedom for the model in object
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # As example we use the dataset 'attenu' from the library 'datasets'. The dataset contains
# the response variable 'accel' and two explanatory variables 'mag' and 'dist'.
library(datasets)
# Create the model matrix for the expected values
X = cbind(attenu$mag, attenu$dist)
colnames(X) = c("mag", "dist")
# Create the model matrix for the standard deviations.
X_s = cbind(attenu$mag, 1 / attenu$dist)
colnames(X_s) = c("mag", "dist_inv")
# Carry out the fit
fit = lmvar(attenu$accel, X, X_s)
# The degrees of freedom are
dfree(fit)
# The degrees of freedom of the expected values are
dfree(fit, sigma = FALSE)
# The degrees of freedom of the standard deviations are
dfree(fit, mu = FALSE)
# Function also works on object of class 'lmvar_no_fit'
no_fit = lmvar_no_fit(attenu$accel, X, X_s)
dfree(no_fit)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.