Simple Algorithm
Machine Learning · Convergence · 26 min

Kernel Density Estimation

Bandwidths, bias–variance and convergence rates.

Rosenblatt (1956) and Parzen (1962) introduced the kernel density estimator and the first theory of its accuracy, and the questions they raised still organize the field. How fast can any estimator converge? How should the bandwidth be chosen from the data? What goes wrong at the edges of the data? This lesson proves the rates, shows that no estimator can beat them, and turns the same machinery into kernel regression.

What you’ll learn

  • State and prove the bias and variance expansions of the dd-dimensional kernel density estimator, and derive the AMISE-optimal bandwidth h⋆∝n−1/(d+4)h^\star\propto n^{-1/(d+4)}, the rate n−4/(d+4)n^{-4/(d+4)} and the efficiencies of common kernels.
  • Prove by a two-point argument that n−2β/(2β+d)n^{-2\beta/(2\beta+d)} is a lower bound for estimating a β\beta-smooth density at a point, and explain what higher-order kernels gain and lose.
  • Derive Silverman's rule and the least-squares cross-validation criterion, and explain why data-driven bandwidths converge slowly.
  • Analyze boundary bias and its corrections, and derive the Nadaraya–Watson regression estimator together with its design bias.

The bias–variance expansion in d dimensions

Let X1,…,Xn\mathbf X_1,\dots,\mathbf X_n be i.i.d. with density pp on Rd\R^d. The kernel density estimator with smoothing kernel KK and bandwidth hh is p^h(x)=1n∑iKh(x−Xi)\hat p_h(\mathbf x)=\frac1n\sum_iK_h(\mathbf x-\mathbf X_i), where Kh(u)=h−dK(u/h)K_h(\mathbf u)=h^{-d}K(\mathbf u/h). Assume KK is bounded, integrates to 1, is symmetric, K(−u)=K(u)K(-\mathbf u)=K(\mathbf u), and satisfies ∫uu⊤K(u) du=μ2(K) Id\int\mathbf u\mathbf u^\top K(\mathbf u)\,d\mathbf u=\mu_2(K)\,I_d and ∫∥u∥2∣K(u)∣ du<∞\int\norm{\mathbf u}^2\abs{K(\mathbf u)}\,d\mathbf u<\infty; product kernels and radially symmetric kernels qualify. Write R(g)=∫g2R(g)=\int g^2 for any square-integrable gg.

