You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2023/02/17 18:16:41 UTC

[commons-statistics] 02/02: Correct inverse survival function definition.

This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-statistics.git

commit 7b62d17a7f34d96580dc7160ade80c7170a488eb
Author: aherbert <ah...@apache.org>
AuthorDate: Fri Feb 17 17:41:32 2023 +0000

    Correct inverse survival function definition.
    
    SF = P(X > x) and not P(X >= x)
---
 .../statistics/distribution/ContinuousDistribution.java       |  4 ++--
 .../commons/statistics/distribution/DiscreteDistribution.java |  4 ++--
 src/site/xdoc/userguide/index.xml                             | 11 ++++++-----
 3 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/ContinuousDistribution.java b/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/ContinuousDistribution.java
index 1860ac6..dfed1bf 100644
--- a/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/ContinuousDistribution.java
+++ b/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/ContinuousDistribution.java
@@ -122,8 +122,8 @@ public interface ContinuousDistribution {
      * returned value is:
      *
      * <p>\[ x = \begin{cases}
-     *       \inf \{ x \in \mathbb R : P(X \ge x) \le p\}   &amp; \text{for } 0 \le p \lt 1 \\
-     *       \inf \{ x \in \mathbb R : P(X \ge x) \lt 1 \}  &amp; \text{for } p = 1
+     *       \inf \{ x \in \mathbb R : P(X \gt x) \le p\}   &amp; \text{for } 0 \le p \lt 1 \\
+     *       \inf \{ x \in \mathbb R : P(X \gt x) \lt 1 \}  &amp; \text{for } p = 1
      *       \end{cases} \]
      *
      * <p>By default, this is defined as {@code inverseCumulativeProbability(1 - p)}, but
diff --git a/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/DiscreteDistribution.java b/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/DiscreteDistribution.java
index 815cb94..bc99e52 100644
--- a/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/DiscreteDistribution.java
+++ b/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/DiscreteDistribution.java
@@ -136,8 +136,8 @@ public interface DiscreteDistribution {
      * the returned value is:
      *
      * <p>\[ x = \begin{cases}
-     *       \inf \{ x \in \mathbb Z : P(X \ge x) \le p\}   &amp; \text{for } 0 \le p \lt 1 \\
-     *       \inf \{ x \in \mathbb Z : P(X \ge x) \lt 1 \}  &amp; \text{for } p = 1
+     *       \inf \{ x \in \mathbb Z : P(X \gt x) \le p\}   &amp; \text{for } 0 \le p \lt 1 \\
+     *       \inf \{ x \in \mathbb Z : P(X \gt x) \lt 1 \}  &amp; \text{for } p = 1
      *       \end{cases} \]
      *
      * <p>If the result exceeds the range of the data type {@code int},
diff --git a/src/site/xdoc/userguide/index.xml b/src/site/xdoc/userguide/index.xml
index ad4e074..4ddcee5 100644
--- a/src/site/xdoc/userguide/index.xml
+++ b/src/site/xdoc/userguide/index.xml
@@ -165,8 +165,8 @@ double p3 = pd.probability(4, 5);
         </p>
         <p>
           \[ x = \begin{cases}
-             \inf \{ x \in \mathbb R : P(X \ge x) \le p\}   &amp; \text{for } 0 \le p \lt 1 \\
-             \inf \{ x \in \mathbb R : P(X \ge x) \lt 1 \}  &amp; \text{for } p = 1
+             \inf \{ x \in \mathbb R : P(X \gt x) \le p\}   &amp; \text{for } 0 \le p \lt 1 \\
+             \inf \{ x \in \mathbb R : P(X \gt x) \lt 1 \}  &amp; \text{for } p = 1
              \end{cases} \]
         </p>
 <source class="prettyprint">
@@ -177,9 +177,10 @@ double x2 = n.inverseSurvivalProbability(1e-300);
 </source>
         <p>
           For discrete <code>F</code>, the definition is the same, with \( \mathbb Z \)
-          (the integers) in place of \( \mathbb R \) (but note that, in the discrete case,
-          the &ge; in the definition can make a difference when <code>p</code> is an attained
-          value of the distribution).
+          (the integers) in place of \( \mathbb R \). Note that, in the discrete case,
+          the strict inequality on \( p \) in the definition can make a difference when
+          \( p \) is an attained value of the distribution. For example moving to the next
+          larger value of \( p \) will return the value \( x + 1 \) for inverse CDF.
         </p>
         <p>
           All distributions provide accessors for the parameters used to create the distribution,