statsmodels.stats.proportion.binom_test_reject_interval#

statsmodels.stats.proportion.binom_test_reject_interval(value, nobs, alpha=0.05, alternative='two-sided')[source]#

Rejection region for binomial test for one sample proportion

The interval includes the end points of the rejection region.

Parameters:
valuefloat or array_like

proportion under the Null hypothesis, 0 <= value <= 1.

nobsint or array_like

the number of trials or observations.

alphafloat or array_like, optional

Significance level of the test, default 0.05.

alternative{‘two-sided’, ‘smaller’, ‘larger’}, optional

alternative hypothesis, which can be two-sided or either one of the one-sided tests.

Returns:
x_low, x_uppint or ndarray of int

lower and upper bound of rejection region. The bounds are integers, and arrays with the shape that value, nobs and alpha broadcast to if any of them is an array.

Raises:
ValueError

If value is not in [0, 1], alpha is not in (0, 1), or nobs is not a positive integer. This includes NaN values.

See also

binom_test

Exact binomial test for one sample proportion.

binom_tost_reject_interval

Rejection region of the exact equivalence test.

Notes

For the two-sided alternative, the null hypothesis is rejected if and only if count <= x_low or count >= x_upp. The region is equal-tailed, the probability of each tail is at most alpha / 2 under the null hypothesis. It differs in general from the rejection region of the two-sided test in binom_test, which is based on the probabilities of the outcomes, as in scipy.stats.binomtest.

For the one-sided alternatives, the null hypothesis is rejected if and only if count <= x_low for 'smaller' and count >= x_upp for 'larger'. The other bound is not used, it is nobs for 'smaller' and 0 for 'larger', broadcast to the shape of the result.

Changed in version 0.15.1: value, nobs and alpha can be array_like. Invalid arguments raise a ValueError.