Kernel density estimation: bias, variance and pointwise risk
Archive 2011–2014
Density estimation
Kernel methods
From the empirical distribution function to the Parzen–Rosenblatt estimator, and why its pointwise risk is of order n^(-2β/(2β+1)).
Author
Maikol Solís
Published
December 22, 2011
Modified
November 30, 2026
This post belongs to a series of study notes I first published in 2011, at the start of my PhD. I revised it in 2026: the mathematics was checked and corrected and the text rewritten. The results and proofs follow Tsybakov (2009, sec. 1.2); the presentation and comments are mine.
The histogram posts showed a first nonparametric density estimator and its bias–variance trade-off. The histogram has two weaknesses: it is a step function, and it depends on where the bins start. Kernel estimators fix both, and they are the subject of this post.
From the distribution function to a density estimator
Let \(X_1, \ldots, X_n\) be i.i.d. real random variables with density \(p\) and distribution function \(F(x) = \int_{-\infty}^{x} p(t)\,dt\). The empirical distribution function
with \(K_0(u) = \frac12 \mathbf{1}(-1 < u \le 1)\). It counts the observations in a window of width \(2h\)centered at \(x\). Unlike the histogram, the window moves with \(x\), so there is no arbitrary origin. The estimate is still discontinuous, because \(K_0\) is.
The kernel estimator
Replacing \(K_0\) by a general function \(K\) gives the kernel (Parzen–Rosenblatt) estimator:
where \(K : \mathbb{R} \to \mathbb{R}\) is integrable with \(\int K(u)\,du = 1\). \(K\) is the kernel and \(h > 0\) the bandwidth, which in practice depends on \(n\). If \(K \ge 0\), then \(\hat p_n\) is itself a density. We will see below that allowing \(K\) to take negative values can reduce the bias.
To control it we need two assumptions: \(p\) must be smooth, and \(K\) must cancel the low-order terms of a Taylor expansion of \(p\).
In what follows, \(\lfloor \beta \rfloor\) denotes the largest integer strictly smaller than\(\beta\). For example, \(\lfloor 2 \rfloor = 1\) and \(\lfloor 2.5 \rfloor = 2\). This is not the usual integer part, and the convention matters when \(\beta\) is an integer.
Definition 1 (Hölder class) Let \(T \subseteq \mathbb{R}\) be an interval and \(\beta, L > 0\), and set \(\ell = \lfloor \beta \rfloor\). The Hölder class \(\Sigma(\beta, L)\) on \(T\) is the set of \(\ell\) times differentiable functions \(f : T \to \mathbb{R}\) such that \[
\big|f^{(\ell)}(x) - f^{(\ell)}(x')\big| \le L\,|x - x'|^{\beta-\ell},
\qquad
\forall\, x, x' \in T.
\]
For \(0 < \beta \le 1\) this is the usual Hölder (or Lipschitz, if \(\beta = 1\)) condition on \(f\) itself. For larger \(\beta\) it says that \(f\) has \(\ell\) derivatives and the last one is Hölder of order \(\beta - \ell \in (0, 1]\).
Definition 2 (Kernel of order \(\ell\)) Let \(\ell \ge 1\) be an integer. \(K\) is a kernel of order \(\ell\) if \(u \mapsto u^j K(u)\) is integrable for \(j = 1, \ldots, \ell\) and \[
\int K(u)\,du = 1, \qquad \int u^j K(u)\,du = 0, \quad j = 1, \ldots, \ell .
\]
Every symmetric kernel with a finite first moment is of order 1, so all the kernels in the table are of order 1, and also of order 2 thanks to symmetry. A non-negative kernel cannot be of order 2 or higher, because \(\int u^2 K(u)\,du > 0\). Higher-order kernels must take negative values.
Some authors say instead that \(K\) has order \(\ell + 1\) when the conditions above hold and \(\int u^{\ell+1} K(u)\,du \neq 0\). Always check which convention a reference uses.
Define the class of densities
\[
\mathcal{P}(\beta, L)
= \Big\{ p : p \ge 0,\ \int p(x)\,dx = 1,\ p \in \Sigma(\beta, L) \text{ on } \mathbb{R} \Big\}.
\]
Proposition 2 Let \(p \in \mathcal{P}(\beta, L)\) and let \(K\) be a kernel of order \(\ell = \lfloor \beta \rfloor\) with \(\int |u|^\beta |K(u)|\,du < \infty\). Then for all \(x_0 \in \mathbb{R}\), \(h > 0\) and \(n \ge 1\), \[
|b(x_0)| \le C_2\, h^\beta,
\qquad
C_2 = \frac{L}{\ell!}\int |u|^\beta |K(u)|\,du .
\]
Proof. If \(\ell \ge 1\), Taylor’s theorem with Lagrange remainder gives, for some \(\tau = \tau(u) \in [0, 1]\), \[
p(x_0 + uh) = p(x_0) + p'(x_0)\,uh + \cdots
+ \frac{(uh)^{\ell-1}}{(\ell - 1)!}\,p^{(\ell-1)}(x_0)
+ \frac{(uh)^\ell}{\ell!}\,p^{(\ell)}(x_0 + \tau uh).
\] Substitute this into \(b(x_0) = \int K(u)[p(x_0 + uh) - p(x_0)]\,du\). The kernel has order \(\ell\), so the terms in \(u, \ldots, u^{\ell-1}\) integrate to zero. Since \(\int u^\ell K(u)\,du = 0\), we may also subtract \(\frac{(uh)^\ell}{\ell!}\,p^{(\ell)}(x_0)\) inside the integral without changing it: \[
b(x_0)
= \int K(u)\,\frac{(uh)^\ell}{\ell!}\Big[p^{(\ell)}(x_0 + \tau uh) - p^{(\ell)}(x_0)\Big]\,du .
\] By the Hölder condition, \(|p^{(\ell)}(x_0 + \tau uh) - p^{(\ell)}(x_0)| \le L\,|\tau uh|^{\beta-\ell} \le L\,|uh|^{\beta-\ell}\), hence \[
|b(x_0)| \le \int |K(u)|\,\frac{|uh|^\ell}{\ell!}\,L\,|uh|^{\beta-\ell}\,du
= C_2\, h^\beta .
\] If \(\ell = 0\) (\(\beta \le 1\)), the bound follows directly from \(|p(x_0 + uh) - p(x_0)| \le L|uh|^\beta\).
The smoother the density (larger \(\beta\)), the faster the bias vanishes as \(h \to 0\). To exploit that smoothness, the kernel’s order has to match it.
Upper bound on the pointwise risk
Bias and variance pull in opposite directions. A small \(h\) gives a large variance and a wiggly, undersmoothed estimate. A large \(h\) gives a large bias and an oversmoothed one. Under the assumptions of Proposition 1 and Proposition 2,
which gives \(\operatorname{MSE}(x_0) = O\big(n^{-\frac{2\beta}{2\beta+1}}\big)\) as \(n \to \infty\), uniformly in \(x_0\).
The bound is also uniform over the whole class. Densities in \(\mathcal{P}(\beta, L)\) are uniformly bounded by a constant depending only on \(\beta\) and \(L\)(see Tsybakov 2009, secs. 1.2.1, proof of Theorem 1.1), so \(p_{\max}\) can be taken the same for all of them. For any \(\alpha > 0\) and \(h = \alpha\, n^{-1/(2\beta+1)}\),
where \(C > 0\) depends only on \(\beta\), \(L\), \(\alpha\) and \(K\).
Two sanity checks:
With \(\beta = 1\) (Lipschitz densities), the rate is \(n^{-2/3}\), the same as the histogram we found in Histograms III.
As \(\beta \to \infty\), the rate approaches the parametric rate \(n^{-1}\) but never reaches it.
The next post moves from this pointwise risk to a global one, the MISE.
References
Further reading: Parzen (1962); Rosenblatt (1956).
Parzen, Emanuel. 1962. “On Estimation of a Probability Density Function and Mode.”The Annals of Mathematical Statistics 33 (3): 1065–76. https://doi.org/10.1214/aoms/1177704472.
Rosenblatt, Murray. 1956. “Remarks on Some Nonparametric Estimates of a Density Function.”The Annals of Mathematical Statistics 27 (3): 832–37. https://doi.org/10.1214/aoms/1177728190.
Tsybakov, Alexandre B. 2009. Introduction to Nonparametric Estimation. Springer.