Smoothing bandwidth (source code)

= Smoothing bandwidth
{title2=$h$}

A <smoothing bandwidth> $h>0$ determines the scale over which a <regression kernel> averages data, or a <kernel for density estimation> spreads each observation. It has the same units as the observations. In <kernel density estimation>, changing $h$ changes the visible detail while preserving the total <integral> one. For a <Gaussian density kernel>, each bump has <standard deviation> $h$ and its individual contribution has peak height $1/(nh\sqrt{2\pi})$.

If the <smoothing bandwidth> is too small relative to the spacings in a <statistical sample>, the <kernel density estimator> shows narrow spikes tied to individual observations: apparent peaks may be sampling accidents. If it is too large relative to features of the unknown <probability density function>, it blurs distinct groups together and spreads fitted <probability> far from the observations. An intermediate <smoothing bandwidth> can reveal broad structure, but visual smoothness alone cannot establish accuracy.

\Image[/kernel-density-bandwidth.png]
{title=The same sample at three Gaussian bandwidths, and leakage below zero for a separate positive sample}

The first three panels use exactly $(-1.8,-1.4,-1.1,-0.7,0.7,1.1,1.4,1.8)$ with <smoothing bandwidths> $0.08$, $0.35$ and $1.2$, respectively. Every curve has area one; the two groups in the observed <statistical sample> become less distinct as $h$ increases. No true <probability density function> is specified in this illustration, so the middle panel is illustrative, not a certified optimal fit. The fourth panel uses $(0.1,0.4,0.9)$ and $h=0.5$ to illustrate <boundary bias of a kernel density estimator>.

For a fixed nonnegative <kernel for density estimation> $K$ with finite squared <integral>, a <probability density function> $f$ that is bounded and continuous at an interior point $x$ with $f(x)>0$, and a deterministic sequence $h=h_n\downarrow0$, the pointwise sampling <variance> obeys
$$
\operatorname{Var}\bigl(\widehat f_{n,h}(x)\bigr)\sim\frac{f(x)}{nh}\int_{\mathbb R}K(u)^2\,du.
$$
Thus decreasing the <smoothing bandwidth> increases the leading sampling <variance> while reducing interior smoothing <bias of an estimator>: this is a <bias-variance tradeoff>. The conditions $h_n\to0$ and $nh_n\to\infty$ express two goals, increasingly fine resolution and enough observations contributing locally. Practical methods such as <plug-in bandwidth selection> use the data to choose $h$; <pointwise optimal kernel bandwidth> depends on local features of the unknown <probability density function>. The <smoothing bandwidth> remains a tuning choice in <nonparametric statistics>, and knowing the <support of a probability distribution> can require more than a width adjustment near a boundary.