Repository: commons-math Updated Branches: refs/heads/MATH_3_X 26ad6ac83 -> c23e9fb1a
Fixed errors / omissions in javadoc regarding NaN return values. JIRA: MATH-1296. Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/c23e9fb1 Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/c23e9fb1 Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/c23e9fb1 Branch: refs/heads/MATH_3_X Commit: c23e9fb1a1612bda5377b9e062d133a96a057cea Parents: 26ad6ac Author: Phil Steitz <phil.ste...@gmail.com> Authored: Wed Dec 2 20:40:19 2015 -0700 Committer: Phil Steitz <phil.ste...@gmail.com> Committed: Wed Dec 2 20:40:19 2015 -0700 ---------------------------------------------------------------------- .../stat/descriptive/DescriptiveStatistics.java | 17 ++++++++++------- .../math3/stat/descriptive/moment/Skewness.java | 5 +++++ 2 files changed, 15 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-math/blob/c23e9fb1/src/main/java/org/apache/commons/math3/stat/descriptive/DescriptiveStatistics.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math3/stat/descriptive/DescriptiveStatistics.java b/src/main/java/org/apache/commons/math3/stat/descriptive/DescriptiveStatistics.java index 31acd24..b215bc8 100644 --- a/src/main/java/org/apache/commons/math3/stat/descriptive/DescriptiveStatistics.java +++ b/src/main/java/org/apache/commons/math3/stat/descriptive/DescriptiveStatistics.java @@ -208,9 +208,12 @@ public class DescriptiveStatistics implements StatisticalSummary, Serializable { /** * Returns the <a href="http://www.xycoon.com/geometric_mean.htm"> - * geometric mean </a> of the available values + * geometric mean </a> of the available values. + * <p> + * See {@link GeometricMean} for details on the computing algorithm.</p> + * * @return The geometricMean, Double.NaN if no values have been added, - * or if the product of the available values is less than or equal to 0. + * or if any negative values have been added. */ public double getGeometricMean() { return apply(geometricMeanImpl); @@ -273,8 +276,8 @@ public class DescriptiveStatistics implements StatisticalSummary, Serializable { /** * Returns the skewness of the available values. Skewness is a * measure of the asymmetry of a given distribution. - * @return The skewness, Double.NaN if no values have been added - * or 0.0 for a value set <=2. + * + * @return The skewness, Double.NaN if less than 3 values have been added. */ public double getSkewness() { return apply(skewnessImpl); @@ -282,9 +285,9 @@ public class DescriptiveStatistics implements StatisticalSummary, Serializable { /** * Returns the Kurtosis of the available values. Kurtosis is a - * measure of the "peakedness" of a distribution - * @return The kurtosis, Double.NaN if no values have been added, or 0.0 - * for a value set <=3. + * measure of the "peakedness" of a distribution. + * + * @return The kurtosis, Double.NaN if less than 4 values have been added. */ public double getKurtosis() { return apply(kurtosisImpl); http://git-wip-us.apache.org/repos/asf/commons-math/blob/c23e9fb1/src/main/java/org/apache/commons/math3/stat/descriptive/moment/Skewness.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math3/stat/descriptive/moment/Skewness.java b/src/main/java/org/apache/commons/math3/stat/descriptive/moment/Skewness.java index 9ecb0dd..b4703eb 100644 --- a/src/main/java/org/apache/commons/math3/stat/descriptive/moment/Skewness.java +++ b/src/main/java/org/apache/commons/math3/stat/descriptive/moment/Skewness.java @@ -34,6 +34,11 @@ import org.apache.commons.math3.util.MathUtils; * where n is the number of values, mean is the {@link Mean} and std is the * {@link StandardDeviation} </p> * <p> + * Note that this statistic is undefined for n < 3. <code>Double.Nan</code> + * is returned when there is not sufficient data to compute the statistic. + * 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 * one of the threads invokes the <code>increment()</code> or