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