How this calculation works
Kernel density estimation averages a smooth kernel centered at every observed value. This calculator uses equal-weight Gaussian kernels and an explicit coordinate bandwidth or a documented Scott/Silverman rule. It evaluates the density at requested points without fitting a single normal distribution to the whole sample.
fhat(x)=(1/(nh sqrt(2pi)))Σ exp(−(x−x_i)²/(2h²)).A worked example
For samples −1 and one with bandwidth one, the estimated density at zero is exp(−1/2)/sqrt(2pi), about 0.2419707. Each observation contributes the same value there. The full density integrates to one, while the sum of densities at an arbitrary finite query list need not equal one.
Good to know
One-dimensional finite sample only. Rule bandwidth requires nonzero spread; manual bandwidth must be positive. No boundary correction, adaptive bandwidth, observation weights or density-confidence bands. Density has inverse-coordinate units, not probability units.
Reference: SciPy Gaussian KDE bandwidth conventions (opens in a new tab) ↗
Bandwidth has coordinate units
A Gaussian kernel centered at each observation contributes a smooth bump whose width is the bandwidth. Smaller widths reveal more sample detail but can create noisy peaks; larger widths blend nearby features. The manual field uses an absolute coordinate width, rather than an unexplained dimensionless multiplier applied to an internal spread estimate.
Scott and Silverman modes multiply the sample standard deviation by their declared scalar factors. Software uses several rules named Silverman, including robust variants involving an interquartile range. This page follows the printed SciPy scalar-factor convention, so matching the label alone is insufficient when comparing bandwidths from another source.
The Normal distribution probability calculator covers the nearby task. A KDE estimates a density from samples rather than evaluating a single specified normal distribution.
Density values are not event probabilities
The estimated density has inverse-coordinate units and may exceed one when observations are tightly concentrated. A probability requires integrating that density over an interval. Adding values at a few irregular query locations is neither an integral nor a normalization check, because those locations have no automatically assigned interval widths.
Every Gaussian kernel integrates to one and the equal-weight average therefore does too over the full real line. A finite displayed grid omits tails. Apparent missing area near the plot boundary is not repaired by rescaling the requested values, which would silently change the mathematical density outside the chosen query window.
The sample and boundary assumptions remain visible
Gaussian kernels can assign mass outside a physically allowed region, such as negative values for a nonnegative measurement. This implementation does not apply reflection, transformation or boundary correction. Such mass indicates a mismatch between the kernel model and a constrained application, not evidence that the underlying physical process permits those values.
The default two-point example permits a closed-form check at zero, while general tests compare independent Gaussian-kernel sums and matched bandwidth rules. Repeated observations are allowed. A constant sample can use a positive manual width, but a rule derived from zero sample spread is rejected rather than inventing an unstated minimum bandwidth.
Build density from individual Gaussian kernels
For n observations xi and bandwidth h, the estimate at x is the average of φ((x−xi)/h)/h. Each observation contributes a Gaussian bump integrating to one; averaging makes the whole estimate integrate to one over the real line. The returned numbers are heights at your query coordinates, not a list of probability masses that should add to one.
If coordinates are measured in seconds, density is measured per second. A height above one can be valid when observations are concentrated in a narrow interval. An interval probability would require integrating the density across that interval; this page does not convert the queried heights into exact interval probabilities or normalize them across your chosen query list.
Check the two-observation example numerically
With observations −1 and 1 and h=1, the density at zero is [φ(1)+φ(−1)]/2=φ(1)≈0.2419707. At x=1, one kernel is at its center and the other is two standard bandwidths away, giving [φ(0)+φ(2)]/2≈0.2264666. Equal-height modes should not be inferred just from these two query values.
Halving h to 0.5 lowers the density at zero to about 0.107982 while increasing the density near each observed point. The observations did not change; only the smoothing scale changed. This illustrates why bumps in a KDE need a bandwidth sensitivity check before they are described as separate populations.
Match the automatic bandwidth rule and units
This univariate form uses sample standard deviation s. Scott’s rule sets h=s n^(−1/5); the Silverman option uses h=s(3n/4)^(−1/5). These are Gaussian scale rules, not the separate robust rule of thumb that uses min(s,IQR/1.34). Different software can use different formulas under similar names, so compare the actual h rather than the menu label alone.
If measurements are converted from metres to centimetres, both query coordinates and h must be multiplied by 100. The density height is then divided by 100, preserving interval probabilities under the coordinate change. A manual h is useful for that controlled comparison. Automatic rules need nonzero spread; identical observations cannot produce a positive standard-deviation rule bandwidth.
Know when a Gaussian KDE is the wrong representation
Gaussian kernels put some density outside any finite support. For data such as nonnegative waiting times, this can assign density below zero. That is boundary bias, not a formatting error. Transformations, boundary correction or a different model may be appropriate, but none is automatically applied here. Discrete counts likewise should not be interpreted as if a smooth density were their probability mass function.
Inspect observations and query range before drawing conclusions. A broad h can merge meaningful features, while a very small h can reproduce measurement noise as sharp peaks. The estimate does not attach uncertainty bands, account for dependent observations or correct sampling bias. Use it as a transparent smoothing calculation rather than a test that a particular number of modes exists.
A few questions, answered
Can density exceed one?
Yes. Density has inverse-coordinate units; only integrated interval probability is bounded by one.
Why reject a rule bandwidth on constant data?
Its sample-spread factor is zero; choose a justified positive manual bandwidth instead.
Why do queried densities not sum to one?
They are function heights. The density integrates to one across the real line; summing heights at an arbitrary set of coordinates is not that integral.
Is Silverman here the robust IQR rule?
No. This option is the univariate Gaussian scale rule s(3n/4)^(−1/5). The actual returned bandwidth makes that convention explicit.