repl.txt (2993B)
1 2 {{alias}}( [options] ) 3 Returns an accumulator function which incrementally performs Grubbs' test 4 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 If provided a value, the accumulator function returns updated test results. 11 If not provided a value, the accumulator function returns the current test 12 results. 13 14 If provided `NaN` or a value which, when used in computations, results in 15 `NaN`, the test statistic is `NaN` for all future invocations. 16 17 The accumulator must be provided *at least* three data points before 18 performing Grubbs' test. Until at least three data points are provided, the 19 accumulator returns `null`. 20 21 The accumulator function returns an object having the following fields: 22 23 - rejected: boolean indicating whether the null hypothesis should be 24 rejected. 25 - alpha: significance level. 26 - criticalValue: critical value. 27 - statistic: test statistic. 28 - df: degrees of freedom. 29 - mean: sample mean. 30 - sd: corrected sample standard deviation. 31 - min: minimum value. 32 - max: maximum value. 33 - alt: alternative hypothesis. 34 - method: method name. 35 - print: method for pretty-printing test output. 36 37 Parameters 38 ---------- 39 options: Object (optional) 40 Function options. 41 42 options.alpha: number (optional) 43 Significance level. Default: 0.05. 44 45 options.alternative: string (optional) 46 Alternative hypothesis. The option may be one of the following values: 47 48 - 'two-sided': test whether the minimum or maximum value is an outlier. 49 - 'min': test whether the minimum value is an outlier. 50 - 'max': test whether the maximum value is an outlier. 51 52 Default: 'two-sided'. 53 54 options.init: integer (optional) 55 Number of data points the accumulator should use to compute initial 56 statistics *before* testing for an outlier. Until the accumulator is 57 provided the number of data points specified by this option, the 58 accumulator returns `null`. Default: 100. 59 60 Returns 61 ------- 62 acc: Function 63 Accumulator function. 64 65 Examples 66 -------- 67 > var acc = {{alias}}(); 68 > var res = acc() 69 null 70 > for ( var i = 0; i < 200; i++ ) { 71 ... res = acc( {{alias:@stdlib/random/base/normal}}( 10.0, 5.0 ) ); 72 ... }; 73 > res.print() 74 75 References 76 ---------- 77 - Grubbs, Frank E. 1950. "Sample Criteria for Testing Outlying 78 Observations." _The Annals of Mathematical Statistics_ 21 (1). The Institute 79 of Mathematical Statistics: 27–58. doi:10.1214/aoms/1177729885. 80 - Grubbs, Frank E. 1969. "Procedures for Detecting Outlying Observations in 81 Samples." _Technometrics_ 11 (1). Taylor & Francis: 1–21. doi:10.1080/ 82 00401706.1969.10490657. 83 84 See Also 85 -------- 86