Take the realized statistical sample , the Gaussian density kernel and smoothing bandwidth . Then
At , the three contributions are , , and , because and . Their sum is
This is a probability density function value, not the probability of observing exactly zero. Each of the three component curves has area , despite having a different height at zero.
Let be the cumulative distribution function of the standard normal distribution. The fitted probability of the interval is its area under the kernel density estimator:
The shaded area in the diagram is this fitted probability. Its agreement to a few digits with is incidental: the empirical measure gives this interval mass exactly, whereas kernel density estimation redistributes that mass into neighboring intervals.
Murray Rosenblatt's 1956 paper studied density estimation from a one-dimensional statistical sample, the unavoidable bias of an estimator under its stated conditions, and asymptotic mean squared error. It is an early foundation of kernel density estimation. [ref]. Emanuel Parzen's 1962 paper developed statistical consistency and asymptotic normality for probability density function estimates and studied estimation of the mode. [ref].
The authors' interests help explain the connection with smoothing. In a conversation recorded in 2006 and published in 2009, Rosenblatt recalled that his density estimation work grew out of estimation of the time-series spectral density and emphasized the connection with a smoothed histogram. This is his retrospective account of the motivation. [ref]. Parzen's original paper lists Stanford University as his affiliation; its opening frames the problem as recovering both a probability density function and its mode from independent and identically distributed random variables. [ref].
Kernel density estimation Created 2026-09-24 Updated 2026-10-14
Let be real independent and identically distributed random variables with unknown probability density function , let , and choose a nonnegative, unit-integral kernel for density estimation and a smoothing bandwidth . The kernel density estimator is
Place a bump at every observation and add their contributions. Each bump has area , so for every realized statistical sample
The change of variables is . Summing the unweighted bumps would give area ; summing just would give area . Those raw sums do not have the normalization of a probability density function.
Unlike a histogram, the construction does not require choosing bin origins, and a Gaussian density kernel gives a smooth curve. Its appeal is that identical local contributions can combine into a probability density function with several peaks without first choosing their number. This makes kernel density estimation useful for exploring an unknown probability distribution and estimating interval probabilities, while the smoothing bandwidth controls how much detail is visible.
Figure 1.
Three Gaussian contributions, each of area one third, add to a normalized kernel density estimate
. Details.
Before the statistical sample is observed, is a random function; afterwards it is a fitted probability density function. It is an estimator of the unknown , not the true probability distribution. For fixed , its expectation is the convolution , generally different from , and repeating the sampling changes the fitted curve. The exact mean integrated squared error of a kernel density estimator separates this smoothing bias of an estimator from sampling variance. Allowing signed kernels of order ell retains the formula but can lose nonnegativity.
The accepted values have marginal posterior density
Estimate this one-dimensional density by a histogram or kernel density estimation from the simulated values. Where , likelihood reconstruction from posterior simulation gives
Use bins or a sufficiently fine grid, and refine near the maximum. For a histogram with bins , its posterior mass divided by prior mass estimates a prior-weighted average of the likelihood in that bin:
Narrowing the bins gives pointwise likelihood reconstruction at continuous positive-prior points. A flat proper prior over the search interval makes the highest posterior-density bin approximately the highest-likelihood bin. With a nonconstant prior, maximizing the posterior alone gives a maximum a posteriori estimate, generally different from maximum likelihood estimation. Choose prior support covering the intended search region and include a possible boundary maximum; for , decreases with , so the maximum-likelihood estimate is .
The sampled genealogies provide a second likelihood reconstruction when the one-dimensional prior integral is computable. Put
Their posterior density is . Therefore, for any trial value ,
This is an importance sampling estimate of the likelihood curve using the posterior genealogies. It can be maximized over a grid without estimating a posterior density in , provided wherever the target integrand is positive and the weights are numerically usable. The ordinary moment estimate is not automatically a maximum-likelihood estimate: it uses only the mean equation, while the likelihood integrates the entire random branch-length distribution.
In kernel density estimation, take a kernel for density estimation that is nonnegative, symmetric, and has integral one, finite , and finite . Its smoothing bandwidth gives and the kernel density estimator
from an independent and identically distributed sample with probability density function . Nonnegativity and unit mass make the estimate itself a probability density function. We compare kernel for density estimation shapes by their optimized mean integrated squared error, rather than by their performance at an arbitrarily common numerical smoothing bandwidth.
For the usual second-order theory, assume, for example, that belongs to the Sobolev space and , and let , . The expectation is the convolution . The vanishing first moment of the symmetric kernel for density estimation and the integral Taylor remainder give
Continuity of translations in the L2 norm, with domination by , shows that in the L2 norm. Hence the integrated squared bias of a kernel density estimator is
By independence, the exact integrated variance of a kernel density estimator is
Indeed the integrated second moment of a single summand is , and its integrated squared mean is . The latter quantity is bounded by , by Young's convolution inequality, so its contribution is . The bias-variance decomposition of mean squared error therefore yields the leading criterion
This asymptotic mean integrated squared error displays the bias-variance tradeoff: a small smoothing bandwidth increases integrated variance, while a large one increases squared bias of an estimator.
Differentiating the asymptotic mean integrated squared error with respect to gives . It changes sign once, from negative to positive, so its unique minimum is
At this minimum the integrated variance term is four times the squared bias of an estimator term. Substitution gives
Thus the leading rate is , and the shape comparison reduces to minimizing .
There is an essential scale ambiguity: if , then . Changing the scale of the kernel for density estimation merely changes the numerical convention for the smoothing bandwidth. Moreover
A comparison at the same raw is therefore not a fair comparison of shape. One can normalize the second moment to one, but that does not make the optimal smoothing bandwidth independent of shape.
The canonical kernel for density estimation instead chooses the unique scale
It satisfies , and so
Consequently all canonical kernels share the same leading optimal bandwidth . Only the multiplicative constant depends on shape. This is precisely the separation of shape choice and scale choice that makes the canonical kernel normalization useful. For an original unscaled kernel for density estimation, its corresponding optimal smoothing bandwidth is .
To prove optimal shape, scale a candidate kernel for density estimation to have second moment one. Let and
Direct integration gives , , and . Thus is a rescaled Epanechnikov kernel. For any admissible with the same mass and second moment,
Outside , and , because . The integral inside is therefore nonnegative, and multiplying by gives . Expanding the square now proves
Equality forces almost everywhere. At fixed second moment, minimizing is equivalent to minimizing . Since is scale invariant, this proves the optimality of the Epanechnikov kernel over all nonnegative symmetric second-order kernels for density estimation, including the equality case up to rescaling.
In its usual scale, the optimal Epanechnikov kernel is
Its canonical scale is , giving
The optimal Epanechnikov kernel shape is therefore a truncated parabola, rather than a particular support radius. The canonical kernel and unit-second-moment version represent the same shape but different scale conventions.
The numerical gains over other reasonable kernels for density estimation are modest. Define asymptotic relative efficiency against the optimal Epanechnikov kernel by the sample-size fraction giving the same optimized leading mean integrated squared error:
For the Gaussian density kernel , and , so its efficiency is . For the uniform smoothing kernel , and , giving efficiency . The Gaussian density kernel is infinitely smooth, whereas the optimal Epanechnikov kernel has compact support and allows each observation to affect only a finite window. Such computational and smoothness considerations may outweigh a small leading-efficiency difference.
In practice is unknown. A plug-in estimator estimates this roughness functional from a pilot estimate of the second derivative and substitutes it into the optimal smoothing bandwidth formula. Alternatively, Leave-one-out cross-validation minimizes
where uses the other observations. By independence, the expectation of the second term is , so . Thus it targets integrated error without knowing . The choice of smoothing bandwidth remains important: even for the optimal Epanechnikov kernel, setting multiplies the leading minimum error by .
The preceding optimum concerns nonnegative second-order kernels for density estimation and twice-smooth densities on the real line. Signed kernels of order ell can cancel higher moments for smoother densities and yield different rates, but may produce negative density estimates. A support boundary or a density jump also requires separate bias of a kernel density estimator analysis. These settings do not contradict the proved second-order optimality of the Epanechnikov kernel.
One simple algorithm is importance sampling from the prior. Draw independently from and assign weight . Then
estimates the Bayesian model evidence, and the normalized weights represent the posterior. A weighted histogram or kernel density estimation of the estimates the marginal ; discarding performs the marginalization.
Estimate each one-dimensional marginal posterior from its individual experiment's weighted samples, for example by weighted kernel density estimation. Combining that density estimate with the individual evidence estimate gives
Their product with can be normalized on the one-dimensional space, avoiding all joint nuisance-parameter sampling.
Discard burn-in from the MCMC output and retain the sampled coordinate. A normalized histogram or kernel density estimation of these draws approximates . Autocorrelation changes the Monte Carlo uncertainty, so uncertainty bands should use the chain's effective sample size rather than its raw length.
Smoothing bandwidth Created 2026-10-05 Updated 2026-10-14
A smoothing bandwidth 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 changes the visible detail while preserving the total integral one. For a Gaussian density kernel, each bump has standard deviation and its individual contribution has peak height .
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.
Figure 1.
The same sample at three Gaussian bandwidths, and leakage below zero for a separate positive sample
. Details.
The first three panels use exactly with smoothing bandwidths , and , respectively. Every curve has area one; the two groups in the observed statistical sample become less distinct as 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 and to illustrate boundary bias of a kernel density estimator.
For a fixed nonnegative kernel for density estimation with finite squared integral, a probability density function that is bounded and continuous at an interior point with , and a deterministic sequence , the pointwise sampling variance obeys
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 and express two goals, increasingly fine resolution and enough observations contributing locally. Practical methods such as plug-in bandwidth selection use the data to choose ; 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.
Unit-width box kernel 2026-10-07
The unit-width centred box kernel is . It has integral one and squared norm one. Its rescaling averages a function on intervals of length . It is obtained from the uniform smoothing kernel with support by rescaling, and is useful in both kernel density estimation and local polynomial regression.