sglfit {midasml} | R Documentation |
Fits sg-LASSO regression
Description
Fits sg-LASSO regression model.
The function fits sg-LASSO regression model for a sequence of \lambda
tuning parameter and fixed \gamma
tuning parameter. The optimization is based on block coordinate-descent. Optionally, fixed effects are fitted.
Usage
sglfit(x, y, gamma = 1.0, nlambda = 100L, method = c("single", "pooled", "fe"),
nf = NULL, lambda.factor = ifelse(nobs < nvars, 1e-02, 1e-04),
lambda = NULL, pf = rep(1, nvars), gindex = 1:nvars,
dfmax = nvars + 1, pmax = min(dfmax * 1.2, nvars), standardize = FALSE,
intercept = FALSE, eps = 1e-08, maxit = 1000000L, peps = 1e-08)
Arguments
x |
T by p data matrix, where T and p respectively denote the sample size and the number of regressors. |
y |
T by 1 response variable. |
gamma |
sg-LASSO mixing parameter. |
nlambda |
number of |
method |
choose between 'single', 'pooled' and 'fe'; 'single' implies standard sg-LASSO regression, 'pooled' forces the intercept to be fitted, 'fe' computes the fixed effects. User needs to input the number of fixed effects |
nf |
number of fixed effects. Used only if |
lambda.factor |
The factor for getting the minimal |
lambda |
a user-supplied lambda sequence. By leaving this option unspecified (recommended), users can have the program compute its own |
pf |
the ℓ1 penalty factor of length |
gindex |
p by 1 vector indicating group membership of each covariate. |
dfmax |
the maximum number of variables allowed in the model. Useful for very large |
pmax |
the maximum number of coefficients allowed ever to be nonzero. For example, once βi ≠ 0 for some i ∈ [p], no matter how many times it exits or re-enters the model through the path, it will be counted only once. Default is |
standardize |
logical flag for variable standardization, prior to fitting the model sequence. The coefficients are always returned to the original scale. It is recommended to keep |
intercept |
whether intercept be fitted ( |
eps |
convergence threshold for block coordinate descent. Each inner block coordinate-descent loop continues until the maximum change in the objective after any coefficient update is less than thresh times the null deviance. Defaults value is |
maxit |
maximum number of outer-loop iterations allowed at fixed lambda values. Default is |
peps |
convergence threshold for proximal map of sg-LASSO penalty. Each loop continues until G group difference sup-norm, || βkG - βk-1G ||∞, is less than |
Details
The sequence of linear regression models implied by λ vector is fit by block coordinate-descent. The objective function is||y - ια - xβ||2T + 2λ Ωγ(β),
where ι∈RTenter> and ||u||2T=<u,u>/T is the empirical inner product. The penalty function Ωγ(.) is applied on β coefficients and is
Ωγ(β) = γ |β|1 + (1-γ)|β|2,1,
a convex combination of LASSO and group LASSO penalty functions.
Value
sglfit object.
Author(s)
Jonas Striaukas
Examples
set.seed(1)
x = matrix(rnorm(100 * 20), 100, 20)
beta = c(5,4,3,2,1,rep(0, times = 15))
y = x%*%beta + rnorm(100)
gindex = sort(rep(1:4,times=5))
sglfit(x = x, y = y, gindex = gindex, gamma = 0.5)