Title Cross validation for consistent variable selection across multiple quantiles.
rq.gq.pen.cv(
x = NULL,
y = NULL,
tau = NULL,
lambda = NULL,
nfolds = 10,
cvFunc = c("rq", "se"),
tauWeights = NULL,
foldid = NULL,
printProgress = FALSE,
weights = NULL,
...
)
An rq.pen.seq.cv object.
Matrix of cvSummary function, default is average, cross-validation error for each model, tau and a combination, and lambda.
Matrix of the standard error of cverr foreach model, tau and a combination, and lambda.
The rq.pen.seq object fit to the full data.
Let blank, unlike rq.pen.seq.cv() or rq.group.pen.cv(), because optmizes the quantiles individually does not make sense with this penalty.
A data.table for the combination of a and lambda that minimize the cross validation error across all tau.
Group, across all quantiles, cross-validation error results for each value of a and lambda.
Original call to the function.
covariate matrix. Not needed if model_obj
is supplied.
univariate response. Not needed if model_obj
is supplied.
a sequence of tau to be modeled, must be at least of length 3.
Values of \(\lambda\). Default will automatically select the \(\lambda\) values.
number of folds
loss function to be evaluated for cross-validation. Supported loss functions include quantile ("rq") and squared loss("se"). Default is the quantile loss.
weights for different quantiles in calculating the cv error. Default is equal weight.
indices of pre-split testing obervations
If set to TRUE prints which partition is being worked on.
Weights for the quantile loss objective function.
other arguments for rq.gq.pen.cv
sent to rq.gq.pen
Shaobo Li and Ben Sherwood, ben.sherwood@ku.edu
Let \(y_{b,i}\) and \(x_{b,i}\) index the observations in fold b. Let \(\hat{\beta}_{\tau,a,\lambda}^{-b}\) be the estimator for a given quantile and tuning parameters that did not use the bth fold. Let \(n_b\) be the number of observations in fold b. Then the cross validation error for fold b is $$\mbox{CV}(b,\tau) = \sum_{q=1}^Q \frac{1}{n_b} \sum_{i=1}^{n_b} m_{b,i}v_q \rho_\tau(y_{b,i}-x_{b,i}^\top\hat{\beta}_{\tau_q,a,\lambda}^{-b}).$$ Where, \(m_{b,i}\) is the weight for the ith observation in fold b and \(v_q\) is a quantile specific weight. Note that \(\rho_\tau()\) can be replaced squared error loss. Provides results about how the average of the cross-validation error changes with \(\lambda\). Uses a Huber approximation in the fitting of model, as presented in Sherwood and Li (2022).
heteroIdQRrqPen
huberGrouprqPen
if (FALSE) {
n<- 200
p<- 10
X<- matrix(rnorm(n*p),n,p)
y<- -2+X[,1]+0.5*X[,2]-X[,3]-0.5*X[,7]+X[,8]-0.2*X[,9]+rt(n,2)
taus <- seq(0.1, 0.9, 0.2)
cvfit<- rq.gq.pen.cv(x=X, y=y, tau=taus)
cvCoefs <- coefficients(cvfit)
}
Run the code above in your browser using DataLab