cv.nc.hdqr {hdqr} | R Documentation |
Cross-validation for Selecting the Tuning Parameter of Nonconvex Penalized Quantile Regression
Description
Conducts k-fold cross-validation for the 'nc.hdqr()' function.
Usage
cv.nc.hdqr(x, y, lambda = NULL, tau, nfolds = 5L, foldid, ...)
Arguments
x |
A numerical matrix with dimensions ( |
y |
Response variable. |
lambda |
Optional user-supplied sequence of |
tau |
The quantile level ( |
nfolds |
Number of folds in the cross-validation, default is 5. |
foldid |
An optional vector that assigns each observation to a specific fold.
If provided, this parameter overrides |
... |
Additional arguments passed to |
Details
This function estimates the average cross-validation error and its standard error across folds. It is primarily used to
identify the optimal lambda
value for fitting nonconvex penalized quantile regression models.
Value
An object of class cv.nc.hdqr
is returned,
which is a list with the ingredients of the cross-validated fit.
lambda |
the values of |
cvm |
the mean cross-validated error - a vector of length |
cvsd |
estimate of standard error of |
cvupper |
upper curve = |
cvlower |
lower curve = |
nzero |
number of non-zero coefficients at each |
name |
a text string indicating type of measure (for plotting purposes). |
nchdqr.fit |
a fitted |
lambda.min |
The optimal value of |
lambda.1se |
The largest value of |
Examples
set.seed(315)
n <- 100
p <- 400
x <- matrix(data = rnorm(n * p, mean = 0, sd = 1), nrow = n, ncol = p)
beta_star <- c(c(2, 1.5, 0.8, 1, 1.75, 0.75, 0.3), rep(0, (p - 7)))
eps <- rnorm(n, mean = 0, sd = 1)
y <- x %*% beta_star + eps
tau <- 0.5
lam2 <- 0.01
lambda <- 10^(seq(1,-4, length.out=10))
cv.nc.fit <- cv.nc.hdqr(y=y, x=x, tau=tau, lambda=lambda, lam2=lam2, pen="scad")