Computes the kernel-weighted local mean estimator
m-hat(x) = sum K_h(x - X_i) Y_i divided by sum K_h(x - X_i),
with a Gaussian kernel.
Usage
nw_regression(x, y, x_eval, bandwidth)
Arguments
- x
Numeric vector of observed covariate values, length n.
- y
Numeric vector of observed outcomes, length n.
- x_eval
Numeric vector of evaluation points.
- bandwidth
Positive bandwidth h.
Value
Numeric vector of fitted values at x_eval.
References
Nadaraya, E. A. (1964). On Estimating Regression.
Theory of Probability and Its Applications, 9(1), 141-142.