estimate_risk {sparsegl} | R Documentation |
Calculate information criteria.
Description
This function uses the degrees of freedom to calculate various information
criteria. This function uses the "unknown variance" version of the likelihood.
Only implemented for Gaussian regression. The constant is ignored (as in
stats::extractAIC()
).
Usage
estimate_risk(object, x, type = c("AIC", "BIC", "GCV"), approx_df = FALSE)
Arguments
object |
fitted object from a call to |
x |
Matrix. The matrix of predictors used to estimate
the |
type |
one or more of AIC, BIC, or GCV. |
approx_df |
the |
Value
a data.frame
with as many rows as object$lambda
. It contains
columns lambda
, df
, and the requested risk types.
References
Vaiter S, Deledalle C, Peyré G, Fadili J, Dossal C. (2012). The Degrees of Freedom of the Group Lasso for a General Design. https://arxiv.org/abs/1212.6478.
See Also
sparsegl()
method.
Examples
n <- 100
p <- 20
X <- matrix(rnorm(n * p), nrow = n)
eps <- rnorm(n)
beta_star <- c(rep(5, 5), c(5, -5, 2, 0, 0), rep(-5, 5), rep(0, (p - 15)))
y <- X %*% beta_star + eps
groups <- rep(1:(p / 5), each = 5)
fit1 <- sparsegl(X, y, group = groups)
estimate_risk(fit1, type = "AIC", approx_df = TRUE)