Skip to main content

simple_kde

Function simple_kde 

Source
pub fn simple_kde(
    values: &[f64],
    bandwidth: f64,
    samples: usize,
) -> Vec<(f64, f64)>
Expand description

Gaussian kernel density estimate. Extends the evaluation range by 3*bandwidth on each side so Gaussian tails taper smoothly rather than terminating sharply at the data extremes.

Uses a truncated kernel: for each evaluation point only the sorted values within 4*bandwidth contribute (Gaussian contribution beyond that is < 0.003%). This gives O(window × samples) instead of O(n × samples).