Alex Herbert created STATISTICS-47:
--------------------------------------

             Summary: Add an inverse for the SurvivalProbability
                 Key: STATISTICS-47
                 URL: https://issues.apache.org/jira/browse/STATISTICS-47
             Project: Apache Commons Statistics
          Issue Type: Improvement
          Components: distribution
    Affects Versions: 1.0
            Reporter: Alex Herbert


The distributions currently have an inverse for the cumulative probability but 
not the complement (the survival probability). For example for the 
ContinuousDistribution interface:
{code:java}
double cumulativeProbability(double x);
double survivalProbability(double x);
double inverseCumulativeProbability(double p); {code}
Add:
{code:java}
double inverseSurvivalProbability(double p);{code}
It should be possible to update the implementation in the abstract base class 
for the distributions to support using either the CDF or SF for the search 
allowing both to be implemented with the same algorithm.

This would be of benefit for distributions which support a high precision 
survival function, e.g.
{code:java}
final ContinuousDistribution dist = NormalDistribution.of(0, 1);
double x = 10;
double p = dist.survivalProbability(x);
System.out.printf("x = %s%np = sf(x) = %s%n%n icdf(1-p) = %s%n%n-icdf(p) = 
%s%n",
    x, p, dist.inverseCumulativeProbability(1 - p), 
-dist.inverseCumulativeProbability(p));
{code}
Prints:
{noformat}
x = 10.0
p = sf(x) = 7.619853024160595E-24

 icdf(1-p) = Infinity

-icdf(p) = 10.0
{noformat}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to