Skip to content

Instantly share code, notes, and snippets.

@Bollegala
Created February 17, 2017 23:33
Show Gist options
  • Save Bollegala/9d304680503d6890e13ce98669e5edd2 to your computer and use it in GitHub Desktop.
Save Bollegala/9d304680503d6890e13ce98669e5edd2 to your computer and use it in GitHub Desktop.
Binomial Exact Test with Clopper-Pearson Confidence Intervals
from statsmodels.stats.proportion import proportion_confint as binofit
# download statmodels from: http://statsmodels.sourceforge.net/
import sys
acc = float(sys.argv[1])
# 0.01 confidence intervals
easy_interval = binofit(acc * 400, 400, 0.01)
print "0.01 interval = ", easy_interval
strict_interval = binofit(acc * 400, 400, 0.001)
print "0.001 interval = ", strict_interval
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment