statsmodels.stats.proportion.proportion_confint(count, nobs, alpha=0.05, method='normal') [source]

confidence interval for a binomial proportion

  • count (int or array_array_like) – number of successes, can be pandas Series or DataFrame
  • nobs (int) – total number of trials
  • alpha (float in (0, 1)) – significance level, default 0.05
  • method (string in ['normal']) –

    method to use for confidence interval, currently available methods :

    • normal : asymptotic normal approximation
    • agresti_coull : Agresti-Coull interval
    • beta : Clopper-Pearson interval based on Beta distribution
    • wilson : Wilson Score interval
    • jeffreys : Jeffreys Bayesian Interval
    • binom_test : experimental, inversion of binom_test

ci_low, ci_upp – lower and upper confidence level with coverage (approximately) 1-alpha. When a pandas object is returned, then the index is taken from the count.

Return type:

float, ndarray, or pandas Series or DataFrame


Beta, the Clopper-Pearson exact interval has coverage at least 1-alpha, but is in general conservative. Most of the other methods have average coverage equal to 1-alpha, but will have smaller coverage in some cases.

The ‘beta’ and ‘jeffreys’ interval are central, they use alpha/2 in each tail, and alpha is not adjusted at the boundaries. In the extreme case when count is zero or equal to nobs, then the coverage will be only 1 - alpha/2 in the case of ‘beta’.

The confidence intervals are clipped to be in the [0, 1] interval in the case of ‘normal’ and ‘agresti_coull’.

Method “binom_test” directly inverts the binomial test in scipy.stats. which has discrete steps.

TODO: binom_test intervals raise an exception in small samples if one
interval bound is close to zero or one.



Brown, Lawrence D.; Cai, T. Tony; DasGupta, Anirban (2001). “Interval
Estimation for a Binomial Proportion”, Statistical Science 16 (2): 101–133. doi:10.1214/ss/1009213286. TODO: Is this the correct one ?

© 2009–2012 Statsmodels Developers
© 2006–2008 Scipy Developers
© 2006 Jonathan E. Taylor
Licensed under the 3-clause BSD License.