Details
-
Improvement
-
Status: Closed
-
Trivial
-
Resolution: Fixed
-
2.2
-
None
-
windows 7
Description
The code for the Statistics examples is not running and can easily be fixed. Example:
// Get a DescriptiveStatistics instance
DescriptiveStatistics stats = new DescriptiveStatistics();
// Add the data from the array
for( int i = 0; i < inputArray.length; i++) {
stats.addValue(inputArray[i]);
}
// Compute some statistics
double mean = stats.getMean();
double std = stats.getStandardDeviation();
double median = stats.getMedian();
Fails with getMedian not found, change to getPercentile(50);
The second Codeexample for StatuUtils states:
// Compute statistics directly from the array
// assume values is a double[] array
double mean = StatUtils.mean(values);
double std = StatUtils.variance(values);
double median = StatUtils.percentile(50);
the last line needs to be changed to: double median = StatUtils.percentile(values,50);