Returns an accumulator function which incrementally computes a moving corrected sample standard deviation.
W
parameter defines the number of values over which to compute the moving sum.W
values are needed to fill the window buffer, the first W-1
returned values are calculated from smaller sample sizes. Until the window is full, each returned value is calculated from all provided values.window size
mean value
accumulator function
var accumulator = incrmstdev( 3 );
var s = accumulator();
// returns null
s = accumulator( 2.0 );
// returns 0.0
s = accumulator( -5.0 );
// returns ~4.95
s = accumulator( 3.0 );
// returns ~4.36
s = accumulator( 5.0 );
// returns ~5.29
s = accumulator();
// returns ~5.29
var accumulator = incrmstdev( 3, 5.0 );
If provided a value, returns an updated corrected sample standard deviation; otherwise, returns the current corrected sample standard deviation.
Notes
NaN
or a value which, when used in computations, results inNaN
, the accumulated value isNaN
for all future invocations.value
corrected sample standard deviation