Tutorials › Statistical Learning (Graduate) › Higher-Order Kernels and Negative Estimates

Nonparametric Density Estimation · Tutorial 601 of 989

Higher-Order Kernels and Negative Estimates

Learn how higher-order moment constraints reduce kernel-estimation bias, why they force signed kernels, and why the resulting estimates need not be nonnegative densities.

Intermediate 10 min read

What You'll Learn

  • Define an even-order kernel through its moments and identify the leading bias term.
  • Derive the pointwise bias expansion under explicit smoothness and integrability conditions.
  • Verify the normalization and moments of a fourth-order signed kernel.
  • Explain why a nonnegative kernel cannot cancel its second moment.
  • Calculate a kernel density estimate that is negative at a point despite integrating to one.
  • Distinguish a normalized estimator from a nonnegative probability density.

Why Use Higher-Order Kernels?

Kernel density estimation smooths the empirical distribution by replacing each observation with a rescaled kernel. For a conventional symmetric, nonnegative kernel, the leading smoothing bias is typically proportional to \(h^2\), where \(h\) is the bandwidth. If the density is sufficiently smooth, a kernel with additional vanishing moments can cancel that leading term and make the bias shrink faster as \(h\) decreases.

The cancellation has a cost. A nonnegative kernel with total integral one cannot have a zero second moment: its squared argument is nonnegative, so that moment can vanish only if all its mass is concentrated at zero. Higher-order kernels therefore must take negative values somewhere. Their kernel density estimates still integrate to one under ordinary conditions, but they can be negative at particular points and so need not be probability densities in the usual nonnegative sense.

Definition and Bias Expansion

Let \(X_1,\ldots,X_n\) be independent observations from a density \(f\). For a bandwidth \(h>0\) and an integrable kernel \(K\), define the kernel density estimator by

$$ \hat f_h(x)=\frac{1}{nh}\sum_{i=1}^n K\!\left(\frac{x-X_i}{h}\right). $$

The \(j\)th kernel moment is \(\mu_j(K)=\int_{\mathbb R}u^jK(u)\,du\), when this integral exists. A kernel may be signed; its normalization condition is \(\mu_0(K)=\int K(u)\,du=1\). For an even integer \(p\geq 2\), the following definition describes a kernel whose first nonzero moment after normalization is of order \(p\).

Definition: A kernel \(K\) is of order \(p\), for even \(p\), if \(\int K(u)\,du=1\), \(\int u^jK(u)\,du=0\) for every \(j=1,\ldots,p-1\), and \(\mu_p(K)\neq 0\). For the bias expansion below, we also require \(\int |u|^p|K(u)|\,du<\infty\). A symmetric kernel has all its odd moments equal to zero when those moments exist.

For an order-\(p\) kernel, the vanishing moments remove the Taylor terms of degrees \(1\) through \(p-1\) from the expectation of the estimator. The next result makes that statement precise. The global derivative conditions are convenient sufficient conditions for justifying the remainder integral.

Theorem: Suppose \(K\) is an order-\(p\) kernel with \(\int |u|^p|K(u)|\,du<\infty\). Suppose \(f\) is a bounded density with bounded derivatives through order \(p\), and \(f^{(p)}\) is continuous at the point \(x\). Then, as \(h\to0\), $$ E[\hat f_h(x)]-f(x) = \frac{h^p\mu_p(K)}{p!}f^{(p)}(x)+o(h^p). $$

Proof. Since the observations have density \(f\), a change of variable gives

$$ E[\hat f_h(x)] =\frac{1}{h}E\!\left[K\!\left(\frac{x-X_1}{h}\right)\right] =\int_{\mathbb R}K(u)f(x-hu)\,du. $$

The integral is well-defined because \(f\) is bounded and \(K\) is absolutely integrable. Taylor's formula through order \(p\) gives

$$ f(x-hu)=\sum_{j=0}^{p}\frac{(-hu)^j}{j!}f^{(j)}(x)+R_h(u). $$