DerivationProof
  1. E p^h(x)=∫h−dK(x−yh)p(y) dy=∫K(u) p(x−hu) du\E\,\hat p_h(\mathbf x)=\int h^{-d}K\Big(\frac{\mathbf x-\mathbf y}h\Big)p(\mathbf y)\,d\mathbf y=\int K(\mathbf u)\,p(\mathbf x-h\mathbf u)\,d\mathbf u

    Mean. The estimator averages nn i.i.d. terms, so its mean is that of one term. Substitute y=x−hu\mathbf y=\mathbf x-h\mathbf u:

  2. E p^h(x)−p(x)=h2 ⁣∫ ⁣K(u) ⁣∫01 ⁣(1−t) u⊤∇2p(x−thu) u dt du=12h2μ2(K) Δp(x)+o(h2)\E\,\hat p_h(\mathbf x)-p(\mathbf x)=h^2\!\int\!K(\mathbf u)\!\int_0^1\!(1-t)\,\mathbf u^\top\nabla^2p(\mathbf x-th\mathbf u)\,\mathbf u\,dt\,d\mathbf u=\tfrac12h^2\mu_2(K)\,\Delta p(\mathbf x)+o(h^2)

    Bias. Expand by Taylor's theorem with integral remainder. The linear term integrates to zero by symmetry; the quadratic term converges by continuity of ∇2p\nabla^2p and dominated convergence, and ∫K(u) u⊤Au du=μ2(K)tr⁡A\int K(\mathbf u)\,\mathbf u^\top A\mathbf u\,d\mathbf u=\mu_2(K)\operatorname{tr}A:

  3. Var⁡ p^h(x)=1n[h−d ⁣∫K(u)2 p(x−hu) du−(E Kh(x−X))2]=R(K) p(x)nhd+o(1nhd)\Var\,\hat p_h(\mathbf x)=\frac1n\Big[h^{-d}\!\int K(\mathbf u)^2\,p(\mathbf x-h\mathbf u)\,d\mathbf u-\big(\E\,K_h(\mathbf x-\mathbf X)\big)^2\Big]=\frac{R(K)\,p(\mathbf x)}{nh^d}+o\Big(\frac1{nh^d}\Big)

    Variance. One term's second moment carries the factor h−dh^{-d}, while its squared mean is O(1)=o(h−d)O(1)=o(h^{-d}):

  4. h⋆=(dB4An)1/(d+4),AMISE(h⋆)=d+4d A h⋆4 ∝ n−4/(d+4)h^\star=\Big(\frac{dB}{4An}\Big)^{1/(d+4)},\qquad\mathrm{AMISE}(h^\star)=\frac{d+4}d\,A\,{h^\star}^4\ \propto\ n^{-4/(d+4)}

    Integrate and optimize. The integrated variance is exactly R(K)/(nhd)−R(Kh∗p)/nR(K)/(nh^d)-R(K_h*p)/n, and the integrated squared bias is 14h4μ22R(Δp)+o(h4)\tfrac14h^4\mu_2^2R(\Delta p)+o(h^4) by the same expansion, using continuity of translation in L2L^2. Minimize Ah4+B/(nhd)Ah^4+B/(nh^d): at the minimum 4Ah3=dB/(nhd+1)4Ah^3=dB/(nh^{d+1}), so the variance term equals 4/d4/d times the squared-bias term.

In one dimension the kernel enters the optimal error only through C(K)=μ2(K)1/2R(K)C(K)=\mu_2(K)^{1/2}R(K), as C(K)4/5n−4/5C(K)^{4/5}n^{-4/5}, and CC does not change when KK is rescaled. Epanechnikov (1969) showed that among nonnegative kernels it is minimized by the parabola K(u)=34(1−u2)+K(u)=\tfrac34(1-u^2)_+. To match a given error, the sample size must be proportional to C(K)C(K), which defines each kernel's efficiency:

KernelK(u)K(u)μ2(K)\mu_2(K)R(K)R(K)Efficiency
Epanechnikov34(1−u2)\tfrac34(1-u^2) on [−1,1][-1,1]1/51/53/53/51
Biweight1516(1−u2)2\tfrac{15}{16}(1-u^2)^2 on [−1,1][-1,1]1/71/75/75/70.994
Triangular1−∣u∣1-\abs u on [−1,1][-1,1]1/61/62/32/30.986
Gaussian(2π)−1/2e−u2/2(2\pi)^{-1/2}e^{-u^2/2}111/(2π)1/(2\sqrt\pi)0.951
Uniform12\tfrac12 on [−1,1][-1,1]1/31/31/21/20.930
Efficiency C(KEpa)/C(K)C(K_{\mathrm{Epa}})/C(K) is the fraction of the sample the Epanechnikov kernel needs to match each kernel's best error. Every common kernel is within 7% of optimal, so kernels are chosen for smoothness or speed, and the effort goes into the bandwidth.
Predict before you look

An Epanechnikov-kernel KDE at its best bandwidth uses 1,000 observations. Asymptotically, how many observations does a Gaussian-kernel KDE need, also at its best bandwidth, to match its mean integrated squared error?

Show the answer

1051 observations

Sample size scales with C(K)=μ2(K)1/2R(K)C(K)=\mu_2(K)^{1/2}R(K): 1⋅12π≈0.28211\cdot\frac1{2\sqrt\pi}\approx0.2821 for the Gaussian and 1/5⋅35≈0.2683\sqrt{1/5}\cdot\frac35\approx0.2683 for the Epanechnikov kernel. The ratio is 1/0.951≈1.0511/0.951\approx1.051, so about 1,051 observations. Five percent is real but small, which is why the Gaussian kernel's smoothness usually wins.

No estimator does better

Is n−4/(d+4)n^{-4/(d+4)} a weakness of kernels, or of the problem? Fix a point x0\mathbf x_0 and a smoothness class. For β>0\beta>0, let ℓ\ell be the largest integer strictly below β\beta, and let P(β,L)\mathcal P(\beta,L) contain the densities on Rd\R^d whose partial derivatives of order ℓ\ell exist and are Hölder continuous with exponent β−ℓ\beta-\ell and constant LL. Densities whose second derivatives are bounded by LL belong to P(2,L)\mathcal P(2,L).

DerivationProof of the lower bound (two points)
  1. p1(x)=p0(x)+γhβ ψ(x−x0h),p1(x0)−p0(x0)=γhβp_1(\mathbf x)=p_0(\mathbf x)+\gamma h^\beta\,\psi\Big(\frac{\mathbf x-\mathbf x_0}h\Big),\qquad p_1(\mathbf x_0)-p_0(\mathbf x_0)=\gamma h^\beta

    Take p0∈P(β,L/2)p_0\in\mathcal P(\beta,L/2) with p0≥c0>0p_0\ge c_0>0 near x0\mathbf x_0, and a smooth bump ψ\psi supported in the unit ball with ψ(0)=1\psi(\mathbf 0)=1 and ∫ψ=0\int\psi=0. Perturb p0p_0 at scale h≤1h\le1. For a small fixed γ>0\gamma>0, p1p_1 is a density (it integrates to 1 because ∫ψ=0\int\psi=0, and stays positive because p0≥c0p_0\ge c_0 near x0\mathbf x_0), and it lies in P(β,L)\mathcal P(\beta,L): the bump's derivatives of order ℓ\ell have Hölder constant proportional to γ\gamma, whatever hh is.

  2. DKL(p1⊗n ∥ p0⊗n)=n DKL(p1 ∥ p0)≤n ⁣∫ ⁣(p1−p0)2p0≤n γ2h2β+dR(ψ)c0\KL\big(p_1^{\otimes n}\,\|\,p_0^{\otimes n}\big)=n\,\KL(p_1\,\|\,p_0)\le n\!\int\!\frac{(p_1-p_0)^2}{p_0}\le\frac{n\,\gamma^2h^{2\beta+d}R(\psi)}{c_0}

    The two hypotheses are hard to tell apart. Bound the KL divergence between the laws of the samples by the χ2\chi^2 divergence; the bump has squared integral γ2h2β+dR(ψ)\gamma^2h^{2\beta+d}R(\psi):

  3. max⁡j∈{0,1}Epj(p^(x0)−pj(x0))2 ≥ 1−τ2(γhβ2)2 = c n−2β/(2β+d)\max_{j\in\{0,1\}}\E_{p_j}\big(\hat p(\mathbf x_0)-p_j(\mathbf x_0)\big)^2\ \ge\ \frac{1-\tau}2\Big(\frac{\gamma h^\beta}2\Big)^2\ =\ c\,n^{-2\beta/(2\beta+d)}

    Choose h=n−1/(2β+d)h=n^{-1/(2\beta+d)}. The divergence stays below a constant, so by Pinsker's inequality the total-variation distance between the two laws stays below some τ<1\tau<1. Le Cam's two-point argument then says any estimator misses by at least half the gap, 12γhβ\tfrac12\gamma h^\beta, with probability at least (1−τ)/2(1-\tau)/2 under one of the two densities:

The proof shows where the rate comes from: a bump of height hβh^\beta and width hh is invisible to nn samples once nh2β+d≲1nh^{2\beta+d}\lesssim1. For β=2\beta=2 this is exactly the KDE's n−4/(4+d)n^{-4/(4+d)}, so the kernel estimator is rate-optimal, and the curse of dimensionality belongs to the problem, not to the method. Smoother densities allow faster rates, but only kernels of higher order exploit them. A kernel whose second moment vanishes must take negative values, so the estimate can dip below zero; truncating at zero and renormalizing repairs that, and in practice the gains appear only at large nn.

Check your understanding

A density on R4\R^4 is known to be Hölder smooth with β=4\beta=4. What is the best possible rate for the mean squared error of estimating it at a point?

  1. n−1/2n^{-1/2}
  2. n−2/3n^{-2/3}
  3. n−4/5n^{-4/5}
  4. n−1n^{-1}
Show the answer

B. n−2/3n^{-2/3}

2β/(2β+d)=8/12=2/32\beta/(2\beta+d)=8/12=2/3. A kernel of order 3 with h≍n−1/12h\asymp n^{-1/12} attains it. A nonnegative kernel stays at n−4/(4+4)=n−1/2n^{-4/(4+4)}=n^{-1/2}, because its bias is of order h2h^2 however smooth pp is.

Choosing the bandwidth from the data

The optimal h⋆h^\star involves the unknown curvature R(Δp)R(\Delta p). Bandwidth selectors either plug in a guess for it, estimate it, or bypass it by estimating the error directly. Take d=1d=1.

DerivationSilverman's rule (normal reference)
  1. R(p′′)=∫(ϕσ′′(x))2dx=38π σ5R(p'')=\int\big(\phi_\sigma''(x)\big)^2dx=\frac3{8\sqrt\pi\,\sigma^5}

    Pretend pp is N(μ,σ2)\mathcal N(\mu,\sigma^2), whose curvature functional is

  2. h⋆=(1/(2π)3n/(8π σ5))1/5=(43n)1/5σ≈1.06 σ n−1/5h^\star=\Big(\frac{1/(2\sqrt\pi)}{3n/(8\sqrt\pi\,\sigma^5)}\Big)^{1/5}=\Big(\frac4{3n}\Big)^{1/5}\sigma\approx1.06\,\sigma\,n^{-1/5}

    The Gaussian kernel has μ2(K)=1\mu_2(K)=1 and R(K)=1/(2π)R(K)=1/(2\sqrt\pi). Substitute into h⋆=[R(K)/(μ2(K)2R(p′′) n)]1/5h^\star=\big[R(K)/(\mu_2(K)^2R(p'')\,n)\big]^{1/5}:

  3. hrot=0.9 min⁡(σ^, IQR/1.34) n−1/5h_{\mathrm{rot}}=0.9\,\min\big(\hat\sigma,\ \mathrm{IQR}/1.34\big)\,n^{-1/5}

    Replace σ\sigma by an estimate. Data with two separated peaks inflate the sample standard deviation σ^\hat\sigma and the rule then oversmooths, so Silverman (1986) recommends a robust version: a normal distribution's interquartile range is 1.34σ1.34\sigma, and the factor 0.9 leans toward less smoothing.

Least-squares cross-validation (Rudemo, 1982; Bowman, 1984) estimates the integrated squared error of the estimate in hand. Expand ∫(p^h−p)2=∫p^h2−2∫p^hp+∫p2\int(\hat p_h-p)^2=\int\hat p_h^2-2\int\hat p_hp+\int p^2. The last term does not involve hh, the first is computable, and the middle one is estimated with leave-one-out estimates p^h,−i\hat p_{h,-i} that never see XiX_i:

LSCV(h)=∫p^h2−2n∑i=1np^h,−i(Xi),E[1n∑i=1np^h,−i(Xi)]=E[∫p^h,n−1 p],\mathrm{LSCV}(h)=\int\hat p_h^2-\frac2n\sum_{i=1}^n\hat p_{h,-i}(X_i),\qquad\E\Big[\frac1n\sum_{i=1}^n\hat p_{h,-i}(X_i)\Big]=\E\Big[\int\hat p_{h,n-1}\,p\Big],

where p^h,n−1\hat p_{h,n-1} is the estimate from n−1n-1 points. So LSCV(h)+∫p2\mathrm{LSCV}(h)+\int p^2 is unbiased for the MISE, up to the difference between nn and n−1n-1 points. Unbiased does not mean precise: the selected bandwidth is so variable that its relative error shrinks only like n−1/10n^{-1/10} (Hall & Marron, 1987), and in some samples it badly undersmooths.

Plug-in selectors estimate the functional R(p′′)R(p'') itself, with a pilot bandwidth tuned for that purpose, and then solve h=h⋆(R^)h=h^\star(\hat R). The solve-the-equation method of Sheather & Jones (1991) is the standard choice, and it is reliably good on smooth densities. Likelihood cross-validation maximizes ∑ilog⁡p^h,−i(Xi)\sum_i\log\hat p_{h,-i}(X_i), the held-out log-likelihood of the Descent lesson, and targets the KL divergence instead of squared error; an isolated point drives its term toward −∞-\infty unless hh grows, so heavy tails make it oversmooth everywhere. In dd dimensions the bandwidth becomes a positive definite matrix HH, with KH(u)=∣H∣−1/2K(H−1/2u)K_H(\mathbf u)=\abs{H}^{-1/2}K(H^{-1/2}\mathbf u), and the same three ideas extend with more to estimate.

python
import numpy as np
from scipy.stats import norm

def lscv(h, x):
    """Least-squares cross-validation score of a 1-D Gaussian KDE."""
    n = len(x)
    D = x[:, None] - x[None, :]                      # all pairwise differences
    int_p2 = norm.pdf(D, scale=np.sqrt(2) * h).sum() / n**2   # exact integral of p_hat^2
    K = norm.pdf(D, scale=h)
    loo = (K.sum(axis=1) - np.diag(K)) / (n - 1)     # leave-one-out p_hat at each x_i
    return int_p2 - 2 * loo.mean()

sd = x.std()
iqr = np.subtract(*np.percentile(x, [75, 25]))
grid = np.geomspace(0.02, 2.0, 60) * sd
h_cv = grid[np.argmin([lscv(h, x) for h in grid])]
h_rot = 0.9 * min(sd, iqr / 1.34) * len(x) ** (-1 / 5)   # Silverman's robust rule

With a Gaussian kernel, ∫p^h2\int\hat p_h^2 is exact: two Gaussian bumps of width hh overlap like one bump of width 2 h\sqrt2\,h. This direct version costs O(n2)O(n^2) per bandwidth; binning the data and using the fast Fourier transform make it nearly linear.

Boundaries and kernel regression

DerivationBias at a boundary
  1. E p^h(0)=∫0∞Kh(−y) p(y) dy=∫−∞0K(u) p(−hu) du ⟶ 12 p(0+)\E\,\hat p_h(0)=\int_0^\infty K_h(-y)\,p(y)\,dy=\int_{-\infty}^0K(u)\,p(-hu)\,du\ \longrightarrow\ \tfrac12\,p(0^+)

    Let pp live on [0,∞)[0,\infty) with p(0+)>0p(0^+)>0, and let KK be symmetric. At x=0x=0 only the half of each bump that falls inside the support collects mass:

  2. p^R(x)=1n∑i=1n[Kh(x−Xi)+Kh(x+Xi)]  (x≥0),E p^R(0) ⟶ p(0+)\hat p_R(x)=\frac1n\sum_{i=1}^n\big[K_h(x-X_i)+K_h(x+X_i)\big]\ \ (x\ge0),\qquad\E\,\hat p_R(0)\ \longrightarrow\ p(0^+)

    For KK supported on [−1,1][-1,1] and x=chx=ch with 0≤c<10\le c<1, the limit is p(0+)∫−1cKp(0^+)\int_{-1}^cK, so the estimate is inconsistent within one bandwidth of the edge; even after dividing by ∫−1cK\int_{-1}^cK, the bias there is of order hh, not h2h^2, because the truncated kernel is no longer symmetric. Reflecting the data restores consistency; its bias near zero stays of order hh unless p′(0+)=0p'(0^+)=0. Boundary kernels and transformations (such as log⁡X\log X for positive data) are the other standard fixes.

DerivationNadaraya–Watson regression from two density estimates
  1. m(x)=E[Y∣X=x]=∫y p(x,y) dyp(x)m(x)=\E[Y\mid X=x]=\frac{\int y\,p(x,y)\,dy}{p(x)}

    The regression function is a ratio of densities:

  2. m^h(x)=∑i=1nKh(x−Xi) Yi∑i=1nKh(x−Xi)\hat m_h(x)=\frac{\sum_{i=1}^nK_h(x-X_i)\,Y_i}{\sum_{i=1}^nK_h(x-X_i)}

    Estimate p(x,y)p(x,y) with a product kernel Kh(x−Xi)Lg(y−Yi)K_h(x-X_i)L_g(y-Y_i). A symmetric LL has mean zero, so integrating yy against Lg(y−Yi)L_g(y-Y_i) returns exactly YiY_i, and integrating out yy leaves the KDE of XX. The ratio is the estimator of Nadaraya (1964) and Watson (1964):

  3. bias⁡m^h(x)≈h2μ2(K)(m′′(x)2+m′(x) f′(x)f(x)),Var⁡ m^h(x)≈σ2(x) R(K)nh f(x)\operatorname{bias}\hat m_h(x)\approx h^2\mu_2(K)\Big(\frac{m''(x)}2+\frac{m'(x)\,f'(x)}{f(x)}\Big),\qquad\Var\,\hat m_h(x)\approx\frac{\sigma^2(x)\,R(K)}{nh\,f(x)}

    For a random design with density ff for XX and conditional variance σ2(x)\sigma^2(x), expansions like those of the first step give, at an interior point with f(x)>0f(x)>0, as h→0h\to0 and nh→∞nh\to\infty:

The second bias term, the design bias, appears wherever mm slopes and ff changes, for instance near the edge of the data. A local linear fit, which solves a kernel-weighted least-squares problem for an intercept and a slope at each xx, removes it and corrects the boundary bias automatically, with the same asymptotic variance at interior points. The rates match the density case: mean squared error of order n−4/(4+d)n^{-4/(4+d)}, which Stone (1980) showed is optimal for twice-differentiable regression functions. Nearest-neighbor regression is the same idea with an adaptive window, and the widget tests the bandwidth rate on it.

Key takeaways

  • For a symmetric second-order kernel and a twice-differentiable density: bias 12h2μ2(K)Δp\tfrac12h^2\mu_2(K)\Delta p, variance R(K)p/(nhd)R(K)p/(nh^d), best bandwidth h⋆∝n−1/(d+4)h^\star\propto n^{-1/(d+4)} and AMISE∝n−4/(d+4)\mathrm{AMISE}\propto n^{-4/(d+4)}. At the optimum the variance term is 4/d4/d times the squared-bias term.
  • The rate is minimax. A bump of height hβh^\beta and width hh is undetectable once nh2β+d≲1nh^{2\beta+d}\lesssim1, so no estimator beats n−2β/(2β+d)n^{-2\beta/(2\beta+d)}; kernels of higher order reach it for smoother densities, at the price of negative values.
  • The kernel matters little (the Gaussian is 95% efficient); the bandwidth matters a lot. Silverman's rule is optimal for Gaussian data; least-squares cross-validation is unbiased but its bandwidth converges at the relative rate n−1/10n^{-1/10}; plug-in selectors are more stable.
  • Symmetric kernels are inconsistent at boundaries, with E p^h(0)→p(0+)/2\E\,\hat p_h(0)\to p(0^+)/2; reflection, boundary kernels and transformations fix it.
  • Nadaraya–Watson regression is a ratio of kernel estimates. Its design bias m′f′/fm'f'/f disappears with local linear fitting, and its rates match the density case.

Check yourself

In the interactive lesson these are scored with your confidence, and what you miss comes back for review.

Question 1

