rq.gq.pen.cv: Title Cross validation for consistent variable selection...

View source: R/gqCvPen.R

rq.gq.pen.cvR Documentation

Title Cross validation for consistent variable selection across multiple quantiles.

Description

Title Cross validation for consistent variable selection across multiple quantiles.

Usage

rq.gq.pen.cv(
  x = NULL,
  y = NULL,
  tau = NULL,
  lambda = NULL,
  nfolds = 10,
  cvFunc = c("rq", "se"),
  tauWeights = NULL,
  foldid = NULL,
  printProgress = FALSE,
  ...
)

Arguments

x

covariate matrix. Not needed if model_obj is supplied.

y

univariate response. Not needed if model_obj is supplied.

tau

a sequence of tau to be modeled, must be at least of length 3.

lambda

Values of \lambda. Default will automatically select the \lambda values.

nfolds

number of folds

cvFunc

loss function to be evaluated for cross-validation. Supported loss functions include quantile ("rq") and squared loss("se"). Default is the quantile loss.

tauWeights

weights for different quantiles in calculating the cv error. Default is equal weight.

foldid

indices of pre-split testing obervations

printProgress

If set to TRUE prints which partition is being worked on.

...

other arguments for rq.gq.pen.cv sent to rq.gq.pen

Details

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} \rho_\tau(y_{b,i}-x_{b,i}^\top\hat{\beta}_{\tau_q,a,\lambda}^{-b}).

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).

Value

An rq.pen.seq.cv object.

cverr:

Matrix of cvSummary function, default is average, cross-validation error for each model, tau and a combination, and lambda.

cvse:

Matrix of the standard error of cverr foreach model, tau and a combination, and lambda.

fit:

The rq.pen.seq object fit to the full data.

btr:

Let blank, unlike rq.pen.seq.cv() or rq.group.pen.cv(), because optmizes the quantiles individually does not make sense with this penalty.

gtr:

A data.table for the combination of a and lambda that minimize the cross validation error across all tau.

gcve:

Group, across all quantiles, cross-validation error results for each value of a and lambda.

call:

Original call to the function.

Author(s)

Shaobo Li shaobo.li@ku.edu and Ben Sherwood, ben.sherwood@ku.edu

References

\insertRef

heteroIdQRrqPen

\insertRef

huberGrouprqPen

Examples

## Not run:  
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)

## End(Not run)

bssherwood/rqpen documentation built on April 23, 2024, 9:50 a.m.