Learn R Programming

midasml (version 0.0.6)

reg_sgl: Linear sg-LASSO regression

Description

Fits sg-LASSO least squares regression model. Options include cross-validation and information criteria for \(\lambda\) penalty parameter selection.

Usage

reg_sgl(X, y, index, gamma_w = NULL, full_est = NULL, 
  method_choice = c("ic", "cv", "initial"), nlam = 100, lambdas = NULL, 
  min_frac = NULL, nfolds = 10, lambda_choice = c("min", "1se"), 
  ic_choice = c("bic", "aic", "aicc"), num_cores = NULL, verbose = FALSE, 
  thresh = NULL, outer_thresh = NULL, inner_iter = NULL, outer_iter = NULL)

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 vector of outcome.

index

p by 1 vector indicating group membership of each covariate.

gamma_w

sg-LASSO mixing parameter. gamma_w = 1 is LASSO and gamma_w = 0 group LASSO.

full_est

pre-estimated parameters based on full sample and regress_choice for a sequence of \(\lambda\)'s.

method_choice

choose between `initial`, `ic` and `cv`. `initial` pre-computes initial estimates. `ic` comptes solution based on information criteria (BIC, AIC or AICc). `cv` computes solution based on cross-validation (cv).

nlam

number of \(\lambda\)'s to use in the regularization path.

lambdas

user specified sequence of \(\lambda\) values for fitting. We recommend leaving this to NULL and letting function to self-select values.

min_frac

the minimum value of the penalty parameter, as a fraction of the maximum value.

nfolds

number of folds of the cv loop.

lambda_choice

chose between `min` and `1se`. `min` computes solution that minimizes the cv error. `1se` computes solution such that the cv error is within 1 standard error of the minimum `min`.

ic_choice

choose between `bic`, `aic` and `aicc`. `bic` computes solution that minimizes Bayesian information criterion. `aic` computes solution that minimizes Akaike information criterion. `aicc` omputes solution that minimizes Akaike information corrected criterion.

num_cores

number of cores used to compute cv loop.

verbose

flag to print information.

thresh

convergence threshold for change in beta. We recommend leaving this to NULL.

outer_thresh

outer loop convergence threshold. We recommend leaving this to NULL.

inner_iter

the maximum number of inner sg-LASSO loop iterations. We recommend leaving this to NULL.

outer_iter

the maximum number of outer sg-LASSO loop iterations. We recommend leaving this to NULL.

Value

Parameter estimates of linear regression model under sg-LASSO penalty.

Details

Examples

Run this code
# NOT RUN {
set.seed(1)
x = matrix(rnorm(100 * 20), 100, 20)
y = rnorm(100)
index = 1:20
reg_sgl(X = x, y = y, index = index, gamma_w = 1, method_choice = "initial", 
  num_cores = 2, verbose = FALSE, lambdas = c(1,2,3))
# }

Run the code above in your browser using DataLab