Skip to main content

silverman_bandwidth

Function silverman_bandwidth 

Source
pub fn silverman_bandwidth(data: &[f64]) -> Result<f64, StatsError>
Expand description

Silverman’s rule-of-thumb bandwidth: h = 0.9 * min(std, IQR/1.34) * n^(-1/5).

Uses the sample standard deviation (n − 1 denominator). Returns StatsError::InvalidBandwidth when the estimate is not finite and positive — e.g. fewer than two points, or an all-identical sample where both the spread and the IQR are zero.