Skip to content

Commit b7764dd

Browse files
authored
Added ICDF for the continuous exponential distribution. (#6641)
* Added ICDF for the continuous exponential distribution. * Removed redundant out of bounds parameter tests.
1 parent eb4e353 commit b7764dd

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

pymc/distributions/continuous.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,6 +1363,15 @@ def logcdf(value, mu):
13631363
msg="lam >= 0",
13641364
)
13651365

1366+
def icdf(value, mu):
1367+
res = -mu * pt.log(1 - value)
1368+
res = check_icdf_value(res, value)
1369+
return check_icdf_parameters(
1370+
res,
1371+
mu >= 0,
1372+
msg="mu >= 0",
1373+
)
1374+
13661375

13671376
class Laplace(Continuous):
13681377
r"""

tests/distributions/test_continuous.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,11 @@ def test_exponential(self):
438438
{"lam": Rplus},
439439
lambda value, lam: st.expon.logcdf(value, 0, 1 / lam),
440440
)
441+
check_icdf(
442+
pm.Exponential,
443+
{"lam": Rplus},
444+
lambda q, lam: st.expon.ppf(q, loc=0, scale=1 / lam),
445+
)
441446

442447
def test_laplace(self):
443448
check_logp(

0 commit comments

Comments
 (0)