degrees_of_freedom | R Documentation |
Estimate or extract degrees of freedom of models parameters.
degrees_of_freedom(model, method = "analytical", ...)
dof(model, method = "analytical", ...)
model |
A statistical model. |
method |
Type of approximation for the degrees of freedom. Can be one of the following:
Usually, when degrees of freedom are required to calculate p-values or
confidence intervals, |
... |
Currently not used. |
In many cases, degrees_of_freedom()
returns the same as df.residuals()
,
or n-k
(number of observations minus number of parameters). However,
degrees_of_freedom()
refers to the model's parameters degrees of freedom
of the distribution for the related test statistic. Thus, for models with
z-statistic, results from degrees_of_freedom()
and df.residuals()
differ.
Furthermore, for other approximation methods like "kenward"
or
"satterthwaite"
, each model parameter can have a different degree of
freedom.
model <- lm(Sepal.Length ~ Petal.Length * Species, data = iris)
dof(model)
model <- glm(vs ~ mpg * cyl, data = mtcars, family = "binomial")
dof(model)
model <- lmer(Sepal.Length ~ Petal.Length + (1 | Species), data = iris)
dof(model)
if (require("rstanarm", quietly = TRUE)) {
model <- stan_glm(
Sepal.Length ~ Petal.Length * Species,
data = iris,
chains = 2,
refresh = 0
)
dof(model)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.