Returns an accumulator function which incrementally computes a moving statistical summary.
W
parameter defines the number of values over which to compute the moving statistical summary.W
values are needed to fill the window buffer, the first W-1
returned summaries are calculated from smaller sample sizes. Until the window is full, each returned summary is calculated from all provided values.window size
accumulator function
var accumulator = incrmsummary( 3 );
var summary = accumulator();
// returns {}
summary = accumulator( 2.0 );
// returns {...}
summary = accumulator( -5.0 );
// returns {...}
summary = accumulator();
// returns {...}
If provided a value, the accumulator function returns an updated summary; otherwise, the accumulator function returns the current summary.
Notes
The returned summary is an object containing the following fields:
value
updated summary