pythonstatisticsconfidence-intervalab-testing

Confidence interval for the difference between two proportions in Python


For example, in an AB test the A population could have 1000 data points, of which 100 are successes. While B could have 2000 data points and 220 successes. This gives A a success proportion of 0.1 and B 0.11, the delta of which is 0.01. How can I calculate this confidence interval around this delta in python?

Stats models can do this for one sample, but seemingly does not have a package to deal with the difference between two samples as is necessary for an AB test. (http://www.statsmodels.org/dev/generated/statsmodels.stats.proportion.proportion_confint.html)


Solution

  • statsmodels package now has confint_proportions_2indep, which gets the confidence interval for comparing two proportions you can check details in docs https://www.statsmodels.org/stable/generated/statsmodels.stats.proportion.confint_proportions_2indep.html