llqrcv: Cross-Validation for bandwidth selection of local linear...

View source: R/llqrcv.R

llqrcvR Documentation

Cross-Validation for bandwidth selection of local linear quantile regression

Description

llqrcv estimates the bandwidth necessary for the local linear fit of the τth conditional quantile of y given x. The estimation is performed using the Cross-Validation criterion.

Usage

llqrcv(x, y, tau = 0.5)

Arguments

x

A design matrix (n x p). The rows represent observations and the columns represent predictor variables.

y

A vector of the response variable.

tau

A quantile level, a number strictly between 0 and 1.

Details

A grid of bandwidth values is created and the local linear fit is estimated using all the data points except for one point, which is used to make the prediction. This procedure is repeated n times, where n is the number of observations. Then, the bandwidth is selected as the one with the smallest average error.

When the dimension of the predictor variable is large compared with the sample size, local linear fitting meets the 'curse of dimensionality' problem. In situations like that, the grid bandwidth values might be too small and cause the function to fail. For these cases, we advice the user to directly use the llqr function of the package and specify a bandwidth in the function.

Value

llqrcv returns the optimal bandwidth selected using Cross-Validation criterion for the local linear fit of the τth conditional quantile of y given x.

Examples

set.seed(1234)
n <- 100
x <- rnorm(n)
error <- rnorm(n)
y <- x^2 + error
tau <- 0.5
llqrcv(x, y, tau = tau)

quantdr documentation built on May 9, 2022, 5:08 p.m.