llqrcv | R Documentation |
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.
llqrcv(x, y, tau = 0.5)
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. |
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.
llqrcv
returns the optimal bandwidth selected using
Cross-Validation criterion for the local linear fit of the τth
conditional quantile of y
given x
.
set.seed(1234) n <- 100 x <- rnorm(n) error <- rnorm(n) y <- x^2 + error tau <- 0.5 llqrcv(x, y, tau = tau)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.