Run cross-validation for the quantile lasso on a tau by lambda grid. For each tau, the lambda value minimizing the cross-validation error is reported.
cv_quantile_lasso(
x,
y,
tau,
lambda = NULL,
nlambda = 30,
lambda_min_ratio = 0.001,
weights = NULL,
no_pen_vars = c(),
nfolds = 5,
train_test_inds = NULL,
intercept = TRUE,
standardize = TRUE,
lb = -Inf,
ub = Inf,
noncross = FALSE,
x0 = NULL,
lp_solver = c("glpk", "gurobi"),
time_limit = NULL,
warm_starts = TRUE,
params = list(),
transform = NULL,
inv_trans = NULL,
jitter = NULL,
verbose = FALSE,
sort = FALSE,
iso = FALSE,
nonneg = FALSE,
round = FALSE
)
Number of cross-validation folds. Default is 5.
List of length two, with components named train
and test
. Each of train
and test
are themselves lists,
of the same length; for each i
, we will consider train[[i]]
the indices (which index the rows of x
and elements of y
) to
use for training, and test[[i]]
as the indices to use for testing
(validation). The validation error will then be summed up over all
i
. This allows for fine control of the "cross-validation" process
(in quotes, because there need not be any crossing going on here). Default
is NULL; if specified, takes priority over nfolds
.
A list with the following components:
A quantile_lasso
object obtained by fitting on the
full training set, at all quantile levels and their corresponding optimal
lambda values
Matrix of cross-validation errors (as measured by quantile loss), of dimension (number of tuning parameter values) x (number of quantile levels)
Vector of optimum lambda values, one per quantile level
All arguments through verbose
(except for nfolds
and
train_test_inds
) are as in quantile_lasso_grid
and
quantile_lasso
. Note that the noncross
and x0
arguments are not passed to quantile_lasso_grid
for the calculation
of cross-validation errors and optimal lambda values; they are only passed
to quantile_lasso
for the final object that is fit to the full
training set. Past verbose
, the arguments are as in
predict.quantile_lasso
, and control what happens with the
predictions made on the validation sets. The associated predict
function is just that for the cv_quantile_genlasso
class.