cv.nckqr {fastkqr} | R Documentation |
cross-validation for selecting the tuning parameter 'lambda2' of non-crossing kernel quantile regression
Description
Performs k-fold cross-validation for [nckqr()]. This function is largely similar [glmnet::cv.glmnet()].
Usage
cv.nckqr(
x,
y,
tau,
lambda1 = NULL,
lambda2 = NULL,
sigma = NULL,
nfolds = 5L,
foldid,
...
)
Arguments
x |
A numerical input matrix. The dimension is |
y |
Response variable. |
tau |
A user-supplied |
lambda1 |
A user-supplied |
lambda2 |
A user-supplied |
sigma |
Kernel bandwidth. |
nfolds |
The number of folds in cross-validation. Default is 5. |
foldid |
An optional vector which indexed the observations into each
cross-validation fold. If supplied, |
... |
Additional arguments passed into |
Details
The function computes the average cross-validation error and reports the standard error.
Value
An object of class [cv.nckqr()] is returned, which is a list with the components describing the cross-validation error.
lambda2 |
The |
cvm |
Mean cross-validation error. |
cvsd |
Estimates of standard error of cross-validation error. |
cvup |
The upper curve: |
cvlo |
The lower curve: |
lambda.min |
The |
lambda.1se |
The largest |
cv.min |
The cross-validation error at |
cv.1se |
The cross-validation error at |
Examples
library(MASS)
data(GAGurine)
x <- as.matrix(GAGurine$Age)
y <- GAGurine$GAG
ttau <- c(0.1, 0.3, 0.5)
l2_list <- 10^(seq(1, -4, length.out=10))
cvres <- cv.nckqr(x, y, ttau, lambda1 = 10, lambda2 = l2_list)