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