repl.txt (891B)
1 2 {{alias}}() 3 Returns an accumulator function which incrementally computes a weighted 4 arithmetic mean. 5 6 If provided arguments, the accumulator function returns an updated weighted 7 mean. If not provided arguments, the accumulator function returns the 8 current weighted mean. 9 10 If provided `NaN` or a value which, when used in computations, results in 11 `NaN`, the accumulated value is `NaN` for all future invocations. 12 13 The accumulator function accepts two arguments: 14 15 - x: value 16 - w: weight 17 18 Returns 19 ------- 20 acc: Function 21 Accumulator function. 22 23 Examples 24 -------- 25 > var accumulator = {{alias}}(); 26 > var mu = accumulator() 27 null 28 > mu = accumulator( 2.0, 1.0 ) 29 2.0 30 > mu = accumulator( 2.0, 0.5 ) 31 2.0 32 > mu = accumulator( 3.0, 1.5 ) 33 2.5 34 > mu = accumulator() 35 2.5 36 37 See Also 38 -------- 39