repl.txt (1290B)
1 2 {{alias}}( [out,] W ) 3 Returns an accumulator function which incrementally computes a moving 4 arithmetic mean and unbiased sample variance. 5 6 The `W` parameter defines the number of values over which to compute the 7 moving arithmetic mean and unbiased sample variance. 8 9 If provided a value, the accumulator function returns updated accumulated 10 values. If not provided a value, the accumulator function returns the 11 current moving accumulated values. 12 13 As `W` values are needed to fill the window buffer, the first `W-1` returned 14 accumulated values are calculated from smaller sample sizes. Until the 15 window is full, each returned accumulated value is calculated from all 16 provided values. 17 18 Parameters 19 ---------- 20 out: Array|TypedArray (optional) 21 Output array. 22 23 W: integer 24 Window size. 25 26 Returns 27 ------- 28 acc: Function 29 Accumulator function. 30 31 Examples 32 -------- 33 > var accumulator = {{alias}}( 3 ); 34 > var v = accumulator() 35 null 36 > v = accumulator( 2.0 ) 37 [ 2.0, 0.0 ] 38 > v = accumulator( -5.0 ) 39 [ -1.5, 24.5 ] 40 > v = accumulator( 3.0 ) 41 [ 0.0, 19.0 ] 42 > v = accumulator( 5.0 ) 43 [ 1.0, 28.0 ] 44 > v = accumulator() 45 [ 1.0, 28.0 ] 46 47 See Also 48 -------- 49