Uploaded image for project: 'Commons Math'
  1. Commons Math
  2. MATH-568

Code in Userguide for Statistics wrong or deprecated

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 2.2
    • 3.0
    • 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);

      Attachments

        Activity

          People

            Unassigned Unassigned
            christophmf Christoph M. Friedrich
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 0.05h
                0.05h
                Remaining:
                Remaining Estimate - 0.05h
                0.05h
                Logged:
                Time Spent - Not Specified
                Not Specified