| group_lava | R Documentation |
Adjust a the group-lava regularized linear models, that is a lava transformation
of the data plus a mixture of either a (possibly weighted)
\ell_1/\ell_2- or
\ell_1/\ell_\infty-norm, and a (possibly
structured) \ell_2-norm (ridge-like). The solution path
is computed at a grid of values for the
\ell_1/\ell_q-penalty. See details for the criterion
optimized.
group_lava(
x,
y,
group,
type = c("l2", "coop", "linf"),
lambda1 = NULL,
lambda2 = 1,
weights = rep(1, nrow(x)),
penscale = sqrt(tabulate(group)),
struct = Matrix::Diagonal(ncol(x), 1),
intercept = TRUE,
normalize = TRUE,
refit = FALSE,
nlambda1 = ifelse(is.null(lambda1), 100, length(lambda1)),
minratio = 0.01,
maxfeat = ifelse(lambda2 < 0.01, min(nrow(x), ncol(x)), min(4 * nrow(x), ncol(x))),
beta0 = numeric(ncol(x)),
control = list()
)
x |
matrix of features, possibly sparsely encoded
(experimental). Do NOT include intercept. When normalized is
|
y |
response vector. |
group |
vector of integers indicating group belonging. Must
match the number of column in |
type |
string indicating whether the |
lambda1 |
sequence of decreasing |
lambda2 |
real scalar; tunes the |
weights |
vector with real positive values that weight the observations (like in weighted least square). Default sets all weights to 1. |
penscale |
vector with real positive values that weight the penalty of each feature. Default sets all weights to 1. |
struct |
matrix structuring the coefficients, possibly
sparsely encoded. Must be at least positive semidefinite (this is
checked internally). If |
intercept |
logical; indicates if an intercept should be
included in the model. Default is |
normalize |
logical; indicates if variables should be
normalized to have unit L2 norm before fitting. Default is
|
refit |
logical: indicates if the non null coefficients should be refit to avoid excessive bias. Default is FALSE. Can be changed later (both raw and refit coefficients are stored). |
nlambda1 |
integer that indicates the number of values to put
in the |
minratio |
minimal value of |
maxfeat |
integer; limits the number of features ever to
enter the model; i.e., non-zero coefficients for the Elastic-net:
the algorithm stops if this number is exceeded and |
beta0 |
a starting point for the vector of parameter. By default, will initialized zero. May save time in some situation. |
control |
list of argument controlling low level options of the algorithm –use with care and at your own risk– :
|
The optimized criterion is the following:
θhat
λ1,λ2 =
argminθ = β+δ 1/2n RSS(β + δ) + λ1
Ωg(β) + λ2/2 δT S
δ,
where \Omega_g is the group-wise mixed norm:
\ell_1/\ell_2 (Group-LAVA) or
\ell_1/\ell_\infty, controlled by the type argument.
The \ell_2 structuring matrix S is provided via struct.
an object with class GroupLavaFit, inheriting from QuadrupenFit.
Chernozhukov, Victor, Christian Hansen, and Yuan Liao. "A lava attack on the recovery of sums of dense and sparse signals." The Annals of Statistics (2017): 39-76. doi:10.1214/16-AOS1434
## Simulating multivariate Gaussian with blockwise correlation
## and piecewise constant vector of parameters
beta <- rep(c(0,1,0,-1,0), c(25,10,25,10,25))
delta <- runif(sum(c(25,10,25,10,25)),-.1,.1)
grp <- rep(1:5, c(25,10,25,10,25))
cor <- 0.75
Soo <- toeplitz(cor^(0:(25-1))) ## Toeplitz correlation for irrelevant variables
Sww <- matrix(cor,10,10) ## bloc correlation between active variables
Sigma <- Matrix::bdiag(Soo,Sww,Soo,Sww,Soo)
diag(Sigma) <- 1
n <- 50
x <- as.matrix(matrix(rnorm(95*n),n,95) %*% chol(Sigma))
y <- 10 + x %*% beta + rnorm(n,0,10)
labels <- rep("irrelevant", length(beta))
labels[beta != 0] <- "relevant"
## Not run:
## Standard Group-Lasso
plot(group_lava(x,y,grp), label=labels)
plot(group_lava(x,y,grp, lambda2=.5), label=labels)
plot(group_lava(x,y,grp, lambda2=10), label=labels)
plot(group_lava(x,y,grp, lambda2=10,struct=solve(Sigma)), label=labels)
## L1/LINF Group-Lasso
plot(group_lava(x, y, grp, type = "linf"), label=labels)
plot(group_lava(x, y, grp, type = "linf", lambda2=.5), label=labels)
plot(group_lava(x, y, grp, type = "linf", lambda2=10), label=labels)
plot(group_lava(x, y, grp, type = "linf", lambda2=10,struct=solve(Sigma)), label=labels)
## Cooperative-Lasso
plot(group_lava(x, y, grp, type = "coop"), label=labels)
plot(group_lava(x, y, grp, type = "coop", lambda2=.5), label=labels)
plot(group_lava(x, y, grp, type = "coop", lambda2=10), label=labels)
plot(group_lava(x, y, grp, type = "coop", lambda2=10,struct=solve(Sigma)), label=labels)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.