pub fn kde_curve(
data: &[f64],
bandwidth: Option<f64>,
n_points: usize,
cut: f64,
) -> Result<KdeCurve, StatsError>Expand description
Evaluate a Gaussian KDE of data on a uniform grid.
bandwidth—Some(h)to force a bandwidth, orNoneto derive one viasilverman_bandwidth.n_points— number of grid points; higher gives a smoother violin outline (values around 200 render cleanly). Clamped to at least 2.cut— how far past the data range to extend, in bandwidths (a value of3.0captures the Gaussian tails without a visible cutoff).
Returns StatsError::EmptyInput for no finite data, or
StatsError::InvalidBandwidth for a non-positive bandwidth (explicit or
derived).