---
tag: 7H2639JPXJ
kind: definition
name: Kernel regression
msc: [62G08]
defines: 710VV73909
uses: [ZV65XMJ9A4, 0TTDGTEFMN, 0AJN7WHBJZ]
sources:
  - url: https://en.wikipedia.org/wiki/Kernel_regression
---

## Definition

Let $(X_1, Y_1), \dots, (X_n, Y_n)$ be [[i.i.d.|0AJN7WHBJZ]] pairs of real random variables with $E\abs{Y_1} < \infty$, and with regression function $m(x) = E[Y_1 \mid X_1 = x]$, a [[conditional expectation|0TTDGTEFMN]].
Let $K \colon \R \to [0, \infty)$ be a kernel as in [[kernel density estimation|ZV65XMJ9A4]], and let $h > 0$ be a bandwidth.
The *Nadaraya–Watson kernel regression estimator* of $m$ is
$$\hat m_h(x) = \frac{\sum_{i=1}^{n} K\big((x - X_i)/h\big)\, Y_i}{\sum_{i=1}^{n} K\big((x - X_i)/h\big)},$$
defined at each $x$ where the denominator is not $0$.

## Remarks

The weights $K((x - X_i)/h) / \sum_j K((x - X_j)/h)$ are nonnegative and sum to $1$, so $\hat m_h(x)$ is a weighted average of the $Y_i$.
Dividing the numerator and the denominator by $nh$ shows the denominator is the kernel density estimate of the law of $X$ at $x$.
Example: with the box kernel $K = \frac{1}{2} \mathbf{1}_{[-1, 1]}$, $\hat m_h(x)$ is the plain average of the $Y_i$ with $\abs{X_i - x} \le h$.
Non-example: the numerator alone, divided by $nh$, estimates $m(x) f_X(x)$ rather than $m(x)$, where $f_X$ is the density of $X$.
Local polynomial regression generalizes this estimator; the Nadaraya–Watson estimator is the local constant case.
