repl.txt (2595B)
1 2 {{alias}}( W[, options] ) 3 Returns an accumulator function which incrementally performs a moving 4 Grubbs' test for detecting outliers. 5 6 Grubbs' test assumes that data is normally distributed. Accordingly, one 7 should first verify that the data can be reasonably approximated by a normal 8 distribution before applying the Grubbs' test. 9 10 The `W` parameter defines the number of values over which to perform Grubbs' 11 test. The minimum window size is 3. 12 13 If provided a value, the accumulator function returns updated test results. 14 If not provided a value, the accumulator function returns the current test 15 results. 16 17 Until provided `W` values, the accumulator function returns `null`. 18 19 The accumulator function returns an object having the following fields: 20 21 - rejected: boolean indicating whether the null hypothesis should be 22 rejected. 23 - alpha: significance level. 24 - criticalValue: critical value. 25 - statistic: test statistic. 26 - df: degrees of freedom. 27 - mean: sample mean. 28 - sd: corrected sample standard deviation. 29 - min: minimum value. 30 - max: maximum value. 31 - alt: alternative hypothesis. 32 - method: method name. 33 - print: method for pretty-printing test output. 34 35 Parameters 36 ---------- 37 W: integer 38 Window size. 39 40 options: Object (optional) 41 Function options. 42 43 options.alpha: number (optional) 44 Significance level. Default: 0.05. 45 46 options.alternative: string (optional) 47 Alternative hypothesis. The option may be one of the following values: 48 49 - 'two-sided': test whether the minimum or maximum value is an outlier. 50 - 'min': test whether the minimum value is an outlier. 51 - 'max': test whether the maximum value is an outlier. 52 53 Default: 'two-sided'. 54 55 Returns 56 ------- 57 acc: Function 58 Accumulator function. 59 60 Examples 61 -------- 62 > var acc = {{alias}}( 20 ); 63 > var res = acc() 64 null 65 > for ( var i = 0; i < 200; i++ ) { 66 ... res = acc( {{alias:@stdlib/random/base/normal}}( 10.0, 5.0 ) ); 67 ... }; 68 > res.print() 69 70 References 71 ---------- 72 - Grubbs, Frank E. 1950. "Sample Criteria for Testing Outlying 73 Observations." _The Annals of Mathematical Statistics_ 21 (1). The Institute 74 of Mathematical Statistics: 27–58. doi:10.1214/aoms/1177729885. 75 - Grubbs, Frank E. 1969. "Procedures for Detecting Outlying Observations in 76 Samples." _Technometrics_ 11 (1). Taylor & Francis: 1–21. doi:10.1080/ 77 00401706.1969.10490657. 78 79 See Also 80 -------- 81