Skip to content

Commit e00407c

Browse files
committed
only Caucy and Logistic - saving lognormal for another PR
1 parent a5b9eb5 commit e00407c

File tree

2 files changed

+8
-27
lines changed

2 files changed

+8
-27
lines changed

pymc/distributions/continuous.py

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1714,22 +1714,12 @@ def logcdf(value, mu, sigma):
17141714
-np.inf,
17151715
normal_lcdf(mu, sigma, pt.log(value)),
17161716
)
1717-
17181717
return check_parameters(
17191718
res,
17201719
sigma > 0,
17211720
msg="sigma > 0",
17221721
)
17231722

1724-
def icdf(value, mu, sigma):
1725-
res = pt.exp(mu - pt.sqrt(2 * sigma**2) * pt.erfcinv(2 * value))
1726-
res = check_icdf_value(res, value)
1727-
return check_icdf_parameters(
1728-
res,
1729-
sigma > 0,
1730-
msg="sigma > 0",
1731-
)
1732-
17331723

17341724
Lognormal = LogNormal
17351725

@@ -2047,14 +2037,14 @@ def logcdf(value, alpha, beta):
20472037
beta > 0,
20482038
msg="beta > 0",
20492039
)
2050-
2040+
20512041
def icdf(value, alpha, beta):
2052-
res = alpha + beta * pt.tan(np.pi * (value - 0.5))
2042+
res = alpha + beta * pt.tan(np.pi * (value-0.5))
20532043
res = check_icdf_value(res, value)
20542044
return check_parameters(
2055-
res,
2056-
beta > 0,
2057-
msg="beta > 0",
2045+
res,
2046+
beta > 0,
2047+
msg="beta > 0",
20582048
)
20592049

20602050

@@ -3368,14 +3358,15 @@ def logp(value, mu, s):
33683358

33693359
def logcdf(value, mu, s):
33703360
res = -pt.log1pexp(-(value - mu) / s)
3361+
33713362
return check_parameters(
33723363
res,
33733364
s > 0,
33743365
msg="s > 0",
33753366
)
3376-
3367+
33773368
def icdf(value, mu, s):
3378-
res = mu + s * pt.log(value / (1 - value))
3369+
res = mu + s * pt.log(value/(1 - value))
33793370
res = check_icdf_value(res, value)
33803371
return check_parameters(
33813372
res,

tests/distributions/test_continuous.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -502,16 +502,6 @@ def test_lognormal(self):
502502
{"mu": R, "sigma": Rplusbig},
503503
lambda value, mu, sigma: st.lognorm.logcdf(value, sigma, 0, np.exp(mu)),
504504
)
505-
check_icdf(
506-
pm.LogNormal,
507-
{"mu": R, "tau": Rplusbig},
508-
lambda q, mu, tau: st.lognorm.ppf(q, tau**-0.5, 0, np.exp(mu)),
509-
)
510-
check_icdf(
511-
pm.LogNormal,
512-
{"mu": R, "sigma": Rplusbig},
513-
lambda q, mu, sigma: st.lognorm.ppf(q, sigma, 0, np.exp(mu)),
514-
)
515505

516506
def test_studentt_logp(self):
517507
check_logp(

0 commit comments

Comments
 (0)