f_nw_grid: Nadaraya-Watson nonparametric regression over a grid.

Description Usage Arguments Value Examples

View source: R/nw_xg.R

Description

Nadaraya-Watson nonparametric regression over a grid.

Usage

1
f_nw_grid(x, y, xg, h, k1 = dnorm, ...)

Arguments

x

vector with values for the regressor variable;

y

vector with values for the dependent variable;

xg

vector where the user wants to evaluate the estimator;

h

bandwidth (scalar);

k1

a kernel function;

...

specific parameters for k1.

Value

vector with the Nadaraya-Watson estimates at xg.

Examples

1
2
3
4
5
n <- 400
x <- runif(n, -1, 1)
e <- rnorm(n, 0, 0.5)
y <- sin(2.5 * pi * x) + e
f_nw_grid(x = x, y = y, xg = x, h = 0.05)

hudtorrent/NPreg documentation built on Dec. 20, 2021, 4:53 p.m.