Documentation API of the 'org.apache.commons.math3.stat.descriptive.moment.Mean' Java class
Mean
org.apache.commons.math3.stat.descriptive.moment

Class Mean

  • All Implemented Interfaces:
    Serializable, StorelessUnivariateStatistic, UnivariateStatistic, WeightedEvaluation, MathArrays.Function


    public class Meanextends AbstractStorelessUnivariateStatisticimplements Serializable, WeightedEvaluation

    Computes the arithmetic mean of a set of values. Uses the definitional formula:

    mean = sum(x_i) / n

    where n is the number of observations.

    When increment(double) is used to add data incrementally from a stream of (unstored) values, the value of the statistic that getResult() returns is computed using the following recursive updating algorithm:

    1. Initialize m = the first value
    2. For each additional value, update using
      m = m + (new value - m) / (number of observations)

    If AbstractStorelessUnivariateStatistic.evaluate(double[]) is used to compute the mean of an array of stored values, a two-pass, corrected algorithm is used, starting with the definitional formula computed using the array of stored values and then correcting this by adding the mean deviation of the data values from the arithmetic mean. See, e.g. "Comparison of Several Algorithms for Computing Sample Means and Variances," Robert F. Ling, Journal of the American Statistical Association, Vol. 69, No. 348 (Dec., 1974), pp. 859-866.

    Returns Double.NaN if the dataset is empty.

    Note that this implementation is not synchronized. If multiple threads access an instance of this class concurrently, and at least one of the threads invokes the increment() or clear() method, it must be synchronized externally.
    See Also:
    Serialized Form

Warning: You cannot see the full API documentation of this class since the access to the DatMelt documentation for third-party Java classes is denied. Guests can only view jhplot Java API. To view the complete description of this class and its methods, please request the full DataMelt membership.

If you are already a full member, please login to the DataMelt member area before visiting this documentation.