Statistical Methods
Audit Bandwidth and Boundary Effects in a Density Plot
Define the task
A kernel density estimate is a smoothed description of observed values, not a direct count histogram or a fitted scientific mechanism. Decide whether the measurement is continuous, bounded, transformed or rounded. Gaussian kernels can assign density outside a physically possible range, such as below zero for a nonnegative quantity. Record sample size, weights, bandwidth rule and units, and display raw-data support where disclosure permits. Use synthetic or aggregate data for shared demonstrations.
Carry out the check
Bandwidth controls smoothing. A small bandwidth can turn random variation into apparent modes; a large one can hide meaningful structure. The documented default uses Scott's factor, which depends on dimension and effective sample size when weights are used. The covariance of the observations also contributes to the kernel covariance. Inspect multiple justified bandwidths and boundary behavior rather than treating the default as automatic validation. Singular data or a lower-dimensional subspace require special handling; adding an arbitrary jitter changes the data-generating story.
Worked hypothetical example
For a hypothetical unweighted one-dimensional dataset of 32 observations, Scott's factor is 32^(−1/5)=0.5. This is a factor applied to the covariance scale, not an absolute bandwidth of 0.5 measurement units. If the sample standard deviation is 4 units, the resulting kernel standard deviation is 2 units. Preserve both the factor and the data scale so someone can reproduce the plot. A visually smooth curve does not establish normality or the number of underlying populations.
Method checked 16 November 2026 against SciPy documentation: gaussian_kde.