54 lines
1.4 KiB
Plaintext
54 lines
1.4 KiB
Plaintext
|
|
||
|
{{alias}}( W )
|
||
|
Returns an accumulator function which incrementally computes a moving
|
||
|
statistical summary.
|
||
|
|
||
|
The `W` parameter defines the number of values over which to compute the
|
||
|
moving statistical summary.
|
||
|
|
||
|
If provided a value, the accumulator function returns an updated moving
|
||
|
statistical summary. If not provided a value, the accumulator function
|
||
|
returns the current moving statistical summary.
|
||
|
|
||
|
The returned summary is an object containing the following fields:
|
||
|
|
||
|
- window: window size.
|
||
|
- sum: sum.
|
||
|
- mean: arithmetic mean.
|
||
|
- variance: unbiased sample variance.
|
||
|
- stdev: corrected sample standard deviation.
|
||
|
- min: minimum value.
|
||
|
- max: maximum value.
|
||
|
- range: range.
|
||
|
- midrange: arithmetic mean of the minimum and maximum values.
|
||
|
|
||
|
As `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.
|
||
|
|
||
|
Parameters
|
||
|
----------
|
||
|
W: integer
|
||
|
Window size.
|
||
|
|
||
|
Returns
|
||
|
-------
|
||
|
acc: Function
|
||
|
Accumulator function.
|
||
|
|
||
|
Examples
|
||
|
--------
|
||
|
> var accumulator = {{alias}}( 3 );
|
||
|
> var s = accumulator()
|
||
|
{}
|
||
|
> s = accumulator( 2.0 )
|
||
|
{...}
|
||
|
> s = accumulator( -5.0 )
|
||
|
{...}
|
||
|
> s = accumulator()
|
||
|
{...}
|
||
|
|
||
|
See Also
|
||
|
--------
|
||
|
|