diff --git a/pymc/distributions/discrete.py b/pymc/distributions/discrete.py index 958c9785e9..aaa30e620c 100644 --- a/pymc/distributions/discrete.py +++ b/pymc/distributions/discrete.py @@ -173,6 +173,10 @@ def logcdf(value, n, p): msg="n >= 0, 0 <= p <= 1", ) + def icdf(value, n, p): + cdf_vals = Binomial.logcdf(pt.arange(0, n), n, p) + return pt.argmax(cdf_vals > pt.log(value)) + class BetaBinomial(Discrete): R"""