time-to-botec/squiggle/node_modules/@stdlib/stats/binomial-test/docs/repl.txt

93 lines
2.1 KiB
Plaintext
Raw Normal View History

{{alias}}( x[, n][, options] )
Computes an exact test for the success probability in a Bernoulli
experiment.
The returned object comes with a `.print()` method which when invoked will
print a formatted output of the results of the hypothesis test.
Parameters
----------
x: (number|Array<number>)
Number of successes or two-element array with successes and failures.
n: Array<number> (optional)
Total number of observations.
options: Object (optional)
Options.
options.alpha: number (optional)
Number in the interval `[0,1]` giving the significance level of the
hypothesis test. Default: `0.05`.
options.alternative: string (optional)
Indicates whether the alternative hypothesis is that the mean of `x` is
larger than `mu` (`greater`), smaller than `mu` (`less`) or equal to
`mu` (`two-sided`). Default: `'two-sided'`.
options.p: number (optional)
Hypothesized probability under the null hypothesis. Default: `0.5`.
Returns
-------
out: Object
Test result object.
out.alpha: number
Used significance level.
out.rejected: boolean
Test decision.
out.pValue: number
p-value of the test.
out.statistic: number
Sample proportion.
out.ci: Array<number>
1-alpha confidence interval for the success probability.
out.nullValue: number
Assumed success probability under H0.
out.alternative: string
Alternative hypothesis (`two-sided`, `less` or `greater`).
out.method: string
Name of test.
out.print: Function
Function to print formatted output.
Examples
--------
> var out = {{alias}}( 682, 925 )
{
'pValue': ~3.544e-49,
'statistic': ~0.737
// ...
}
> out = {{alias}}( [ 682, 925 - 682 ] )
{
'pValue': ~3.544e-49,
'statistic': ~0.737
// ...
}
> out = {{alias}}( 21, 40, {
... 'p': 0.4,
... 'alternative': 'greater'
... })
{
'pValue': ~0.074,
'statistic': 0.525
// ...
}
See Also
--------