f_nadaraya_watson_quantile {atRisk} | R Documentation |
Estimation of quantiles using the Nadaraya-Watson estimator with a product kernel
Description
This function performs quantile regression using the Nadaraya-Watson estimator with a product kernel. It computes the weights using a Gaussian kernel for each dimension of the explanatory variables and then estimates the quantile using a weighted average of the observed responses.
Usage
f_nadaraya_watson_quantile(v_dep, v_expl, qt_trgt, bandwidth)
Arguments
v_dep |
Numeric vector of the dependent variable |
v_expl |
Numeric vector or matrix of the (k) explanatory covariate(s) |
qt_trgt |
Numeric vector, dim k, of k quantiles for different qt-estimations |
bandwidth |
Numeric value specifying the bandwidth for the Gaussian kernel |
Value
Numeric matrix with all the predicted values based on each quantile regression, where each column corresponds to a quantile target.
Examples
# Data process
set.seed(123)
Y <- as.vector(rnorm(100))
X <- matrix(rnorm(200), ncol = 2)
quantile_target <- c(0.1, 0.5, 0.9)
bandwidth_value <- 0.5
results_qt <- f_nadaraya_watson_quantile(v_dep=Y,
v_expl=X,
qt_trgt=quantile_target,
bandwidth=bandwidth_value)
[Package atRisk version 0.2.0 Index]