Skip to main content

silverman_bandwidth

Function silverman_bandwidth 

Source
pub fn silverman_bandwidth(sorted: &[f64]) -> f64
Expand description

Computes the bandwidth for kernel density estimation using Silverman’s rule.

The bandwidth is calculated as: h = 0.9 * min(std, IQR / 1.34) * n^(-1/5)

Falls back to a small positive value when the data has zero spread (e.g. all identical values or a single data point).