For each fixed \(u\), continuity of \(f^{(p)}\) at \(x\) implies \(R_h(u)/h^p\to0\). Boundedness of \(f^{(p)}\), using the integral form of the Taylor remainder, also gives \(|R_h(u)|/h^p\leq C|u|^p\) for a constant \(C\) independent of \(h\) and \(u\). Thus \(|K(u)R_h(u)|/h^p\) is bounded by an integrable function, \(C|u|^p|K(u)|\). The dominated convergence theorem therefore yields \(\int K(u)R_h(u)\,du=o(h^p)\). Integrating the Taylor polynomial, the \(j=0\) term is \(f(x)\); the terms for \(1\leq j<p\) vanish by the moment conditions; and the \(j=p\) term is \((-1)^ph^p\mu_p(K)f^{(p)}(x)/p!\). Since \(p\) is even, \((-1)^p=1\). This proves the expansion. \(\square\)

Worked Example: The Leading Bias With a Gaussian Kernel

Let both the kernel and the true density be the standard normal density \(\phi\), and evaluate the estimator's expectation at \(x=0\). The Gaussian kernel has \(\mu_2(K)=1\), and \(f''(0)=-\phi(0)\). The second-order bias expansion therefore gives

$$ E[\hat f_h(0)]-f(0) = -\frac{\phi(0)}{2}h^2+o(h^2). $$

For a direct check, the expected estimator is the density at zero of a \(N(0,1+h^2)\) random variable: adding Gaussian smoothing with variance \(h^2\) to a \(N(0,1)\) density gives that convolution. Hence

$$ E[\hat f_h(0)] = \frac{1}{\sqrt{2\pi(1+h^2)}} = \phi(0)(1+h^2)^{-1/2}. $$

At \(h=0.2\), \(h^2=0.04\), so the exact expectation is \(\phi(0)/\sqrt{1.04}\), while the target is \(\phi(0)\). The bias is \(\phi(0)(1/\sqrt{1.04}-1)\), approximately \(-0.00775\). The leading-term approximation is \(-\phi(0)(0.04)/2\), also approximately \(-0.00798\). The difference between these values is consistent with a leading expansion, not an exact equality at a fixed bandwidth.

Why Higher-Order Kernels Must Be Signed

The reason negative values arise is already contained in the second-moment condition. This fact does not depend on a particular kernel formula.

Result: If \(K\) is a nonnegative integrable function with \(\int K(u)\,du=1\), then \(\int u^2K(u)\,du>0\), provided the second moment exists. In particular, no such kernel can satisfy the order-four condition \(\mu_2(K)=0\).

Proof. If \(K\geq0\), then \(u^2K(u)\geq0\), so its integral is nonnegative. If that integral were zero, the nonnegative function \(u^2K(u)\) would have to equal zero almost everywhere. Since \(u^2>0\) except at the single point \(u=0\), this would imply \(K(u)=0\) almost everywhere away from zero. A single point has Lebesgue measure zero, so an integrable function supported there almost everywhere has integral zero. That contradicts \(\int K(u)\,du=1\). Thus the second moment is strictly positive. Any order-four kernel must have zero second moment and consequently cannot be nonnegative almost everywhere. \(\square\)

Worked Example: Constructing a Fourth-Order Kernel

Let \(\phi\) denote the standard normal density and define

$$ K_4(u)=\frac{3-u^2}{2}\phi(u). $$

If \(Z\sim N(0,1)\), the moments of this kernel can be checked using \(E[Z^2]=1\), \(E[Z^4]=3\), and \(E[Z^6]=15\). First,

$$ \mu_0(K_4)=\frac{3-E[Z^2]}{2}=\frac{3-1}{2}=1, \qquad \mu_2(K_4)=\frac{3E[Z^2]-E[Z^4]}{2}=\frac{3-3}{2}=0. $$

The kernel is symmetric, so \(\mu_1(K_4)=\mu_3(K_4)=0\). Its fourth moment is

$$ \mu_4(K_4) = \frac{3E[Z^4]-E[Z^6]}{2} = \frac{9-15}{2} = -3. $$

