repl.txt (2194B)
1 2 {{alias}}( x[, n][, options] ) 3 Computes an exact test for the success probability in a Bernoulli 4 experiment. 5 6 The returned object comes with a `.print()` method which when invoked will 7 print a formatted output of the results of the hypothesis test. 8 9 Parameters 10 ---------- 11 x: (number|Array<number>) 12 Number of successes or two-element array with successes and failures. 13 14 n: Array<number> (optional) 15 Total number of observations. 16 17 options: Object (optional) 18 Options. 19 20 options.alpha: number (optional) 21 Number in the interval `[0,1]` giving the significance level of the 22 hypothesis test. Default: `0.05`. 23 24 options.alternative: string (optional) 25 Indicates whether the alternative hypothesis is that the mean of `x` is 26 larger than `mu` (`greater`), smaller than `mu` (`less`) or equal to 27 `mu` (`two-sided`). Default: `'two-sided'`. 28 29 options.p: number (optional) 30 Hypothesized probability under the null hypothesis. Default: `0.5`. 31 32 Returns 33 ------- 34 out: Object 35 Test result object. 36 37 out.alpha: number 38 Used significance level. 39 40 out.rejected: boolean 41 Test decision. 42 43 out.pValue: number 44 p-value of the test. 45 46 out.statistic: number 47 Sample proportion. 48 49 out.ci: Array<number> 50 1-alpha confidence interval for the success probability. 51 52 out.nullValue: number 53 Assumed success probability under H0. 54 55 out.alternative: string 56 Alternative hypothesis (`two-sided`, `less` or `greater`). 57 58 out.method: string 59 Name of test. 60 61 out.print: Function 62 Function to print formatted output. 63 64 Examples 65 -------- 66 > var out = {{alias}}( 682, 925 ) 67 { 68 'pValue': ~3.544e-49, 69 'statistic': ~0.737 70 // ... 71 } 72 73 > out = {{alias}}( [ 682, 925 - 682 ] ) 74 { 75 'pValue': ~3.544e-49, 76 'statistic': ~0.737 77 // ... 78 } 79 80 > out = {{alias}}( 21, 40, { 81 ... 'p': 0.4, 82 ... 'alternative': 'greater' 83 ... }) 84 { 85 'pValue': ~0.074, 86 'statistic': 0.525 87 // ... 88 } 89 90 See Also 91 -------- 92