Skip to content

Commit

Permalink
Added ICDF for the continuous exponential distribution. (#6641)
Browse files Browse the repository at this point in the history
* Added ICDF for the continuous exponential distribution.

* Removed redundant out of bounds parameter tests.
  • Loading branch information
gokuld authored Apr 1, 2023
1 parent eb4e353 commit b7764dd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pymc/distributions/continuous.py
Original file line number Diff line number Diff line change
Expand Up @@ -1363,6 +1363,15 @@ def logcdf(value, mu):
msg="lam >= 0",
)

def icdf(value, mu):
res = -mu * pt.log(1 - value)
res = check_icdf_value(res, value)
return check_icdf_parameters(
res,
mu >= 0,
msg="mu >= 0",
)


class Laplace(Continuous):
r"""
Expand Down
5 changes: 5 additions & 0 deletions tests/distributions/test_continuous.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,11 @@ def test_exponential(self):
{"lam": Rplus},
lambda value, lam: st.expon.logcdf(value, 0, 1 / lam),
)
check_icdf(
pm.Exponential,
{"lam": Rplus},
lambda q, lam: st.expon.ppf(q, loc=0, scale=1 / lam),
)

def test_laplace(self):
check_logp(
Expand Down

0 comments on commit b7764dd

Please sign in to comment.