tune_lambda_quantile() tunes a penalty profile once on the original design
and returns the selected penalty vector. The default grid rescales the
quantreg::LassoLambdaHat() profile rather than using a single scalar, which
keeps the tuning step aligned with the underlying quantile-lasso routine.
Usage
tune_lambda_quantile(
x,
y = NULL,
tau = 0.5,
method = c("cv", "bic"),
rule = c("min", "one_se"),
lambda_factors = NULL,
lambda_inflation = 1,
nlambda = 20,
lambda_min_ratio = 0.05,
folds = 5,
repeats = 1,
selector = quantile_lasso_selector,
standardize = TRUE,
eps = 1e-06,
seed = NULL,
data = NULL,
subset = NULL,
na.action = stats::na.fail,
verbose = interactive(),
...
)Arguments
- x
Numeric design matrix or a formula.
- y
Numeric response vector when
xis a matrix.- tau
Quantile level in
(0, 1). Can be a vector.- method
One of
"cv"or"bic".- rule
Selection rule for choosing the tuned penalty from the candidate grid.
"min"takes the minimizer of the tuning score, while"one_se"applies the one-standard-error rule whenmethod = "cv".- lambda_factors
Optional positive multipliers applied to the default penalty profile.
- lambda_inflation
Optional multiplier applied after tuning to enforce a stronger penalty for selection than for prediction.
- nlambda
Number of tuning candidates when
lambda_factorsisNULL.- lambda_min_ratio
Smallest multiplier in the default grid.
- folds
Number of folds when
method = "cv".- repeats
Number of repeated fold assignments when
method = "cv".- selector
Function used to fit the sparse quantile model.
- standardize
Should tuning use the SelectBoost-normalized design?
- eps
Numerical tolerance used to count active coefficients for the BIC heuristic.
- seed
Optional random seed.
- data
Optional data frame used when
xis a formula.- subset
Optional subset expression used with the formula interface.
- na.action
Missing-data handler used with the formula interface.
- verbose
Should tuning report progress?
- ...
Additional arguments forwarded to
selector.
Examples
sim <- simulate_quantile_data(n = 60, p = 10, active = 1:3, seed = 2)
tuned <- tune_lambda_quantile(
sim$x,
sim$y,
tau = 0.5,
method = "bic",
nlambda = 6
)
tuned$factor
#> [1] 0.05