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 n rows and p columns.

y

Response variable.

tau

A user-supplied tau value for a quantile level.

lambda

A user-supplied lambda sequence.

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, nfolds is overridden.

...

Additional arguments passed into kqr

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 lambda candidate values.

cvm

Mean cross-validation error.

cvsd

Estimates of standard error of cross-validation error.

cvup

The upper curve: cvm + cvsd.

cvlo

The lower curve: cvm - cvsd.

lambda.min

The lambda incurring the minimum cross-validation error.

lambda.1se

The largest lambda whose error is within one standard error of the minimum.

cv.min

The cross-validation error at lambda.min.

cv.1se

The cross-validation error at lambda.1se.

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)

[Package fastkqr version 1.0.0 Index]