View source: R/f_nadaraya_watson_quantile.R
f_nadaraya_watson_quantile | R Documentation |
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.
f_nadaraya_watson_quantile(v_dep, v_expl, qt_trgt, bandwidth)
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 |
Numeric matrix with all the predicted values based on each quantile regression, where each column corresponds to a quantile target.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.