repl.txt (1418B)
1 2 {{alias}}( W ) 3 Returns an accumulator function which incrementally computes a moving 4 statistical summary. 5 6 The `W` parameter defines the number of values over which to compute the 7 moving statistical summary. 8 9 If provided a value, the accumulator function returns an updated moving 10 statistical summary. If not provided a value, the accumulator function 11 returns the current moving statistical summary. 12 13 The returned summary is an object containing the following fields: 14 15 - window: window size. 16 - sum: sum. 17 - mean: arithmetic mean. 18 - variance: unbiased sample variance. 19 - stdev: corrected sample standard deviation. 20 - min: minimum value. 21 - max: maximum value. 22 - range: range. 23 - midrange: arithmetic mean of the minimum and maximum values. 24 25 As `W` values are needed to fill the window buffer, the first `W-1` returned 26 summaries are calculated from smaller sample sizes. Until the window is 27 full, each returned summary is calculated from all provided values. 28 29 Parameters 30 ---------- 31 W: integer 32 Window size. 33 34 Returns 35 ------- 36 acc: Function 37 Accumulator function. 38 39 Examples 40 -------- 41 > var accumulator = {{alias}}( 3 ); 42 > var s = accumulator() 43 {} 44 > s = accumulator( 2.0 ) 45 {...} 46 > s = accumulator( -5.0 ) 47 {...} 48 > s = accumulator() 49 {...} 50 51 See Also 52 -------- 53