org.apache.commons.math4.stat.descriptive.SummaryStatistics
SummaryStatistics appears to use a naive implementation of min(). It uses the default constructor of the internal container which defaults to a zero value. If your data set is greater than zero the statistics will never represent the true minimum.
I'm hoping there is a way to initialize it with a known value to avoid this, but I am not seeing that. Is there a way around this without using my own implementation for statistics?
thanks
SummaryStatitics
uses theMin
univariate statistic object to compute minimums.Based on the implementation for the 3.6.1 release,
Min
is initialized toDouble.NaN
.When adding new values to
SummaryStatistics
,Min
checks if a new value is less than the current minimum as well as checks if the current minimum isDouble.NaN
. If either of those conditions is true, the new value becomes the minimum.In short,
SummaryStatistics
correctly computes the minimum even when all added values are positive.As example:
generates the following output: