Skip to content

Commit dc8cf20

Browse files
committed
Implement log CDF for Cauchy distribution
1 parent 46a1cbb commit dc8cf20

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

pymc3/distributions/continuous.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,9 @@ def logp(self, value):
870870
- tt.log1p(((value - alpha) / beta)**2),
871871
beta > 0)
872872

873+
def logcdf (self, value):
874+
return tt.log(0.5 + tt.arctan ((value - self.alpha) / self.beta) / np.pi)
875+
873876

874877
class HalfCauchy(PositiveContinuous):
875878
R"""

pymc3/tests/test_distributions.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,8 @@ def test_t(self):
471471
def test_cauchy(self):
472472
self.pymc3_matches_scipy(Cauchy, R, {'alpha': R, 'beta': Rplusbig},
473473
lambda value, alpha, beta: sp.cauchy.logpdf(value, alpha, beta))
474+
self.check_logcdf(Cauchy, R, {'alpha': R, 'beta': Rplusbig},
475+
lambda value, alpha, beta: sp.cauchy.logcdf(value, alpha, beta))
474476

475477
def test_half_cauchy(self):
476478
self.pymc3_matches_scipy(HalfCauchy, Rplus, {'beta': Rplusbig},

0 commit comments

Comments
 (0)