statsmodels.stats.proportion.confint_proportions_2indep

statsmodels.stats.proportion.confint_proportions_2indep(count1, nobs1, count2, nobs2, method=None, compare='diff', alpha=0.05, correction=True)[source]

Confidence intervals for comparing two independent proportions.

This assumes that we have two independent binomial samples.

Parameters:
count1 : float

Count and sample size for first sample.

nobs1 : float

Count and sample size for first sample.

count2 : float

Count and sample size for the second sample.

nobs2 : float

Count and sample size for the second sample.

method : str

Method for computing confidence interval. If method is None, then a default method is used. The default might change as more methods are added.

diff:
  • ’wald’,

  • ’agresti-caffo’

  • ’newcomb’ (default)

  • ’score’

ratio:
  • ’log’

  • ’log-adjusted’ (default)

  • ’score’

odds-ratio:
  • ’logit’

  • ’logit-adjusted’ (default)

  • ’score’

compare : string in ['diff', 'ratio' 'odds-ratio']

If compare is diff, then the confidence interval is for diff = p1 - p2. If compare is ratio, then the confidence interval is for the risk ratio defined by ratio = p1 / p2. If compare is odds-ratio, then the confidence interval is for the odds-ratio defined by or = p1 / (1 - p1) / (p2 / (1 - p2).

alpha : float

Significance level for the confidence interval, default is 0.05. The nominal coverage probability is 1 - alpha.

Return type:

low, upp

Notes

Status: experimental, API and defaults might still change.

more methods will be added.

References