Skip to main content

rolling_std

Function rolling_std 

Source
pub fn rolling_std(values: &[f64], window: usize) -> Vec<f64>
Expand description

Rolling sample standard deviation of the non-NULL values in a trailing window, by Welford’s algorithm.

Outputs NAN for the first window - 1 rows and wherever the window holds fewer than two values — including window == 1, where a sample standard deviation divides by zero. Returning 0.0 there, which this used to do, asserts that a single reading has no spread; it has no measurable spread, which is what NULL says.