Returns an accumulator function which incrementally computes a moving arithmetic mean and corrected sample standard deviation.
W
parameter defines the number of values over which to compute the moving arithmetic mean and corrected sample standard deviation.W
values are needed to fill the window buffer, the first W-1
returned moving arithmetic mean and corrected sample standard deviation are calculated from smaller sample sizes. Until the window is full, each returned moving arithmetic mean and corrected sample standard deviation is calculated from all provided values.output array
window size
accumulator function
var Float64Array = require( `@stdlib/array/float64` );
var accumulator = incrmmeanstdev( new Float64Array( 2 ), 3 );
var mm = accumulator();
// returns null
Returns an accumulator function which incrementally computes a moving arithmetic mean and corrected sample standard deviation.
W
parameter defines the number of values over which to compute the moving arithmetic mean and corrected sample standard deviation.W
values are needed to fill the window buffer, the first W-1
returned moving arithmetic mean and corrected sample standard deviation are calculated from smaller sample sizes. Until the window is full, each returned moving arithmetic mean and corrected sample standard deviation is calculated from all provided values.window size
accumulator function
var accumulator = incrmmeanstdev( 3 );
var v = accumulator();
// returns null
v = accumulator( 2.0 );
// returns [ 2.0, 0.0 ]
v = accumulator( -5.0 );
// returns [ -1.5, ~4.95 ]
v = accumulator( 3.0 );
// returns [ 0.0, ~4.36 ]
v = accumulator( 5.0 );
// returns [ 1.0, ~5.29 ]
v = accumulator();
// returns [ 1.0, ~5.29 ]
If provided a value, the accumulator function returns an updated moving arithmetic mean and corrected sample standard deviation. If not provided a value, the accumulator function returns the current moving arithmetic mean and corrected sample standard deviation.
Notes
NaN
, the moving arithmetic mean and corrected sample standard deviation are equal toNaN
for all future invocations.input value
output array or null