Skip to content

Commit

Permalink
HAP-240 avoid division by zero
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Krusche committed Oct 5, 2016
1 parent 32bda78 commit 03a8e0a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/python/Tools/ci.py
Expand Up @@ -23,6 +23,10 @@ def jeffreysCI(x, n, alpha=0.05):
Brown, Cai and DasGupta: Interval Estimation for a Binomial Proportion.
2001, doi:10.1214/ss/1009213286'''

# HAP-240 avoid division by zero
if n == 0:
return 0.0, 0.0, 1.0

p = x / n
beta = stats.distributions.beta(x+0.5, n-x+0.5)

Expand Down

0 comments on commit 03a8e0a

Please sign in to comment.