commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christoph M. Friedrich (JIRA)" <>
Subject [jira] [Created] (MATH-568) Code in Userguide for Statistics wrong or deprecated
Date Sat, 07 May 2011 12:42:03 GMT
Code in Userguide for Statistics wrong or deprecated 

                 Key: MATH-568
             Project: Commons Math
          Issue Type: Improvement
    Affects Versions: 2.2
         Environment: windows 7
            Reporter: Christoph M. Friedrich
            Priority: Trivial

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++) {

// 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);

This message is automatically generated by JIRA.
For more information on JIRA, see:

View raw message