Repository: commons-math
Updated Branches:
  refs/heads/master d9b951c1f -> 26e611458


Made it clear that NaNs or infinities may yield NaN in moment computations.  
JIRA: MATH-1146.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/26e61145
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/26e61145
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/26e61145

Branch: refs/heads/master
Commit: 26e61145839e4da47eb83edfba406ceefc0b67bf
Parents: d9b951c
Author: Phil Steitz <phil.ste...@gmail.com>
Authored: Tue Dec 16 16:49:16 2014 -0700
Committer: Phil Steitz <phil.ste...@gmail.com>
Committed: Tue Dec 16 16:49:16 2014 -0700

----------------------------------------------------------------------
 .../apache/commons/math3/stat/descriptive/moment/Kurtosis.java   | 4 +++-
 .../org/apache/commons/math3/stat/descriptive/moment/Mean.java   | 4 +++-
 .../commons/math3/stat/descriptive/moment/ThirdMoment.java       | 4 +++-
 .../apache/commons/math3/stat/descriptive/moment/Variance.java   | 3 ++-
 4 files changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/26e61145/src/main/java/org/apache/commons/math3/stat/descriptive/moment/Kurtosis.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/commons/math3/stat/descriptive/moment/Kurtosis.java 
b/src/main/java/org/apache/commons/math3/stat/descriptive/moment/Kurtosis.java
index 166535e..be04fbe 100644
--- 
a/src/main/java/org/apache/commons/math3/stat/descriptive/moment/Kurtosis.java
+++ 
b/src/main/java/org/apache/commons/math3/stat/descriptive/moment/Kurtosis.java
@@ -36,7 +36,9 @@ import org.apache.commons.math3.util.MathUtils;
  * {@link StandardDeviation}</p>
  * <p>
  *  Note that this statistic is undefined for n < 4.  <code>Double.Nan</code>
- *  is returned when there is not sufficient data to compute the statistic.</p>
+ *  is returned when there is not sufficient data to compute the statistic.
+ *  Note that Double.NaN may also be returned if the input includes NaN
+ *  and / or infinite values.</p>
  * <p>
  * <strong>Note that this implementation is not synchronized.</strong> If
  * multiple threads access an instance of this class concurrently, and at least

http://git-wip-us.apache.org/repos/asf/commons-math/blob/26e61145/src/main/java/org/apache/commons/math3/stat/descriptive/moment/Mean.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/commons/math3/stat/descriptive/moment/Mean.java 
b/src/main/java/org/apache/commons/math3/stat/descriptive/moment/Mean.java
index 588e9c6..aac3d78 100644
--- a/src/main/java/org/apache/commons/math3/stat/descriptive/moment/Mean.java
+++ b/src/main/java/org/apache/commons/math3/stat/descriptive/moment/Mean.java
@@ -50,7 +50,9 @@ import org.apache.commons.math3.util.MathUtils;
  * Sample Means and Variances," Robert F. Ling, Journal of the American
  * Statistical Association, Vol. 69, No. 348 (Dec., 1974), pp. 859-866. </p>
  * <p>
- *  Returns <code>Double.NaN</code> if the dataset is empty.
+ *  Returns <code>Double.NaN</code> if the dataset is empty. Note that
+ *  Double.NaN may also be returned if the input includes NaN and / or infinite
+ *  values.
  * </p>
  * <strong>Note that this implementation is not synchronized.</strong> If
  * multiple threads access an instance of this class concurrently, and at least

http://git-wip-us.apache.org/repos/asf/commons-math/blob/26e61145/src/main/java/org/apache/commons/math3/stat/descriptive/moment/ThirdMoment.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/commons/math3/stat/descriptive/moment/ThirdMoment.java
 
b/src/main/java/org/apache/commons/math3/stat/descriptive/moment/ThirdMoment.java
index 5314205..2c5331d 100644
--- 
a/src/main/java/org/apache/commons/math3/stat/descriptive/moment/ThirdMoment.java
+++ 
b/src/main/java/org/apache/commons/math3/stat/descriptive/moment/ThirdMoment.java
@@ -38,7 +38,9 @@ import org.apache.commons.math3.util.MathUtils;
  * new value = old value - 3 * (dev/n) * m2 + (n-1) * (n -2) * (dev^3/n^2)</p>
  * <p>
  * Returns <code>Double.NaN</code> if no data values have been added and
- * returns <code>0</code> if there is just one value in the data set.</p>
+ * returns <code>0</code> if there is just one value in the data set.
+ * Note that Double.NaN may also be returned if the input includes NaN
+ * and / or infinite values.</p>
  * <p>
  * <strong>Note that this implementation is not synchronized.</strong> If
  * multiple threads access an instance of this class concurrently, and at least

http://git-wip-us.apache.org/repos/asf/commons-math/blob/26e61145/src/main/java/org/apache/commons/math3/stat/descriptive/moment/Variance.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/commons/math3/stat/descriptive/moment/Variance.java 
b/src/main/java/org/apache/commons/math3/stat/descriptive/moment/Variance.java
index c5435a8..1ba48e9 100644
--- 
a/src/main/java/org/apache/commons/math3/stat/descriptive/moment/Variance.java
+++ 
b/src/main/java/org/apache/commons/math3/stat/descriptive/moment/Variance.java
@@ -234,7 +234,8 @@ public class Variance extends 
AbstractStorelessUnivariateStatistic implements Se
     /**
      * Returns the variance of the entries in the specified portion of
      * the input array, or <code>Double.NaN</code> if the designated subarray
-     * is empty.
+     * is empty.  Note that Double.NaN may also be returned if the input
+     * includes NaN and / or infinite values.
      * <p>
      * See {@link Variance} for details on the computing algorithm.</p>
      * <p>

Reply via email to