[
https://issues.apache.org/jira/browse/MATH-1296?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15036575#comment-15036575
]
Otmar Ertl commented on MATH-1296:
----------------------------------
Gilles, I agree, it is the documentation that needs to be fixed. Geometric mean
should be 0.
By the way, I have checked the documentations for Kurtosis.java and
Skewness.java. The documentation for Kurtosis.java already describes that NaN
is returned for less than 4 values. The documentation of Skewness.java also
needs to be improved, the corresponding information is hidden in the
documentation of its evaluate() method.
> DescriptiveStatistics return geometric mean as 0 when product of values is
> zero, expected to return NaN
> -------------------------------------------------------------------------------------------------------
>
> Key: MATH-1296
> URL: https://issues.apache.org/jira/browse/MATH-1296
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 3.4.1
> Reporter: Anmol
> Priority: Trivial
> Labels: easyfix
> Original Estimate: 168h
> Remaining Estimate: 168h
>
> @Test
> public void test() {
> DescriptiveStatistics stats = new DescriptiveStatistics();
> stats.addValue(1);
> stats.addValue(2);
> stats.addValue(4);
> System.out.println(stats.getGeometricMean()); //prints 2
> stats.addValue(0);
> System.out.println(stats.getGeometricMean()); //prints 0,
> expected NaN as per the documentation
> }
> The class in consideration is:
> org.apache.commons.math3.stat.descriptive.DescriptiveStatistics
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)