grouplasso_linreg_cv_fixedgrid: Choose tuning parameters by crossvalidation for grouplasso...

View source: R/grouplasso.R

grouplasso_linreg_cv_fixedgridR Documentation

Choose tuning parameters by crossvalidation for grouplasso linreg when given a fixed grid of lambda values

Description

Choose tuning parameters by crossvalidation for grouplasso linreg when given a fixed grid of lambda values

Usage

grouplasso_linreg_cv_fixedgrid(
  Y,
  X,
  groups,
  lambda.seq,
  n.folds,
  b.init.mat,
  w,
  tol = 0.001,
  maxiter = 500
)

Arguments

Y

the response vector

X

matrix containing the design matrices

groups

a vector indicating to which group each covariate belongs

lambda.seq

sequence of lambda values

n.folds

the number of crossvalidation folds

w

group-specific weights for different penalization of different groups

tol

the convergence tolerance

maxiter

the maximum number of iterations allowed for each fit

b.init.arr

array of initial values for beta

Value

a list containing the fits over a grid of lambda values as well as the vector of lambda values

Examples

grouplasso_linreg_data <- get_grouplasso_data(n = 400, response = "continuous")

grouplasso_linreg_grid.out <- grouplasso_linreg_grid(Y = grouplasso_linreg_data$Y,
                                                     X = grouplasso_linreg_data$X,
                                                     groups = grouplasso_linreg_data$groups,
                                                     n.lambda = 25,
                                                     lambda.min.ratio = 0.001,
                                                     lambda.max.ratio = 0.1,
                                                     w = grouplasso_linreg_data$w,
                                                     tol = 1e-3,
                                                     maxiter = 500,
                                                     report.prog = FALSE)

grouplasso_linreg_cv_fixedgrid.out <- grouplasso_linreg_cv_fixedgrid(Y = grouplasso_linreg_data$Y,
                                                                     X = grouplasso_linreg_data$X,
                                                                     groups = grouplasso_linreg_data$groups,
                                                                     lambda.seq = grouplasso_linreg_grid.out$lambda.seq,
                                                                     n.folds = 5,
                                                                     b.init.mat = grouplasso_linreg_grid.out$b.mat,
                                                                     w = grouplasso_linreg_data$w,
                                                                     tol = 1e-3,
                                                                     maxiter = 500)

gregorkb/semipadd2pop documentation built on Oct. 2, 2022, 1:37 p.m.