Uploaded image for project: 'Commons Statistics'
  1. Commons Statistics
  2. STATISTICS-47

Add an inverse for the SurvivalProbability

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Implemented
    • 1.0
    • 1.0
    • distribution
    • None

    Description

      The distributions currently have an inverse for the cumulative probability but not the complement (the survival probability). For example for the ContinuousDistribution interface:

      double cumulativeProbability(double x);
      double survivalProbability(double x);
      double inverseCumulativeProbability(double p); 

      Add:

      double inverseSurvivalProbability(double p);

      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.

      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));
      

      Prints:

      x = 10.0
      p = sf(x) = 7.619853024160595E-24
      
       icdf(1-p) = Infinity
      
      -icdf(p) = 10.0
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            aherbert Alex Herbert
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: