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 2022/11/22 15:41:09 UTC

[commons-statistics] 04/04: Use MathJax for inverse probability 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 b6c6c727691d863b936461ac9c22f0bffaf63e3a
Author: aherbert <ah...@apache.org>
AuthorDate: Tue Nov 22 15:37:25 2022 +0000

    Use MathJax for inverse probability definition
    
    Corrects definition to {x in Z} for discrete distribution
    inverseSurvivalProbability.
---
 .../distribution/ContinuousDistribution.java       | 22 +++++++++++---------
 .../distribution/DiscreteDistribution.java         | 24 +++++++++++++---------
 2 files changed, 26 insertions(+), 20 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 005cb87..8e26379 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
@@ -102,11 +102,12 @@ public interface ContinuousDistribution {
     /**
      * Computes the quantile function of this distribution. For a random
      * variable {@code X} distributed according to this distribution, the
-     * returned value is
-     * <ul>
-     * <li>{@code inf{x in R | P(X<=x) >= p}} for {@code 0 < p <= 1},</li>
-     * <li>{@code inf{x in R | P(X<=x) > 0}} for {@code p = 0}.</li>
-     * </ul>
+     * returned value is:
+     *
+     * <p>\[ x = \begin{cases}
+     *       \inf \{ x \in \mathbb R : P(X \le x) \ge p\}   &amp; \text{for } 0 \lt p \le 1 \\
+     *       \inf \{ x \in \mathbb R : P(X \le x) \gt 0 \}  &amp; \text{for } p = 0
+     *       \end{cases} \]
      *
      * @param p Cumulative probability.
      * @return the smallest {@code p}-quantile of this distribution
@@ -118,11 +119,12 @@ public interface ContinuousDistribution {
     /**
      * Computes the inverse survival probability function of this distribution. For a random
      * variable {@code X} distributed according to this distribution, the
-     * returned value is
-     * <ul>
-     * <li>{@code inf{x in R | P(X>=x) <= p}} for {@code 0 <= p < 1},</li>
-     * <li>{@code inf{x in R | P(X>=x) < 1}} for {@code p = 1}.</li>
-     * </ul>
+     * 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
+     *       \end{cases} \]
      *
      * <p>By default, this is defined as {@code inverseCumulativeProbability(1 - p)}, but
      * the specific implementation may be more accurate.
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 75dcac2..8560bae 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
@@ -111,11 +111,13 @@ public interface DiscreteDistribution {
     /**
      * Computes the quantile function of this distribution.
      * For a random variable {@code X} distributed according to this distribution,
-     * the returned value is
-     * <ul>
-     * <li>{@code inf{x in Z | P(X<=x) >= p}} for {@code 0 < p <= 1},</li>
-     * <li>{@code inf{x in Z | P(X<=x) > 0}} for {@code p = 0}.</li>
-     * </ul>
+     * the returned value is:
+     *
+     * <p>\[ x = \begin{cases}
+     *       \inf \{ x \in \mathbb Z : P(X \le x) \ge p\}   &amp; \text{for } 0 \lt p \le 1 \\
+     *       \inf \{ x \in \mathbb Z : P(X \le x) \gt 0 \}  &amp; \text{for } p = 0
+     *       \end{cases} \]
+     *
      * <p>If the result exceeds the range of the data type {@code int},
      * then {@code Integer.MIN_VALUE} or {@code Integer.MAX_VALUE} is returned.
      * In this case the result of {@link #cumulativeProbability(int)} called
@@ -131,11 +133,13 @@ public interface DiscreteDistribution {
     /**
      * Computes the inverse survival probability function of this distribution.
      * For a random variable {@code X} distributed according to this distribution,
-     * the returned value is
-     * <ul>
-     * <li>{@code inf{x in R | P(X>=x) <= p}} for {@code 0 <= p < 1},</li>
-     * <li>{@code inf{x in R | P(X>=x) < 1}} for {@code p = 1}.</li>
-     * </ul>
+     * 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
+     *       \end{cases} \]
+     *
      * <p>If the result exceeds the range of the data type {@code int},
      * then {@code Integer.MIN_VALUE} or {@code Integer.MAX_VALUE} is returned.
      * In this case the result of {@link #survivalProbability(int)} called