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

y

Response variable.

tau

A user-supplied tau sequence.

lambda1

A user-supplied lambda1 value.

lambda2

A user-supplied lambda2 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 nckqr

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

[Package fastkqr version 1.0.0 Index]