Thus \(K_4\) is a fourth-order kernel. Its sign is visible from its formula: \(\phi(u)>0\), while \(3-u^2<0\) whenever \(|u|>\sqrt{3}\). The fourth-order bias expansion has leading term \(-3h^4 f^{(4)}(x)/4!= -h^4 f^{(4)}(x)/8\). The negative coefficient is not an error; it follows from the kernel's negative fourth moment.

A Normalized Estimate Can Be Negative

For any integrable kernel with \(\int K=1\), the estimator integrates to one. Indeed, each summand has integral one after rescaling. This property alone does not make the estimator a density: a density must also be nonnegative almost everywhere. Signed kernels preserve the integral but do not guarantee nonnegativity.

Result: If \(K\) is absolutely integrable and \(\int K(u)\,du=1\), then for any finite sample and \(h>0\), $$ \int_{\mathbb R}\hat f_h(x)\,dx=1. $$ The estimator may nevertheless take negative values.

To verify the integral, use linearity and the change of variable \(u=(x-X_i)/h\), so \(dx=h\,du\). Absolute integrability justifies integrating each summand:

$$ \int_{\mathbb R}\hat f_h(x)\,dx = \frac1n\sum_{i=1}^n \int_{\mathbb R}\frac1h K\!\left(\frac{x-X_i}{h}\right)\,dx = \frac1n\sum_{i=1}^n\int_{\mathbb R}K(u)\,du = 1. $$

Worked Example: A Negative Fourth-Order Estimate

Take one observation \(X_1=0\), bandwidth \(h=1\), and the fourth-order kernel \(K_4\) above. At the evaluation point \(x=2\), the estimate is

$$ \hat f_1(2) = K_4(2) = \frac{3-4}{2}\phi(2) = -\frac12\frac{e^{-2}}{\sqrt{2\pi}} \approx -0.026995. $$

The negative sign follows exactly from \(3-2^2=-1\); the displayed decimal is rounded to six places. Yet the estimate integrates to one, since it is a translated copy of a kernel with integral one. It is therefore a normalized signed estimate, not a nonnegative density. This example is a direct illustration of the distinction between preserving total integral and satisfying all the requirements of a density.

Trade-Offs and a Common Pitfall

The bias expansion explains the attraction of higher-order kernels: when the required derivatives exist and the relevant leading derivative is nonzero, an order-\(p\) kernel reduces the leading pointwise bias from order \(h^2\) to order \(h^p\). This does not by itself guarantee a smaller overall estimation error. The bandwidth also affects variance, and the kernel's shape affects the variance constant. The bias expansion is local and asymptotic; it is not a claim that the estimate is closer to the truth at every point or for every sample.

A common mistake is to reason, “The estimate integrates to one, so it is a density and cannot be negative.” The correction is that normalization and nonnegativity are separate conditions. The integral calculation only establishes total signed mass one. With a higher-order kernel, negative contributions are needed to cancel low-order moments, and those contributions can make the estimated value negative. Truncating negative estimates at zero or renormalizing them may be useful for some purposes, but it changes the estimator; it does not show that the original estimate was nonnegative or that the modified estimate has the same bias expansion.

Key takeaway: Higher-order moment cancellation can reduce smoothing bias under sufficient smoothness, but a zero second moment is incompatible with a nonnegative normalized kernel. A higher-order kernel estimate may integrate to one while taking negative values, so it need not itself be a probability density.

Check Your Understanding

Use the definitions and calculations above to answer these questions.

  1. What moment conditions distinguish an order-four kernel from a normalized second-order kernel?
  2. Under the theorem's assumptions, what is the leading bias term for an order-\(p\) kernel at \(x\)?
  3. Why can a nonnegative integrable kernel with integral one not have a zero second moment?
  4. For \(K_4(u)=(3-u^2)\phi(u)/2\), identify the region where the kernel is negative.
  5. Why does an estimate that integrates to one still fail to be a density when it is negative on part of its domain?
Clinical Biostats