W3cubDocs

/Statsmodels

statsmodels.stats.proportion.binom_test

statsmodels.stats.proportion.binom_test(count, nobs, prop=0.5, alternative='two-sided') [source]

Perform a test that the probability of success is p.

This is an exact, two-sided test of the null hypothesis that the probability of success in a Bernoulli experiment is p.

Parameters:
  • count (integer or array_like) – the number of successes in nobs trials.
  • nobs (integer) – the number of trials or observations.
  • prop (float, optional) – The probability of success under the null hypothesis, 0 <= prop <= 1. The default value is prop = 0.5
  • alternative (string in ['two-sided', 'smaller', 'larger']) – alternative hypothesis, which can be two-sided or either one of the one-sided tests.
Returns:

p-value – The p-value of the hypothesis test

Return type:

float

Notes

This uses scipy.stats.binom_test for the two-sided alternative.

© 2009–2012 Statsmodels Developers
© 2006–2008 Scipy Developers
© 2006 Jonathan E. Taylor
Licensed under the 3-clause BSD License.
http://www.statsmodels.org/stable/generated/statsmodels.stats.proportion.binom_test.html