With a nonnegative second-order kernel in dd dimensions, how does the AMISE-optimal bandwidth scale with the sample size nn?

  1. Like n−1/5n^{-1/5}, in every dimension
  2. Like n−1/(d+4)n^{-1/(d+4)}
  3. Like n−1/2n^{-1/2}
  4. Like n−1/dn^{-1/d}
Show the answer

B. Like n−1/(d+4)n^{-1/(d+4)}

Balancing h4h^4 against 1/(nhd)1/(nh^d) gives hd+4∝1/nh^{d+4}\propto1/n. In one dimension this is n−1/5n^{-1/5}; in ten it is n−1/14n^{-1/14}, so bandwidths shrink very slowly in high dimension.

Question 2

Least-squares cross-validation minimizes ∫p^h2−2n∑ip^h,−i(Xi)\int\hat p_h^2-\frac2n\sum_i\hat p_{h,-i}(\mathbf X_i). What goes wrong if you replace the leave-one-out terms p^h,−i(Xi)\hat p_{h,-i}(\mathbf X_i) by p^h(Xi)\hat p_h(\mathbf X_i)?

  1. Nothing: the two versions have the same minimizer
  2. The criterion becomes unbiased for the log-likelihood instead
  3. Each p^h(Xi)\hat p_h(\mathbf X_i) includes its own bump K(0)/(nhd)K(\mathbf 0)/(nh^d), which grows without bound as h→0h\to0, so the criterion is minimized by h→0h\to0
  4. ∫p^h2\int\hat p_h^2 diverges
Show the answer

C. Each p^h(Xi)\hat p_h(\mathbf X_i) includes its own bump K(0)/(nhd)K(\mathbf 0)/(nh^d), which grows without bound as h→0h\to0, so the criterion is minimized by h→0h\to0

The middle term must estimate ∫p^hp\int\hat p_hp with points the estimate has not seen. With in-sample points the self-term K(0)/(nhd)K(\mathbf 0)/(nh^d) dominates for small hh and drags the criterion to −∞-\infty; leaving each point out makes the term unbiased for the cross term (with n−1n-1 points).

Question 3

A density on [0,∞)[0,\infty) has p(0+)=2p(0^+)=2. A KDE with a symmetric kernel, h→0h\to0 and nh→∞nh\to\infty, is evaluated at x=0x=0. What does its expectation converge to?

  1. 2
  2. 0
  3. 4
  4. 1
Show the answer

D. 1

Only the half of each bump that lies inside [0,∞)[0,\infty) collects mass near 00, so E p^h(0)→p(0+)∫−∞0K=12p(0+)=1\E\,\hat p_h(0)\to p(0^+)\int_{-\infty}^0K=\tfrac12p(0^+)=1. Reflecting the data about 00 doubles it back.

Question 4

Which change removes the Nadaraya–Watson design-bias term h2μ2(K) m′(x)f′(x)/f(x)h^2\mu_2(K)\,m'(x)f'(x)/f(x)?

  1. Using the Epanechnikov kernel
  2. Fitting a local line instead of a local constant at each xx
  3. Doubling the bandwidth
  4. Standardizing the response YY
Show the answer

B. Fitting a local line instead of a local constant at each xx

A local linear fit uses the slope at xx, so an uneven design density no longer tilts the local average. It also corrects the boundary bias automatically, with the same variance order.

Further reading

  • M. Rosenblatt, "Remarks on some nonparametric estimates of a density function," Annals of Mathematical Statistics 27(3), 832–837 (1956).
  • E. Parzen, "On estimation of a probability density function and mode," Annals of Mathematical Statistics 33(3), 1065–1076 (1962).
  • M. P. Wand & M. C. Jones, Kernel Smoothing (Chapman & Hall, 1995).
  • A. B. Tsybakov, Introduction to Nonparametric Estimation (Springer, 2009).
  • S. J. Sheather & M. C. Jones, "A reliable data-based bandwidth selection method for kernel density estimation," Journal of the Royal Statistical Society B 53(3), 683–690 (1991).