-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add icdf functions for Lognormal, Half Cauchy and Half Normal distributions #6766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
711ee4b
59938f7
c9e48ec
1035cc6
8129cbd
63680c2
63fd6ba
08f6974
cdc104c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -856,6 +856,15 @@ def logcdf(value, loc, sigma): | |
| msg="sigma > 0", | ||
| ) | ||
|
|
||
| def icdf(value, loc, sigma): | ||
| res = Normal.icdf((value + 1.0) / 2.0, loc, sigma) | ||
|
||
| res = check_icdf_value(res, value) | ||
| return check_icdf_parameters( | ||
| res, | ||
| sigma > 0, | ||
| msg="sigma > 0", | ||
| ) | ||
amyoshino marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| class WaldRV(RandomVariable): | ||
| name = "wald" | ||
|
|
@@ -1714,12 +1723,22 @@ def logcdf(value, mu, sigma): | |
| -np.inf, | ||
| normal_lcdf(mu, sigma, pt.log(value)), | ||
| ) | ||
|
|
||
| return check_parameters( | ||
| res, | ||
| sigma > 0, | ||
| msg="sigma > 0", | ||
| ) | ||
|
|
||
| def icdf(value, mu, sigma): | ||
| res = pt.exp(Normal.icdf(value, mu, sigma)) | ||
| res = check_icdf_value(res, value) | ||
amyoshino marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return check_icdf_parameters( | ||
| res, | ||
| sigma > 0, | ||
| msg="sigma > 0", | ||
| ) | ||
amyoshino marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| Lognormal = LogNormal | ||
|
|
||
|
|
@@ -2121,6 +2140,15 @@ def logcdf(value, loc, beta): | |
| msg="beta > 0", | ||
| ) | ||
|
|
||
| def icdf(value, loc, beta): | ||
| res = loc + beta * pt.tan(np.pi * (value) / 2.0) | ||
| res = check_icdf_value(res, value) | ||
| return check_parameters( | ||
| res, | ||
| beta > 0, | ||
| msg="beta > 0", | ||
| ) | ||
|
|
||
|
|
||
| class Gamma(PositiveContinuous): | ||
| r""" | ||
|
|
||


Uh oh!
There was an error while loading. Please reload this page.