Learn R Programming

bbemkr (version 2.0)

NadarayaWatsonkernel: Nadaraya-Watson kernel estimator

Description

Nadaraya (1964) and Watson (1964) proposed to estimate m as a locally weighted average, using a kernel as a weighting function.

Usage

NadarayaWatsonkernel(x, y, h, gridpoint)

Arguments

x
A set of x observations.
y
A set of y observations.
h
Optimal bandwidth chosen by the user.
gridpoint
A set of gridpoints.

Value

gridpoint
A set of gridpoints.
mh
Density values corresponding to the set of gridpoints.

Details

$\frac{\sum^n_{i=1}K_h(x-x_i)y_i}{\sum^n_{j=1}K_h(x-x_j)}$, where $K$ is a kernel function with a bandwidth h.

References

M. Rosenblatt (1956) Remarks on some nonparametric estimates of a density function, The Annals of Mathematical Statistics, 27(3), 832-837.

E. Parzen (1962) On estimation of a probability density function and mode, The Annals of Mathematical Statistics, 33(3), 1065-1076.

E. A. Nadaraya (1964) On estimating regression, Theory of probability and its applications, 9(1), 141-142.

G. S. Watson (1964) Smooth regression analysis, Sankhya: The Indian Journal of Statistics (Series A), 26(4), 359-372.

Examples

Run this code
x = rnorm(100)
y = rnorm(100)
NadarayaWatsonkernel(x, y, h = 2, gridpoint = seq(-3, 3, length.out = 100))

Run the code above in your browser using DataLab