repl.txt (1249B)
1 2 {{alias}}( W ) 3 Returns an accumulator function which incrementally computes a moving mid- 4 range. 5 6 The mid-range is the arithmetic mean of maximum and minimum values. 7 Accordingly, the mid-range is the midpoint of the range and a measure of 8 central tendency. 9 10 The `W` parameter defines the number of values over which to compute 11 the moving mid-range. 12 13 If provided a value, the accumulator function returns an updated moving mid- 14 range. If not provided a value, the accumulator function returns the current 15 moving mid-range. 16 17 As `W` values are needed to fill the window buffer, the first `W-1` returned 18 values are calculated from smaller sample sizes. Until the window is full, 19 each returned value is calculated from all provided values. 20 21 Parameters 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 mr = accumulator() 35 null 36 > mr = accumulator( 2.0 ) 37 2.0 38 > mr = accumulator( -5.0 ) 39 -1.5 40 > mr = accumulator( 3.0 ) 41 -1.0 42 > mr = accumulator( 5.0 ) 43 0.0 44 > mr = accumulator() 45 0.0 46 47 See Also 48 -------- 49