edf | R Documentation |
Estimate expected degrees of freedom of a cirls object through simulations.
edf(object, nsim = 10000, seed = NULL)
object |
A |
nsim |
The number of simulations. |
seed |
An optional seed for the random number generator. See set.seed. |
Simulates coefficient vectors from their unconstrained distribution, which is the non-truncated multivariate normal distribution. For each simulated vector, counts the number of violated constraints as the number of active constraints under the constrained distribution. The expected degrees of freedom is then the number of parameters minus the average number of active constraints.
This procedure allows to account for the randomness of degrees of freedom for the constrained model. Indeed, the observed degrees of freedom is the number of parameters minus the number of active constraints. However, the number of active constraints is random as, some constraints can be active or not depending on the observed data. For instance, in a model for which the constraints are binding, the expected degrees of freedom will be close to the observed one, while in a model in which the constraints are irrelevant, the expected degrees of freedom will be closer to the unconstrained (usual) ones.
A vector of length three with components:
udf |
The unconstrained degrees of freedom, i.e. the rank plus any dispersion parameter for |
odf |
The observed degrees of freedom, that is |
edf |
The expected degrees of freedom estimated by simulation as described in the details section. For any other object inheriting from |
For cirls
objects, the vector includes the simulated distribution of the number of active constraints as an actfreq
attribute.
This function is implemented mainly for cirls objects and can return idiosyncratic results for other objects inheriting from lm
. In this case, it will attempt to retrieve an 'edf' value, but simply return the rank of the model if this fails. For glm
models for instance, it will return thrice the same value.
Meyer, M.C., 2013. Semi-parametric additive constrained regression. Journal of Nonparametric Statistics 25, 715–730. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/10485252.2013.797577")}
logLik.cirls which internally calls edf
to compute degrees of freedom.
# Simulate a simple dataset
set.seed(5)
x <- rnorm(100)
y <- x + rnorm(100)
#### Model with a sensible constraint
# Reduces edf compared to udf as the constraint is sometimes active
mod1 <- glm(y ~ x, method = "cirls.fit", Cmat = list(x = 1), lb = 1)
edf(mod1)
#### Model with an almost surely binding constraint
# In this case edf is very close to odf as the constraint is often active
mod2 <- glm(y ~ x, method = "cirls.fit", Cmat = list(x = 1), lb = 1.5)
edf(mod2)
#### Model with an irrelevant constraint
# Here the constraint is useless and edf is equal to unconstrained df
mod3 <- glm(y ~ x, method = "cirls.fit", Cmat = list(x = 1), lb = -5)
edf(mod3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.