Skip to content

Commit

Permalink
Add ppf() for compatibility with scipy.stats.rv_continous.ppf .
Browse files Browse the repository at this point in the history
  • Loading branch information
ahaselsteiner committed Jan 8, 2020
1 parent df71a5b commit 9117b1e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions tests/test_distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,9 @@ def test_exponentiated_weibull_distribution_icdf(self):
x = dist.i_cdf(0.5)
self.assertGreater(x, 0.5)
self.assertLess(x, 1)
x = dist.ppf(0.5)
self.assertGreater(x, 0.5)
self.assertLess(x, 1)

# ICDF(0.9) should be roughly 1.8, see Figure 12
# in https://arxiv.org/pdf/1911.12835.pdf .
Expand Down
5 changes: 5 additions & 0 deletions viroconcom/distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ def i_cdf(self, probabilities, rv_values=None, dependencies=None):

return self._scipy_i_cdf(probabilities, *params)

def ppf(self, probabilities, rv_values=None, dependencies=None):
# Synsynom for i_cdf. Implemented that in external code a ParametricDistribution
# object can be used when scipy.stats.rv_continuous.ppf is meant.
return self.i_cdf(probabilities, rv_values, dependencies)

def pdf(self, x, rv_values=None, dependencies=None):
"""
Probability density function.
Expand Down
2 changes: 1 addition & 1 deletion viroconcom/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.2.6'
__version__ = '1.2.7'

0 comments on commit 9117b1e

Please sign in to comment.