cv.kqr {fastkqr} | R Documentation |
cross-validation for selecting the tuning parameter of kernel quantile regression
Description
Performs k-fold cross-validation for [kqr()]. This function is largely similar [glmnet::cv.glmnet()].
Usage
cv.kqr(x, y, tau, lambda = NULL, sigma = NULL, nfolds = 5L, foldid, ...)
Arguments
x |
A numerical input matrix. The dimension is |
y |
Response variable. |
tau |
A user-supplied |
lambda |
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.kqr()] is returned, which is a list with the components describing the cross-validation error.
lambda |
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
lambda <- 10^(seq(1, -4, length.out=10))
cv.fit <- cv.kqr(x, y, lambda=lambda, tau=0.1)