You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Francis Li (JIRA)" <ji...@apache.org> on 2016/11/27 02:33:58 UTC

[jira] [Created] (MATH-1398) Support simple Arithmetic mean without Compute correction factor in second pass?

Francis Li  created MATH-1398:
---------------------------------

             Summary: Support simple Arithmetic mean without Compute correction factor in second pass?
                 Key: MATH-1398
                 URL: https://issues.apache.org/jira/browse/MATH-1398
             Project: Commons Math
          Issue Type: Improvement
         Environment: All
            Reporter: Francis Li 


The mean calculate by this function is different excel.  which just sum/n as first half of function. can we provide another option to calculate normal means? 

org.apache.commons.math3.stat.descriptive.moment.Mean 


public double evaluate(final double[] values,final int begin, final int length)
163    throws MathIllegalArgumentException {
164        if (test(values, begin, length)) {
165            Sum sum = new Sum();
166            double sampleSize = length;
167
168            // Compute initial estimate using definitional formula
169            double xbar = sum.evaluate(values, begin, length) / sampleSize;
170
171            // Compute correction factor in second pass
172            double correction = 0;
173            for (int i = begin; i < begin + length; i++) {
174                correction += values[i] - xbar;
175            }
176            return xbar + (correction/sampleSize);
177        }
178        return Double.NaN;
179    }





--
This message was sent by Atlassian JIRA
(v6.3.4#6332)