Skip to content

Commit

Permalink
Added ICDF for the Kumaraswamy distribution.
Browse files Browse the repository at this point in the history
  • Loading branch information
gokuld committed Apr 1, 2023
1 parent 8d5b236 commit 9f9215b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pymc/distributions/continuous.py
Original file line number Diff line number Diff line change
Expand Up @@ -1287,6 +1287,16 @@ def logcdf(value, a, b):
msg="a > 0, b > 0",
)

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


class Exponential(PositiveContinuous):
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 @@ -424,6 +424,11 @@ def scipy_log_cdf(value, a, b):
{"a": Rplus, "b": Rplus},
scipy_log_cdf,
)
check_icdf(
pm.Kumaraswamy,
{"a": Rplus, "b": Rplus},
lambda q, a, b: (1 - (1 - q) ** (1 / b)) ** (1 / a),
)

def test_exponential(self):
check_logp(
Expand Down

0 comments on commit 9f9215b

Please sign in to comment.