Kernel Density Estimation: The Bandwidth Dilemma
You are estimating a probability density on from i.i.d. samples using a kernel density estimator (KDE):
where is a symmetric kernel with , , and .
(a) Show that the pointwise bias of is approximately
for small .
(b) Without calculation, explain why the variance of behaves as for large .
(c) Hence, what is the optimal bandwidth (in terms of ) that minimizes the mean squared error (MSE), and what is the resulting rate at which the MSE decays?
The punchline: What fundamental statistical trade-off does this reveal, and why can't you simply take ?
Answer: KDE Bandwidth Bias-Variance Tradeoff
Key Idea / Intuition
KDE with bandwidth is essentially a local average of the data over a window of size . A large window forces the estimate to look like a flattened version of the truth (high bias, low variance), while a tiny window uses almost no data per point (low bias, high variance). The optimal balances these two forces, and the optimal rate reveals a fundamental limit on how fast you can learn a density nonparametrically.
Formal Proof / Solution
Part (a): Bias Computation
The expected value of the estimator at is:
Substitute , so , :
Now expand via Taylor series around :
Integrate term by term against :
Therefore:
The bias is : wider bandwidth more smoothing larger bias.
Part (b): Why Variance ?
The estimator is an average of i.i.d. terms . By independence:
The term has variance of order (since the second moment of scales as by a change of variables). Thus:
Intuition: Each kernel window of width effectively uses only about of the data points. Averaging observations gives variance .
Smaller fewer neighbors used higher variance. This is the direct opposite of the bias behavior.
Part (c): Optimal Bandwidth and MSE Rate
The pointwise MSE decomposes as:
Minimize over by differentiating:
Substituting back, the optimal MSE rate is:
Comparison with parametric rates: In a parametric model, MSE decays as . KDE only achieves , which is strictly slower โ this is the price of not knowing the functional form of .
The Punchline: The BiasโVariance Trade-off
You cannot take because:
- As : bias โ but variance โ (each point uses essentially no data).
- As : variance โ but bias โ (you're estimating a flat function regardless of ).
The optimal is a delicate balance. This trade-off is universal in nonparametric estimation: you pay a rate rather than because you must simultaneously reduce both bias and variance, and they pull in opposite directions.
This is the nonparametric analogue of biasโvariance decomposition, and it is one of the most fundamental ideas in statistical learning theory.
Source: The Elements of Statistical Learning, Ch. 6 (Hastie, Tibshirani, Friedman)