Class RunningStatistics

java.lang.Object
ffx.numerics.math.RunningStatistics

public class RunningStatistics extends Object
The RunningStatistics class uses online, stable algorithms to calculate summary statistics from a source of doubles, including mean, variance, standard deviation, max, min, sum, and count.

This is intended for accuracy and numerical stability, not necessarily for performance (e.g. using Kahan summation).

This is effectively a dynamic version of SummaryStatistics.

Since:
1.0
Author:
Michael J. Schnieders, Jacob M. Litman
  • Constructor Details

    • RunningStatistics

      public RunningStatistics()
      Constructs new running statistics accumulator.
  • Method Details

    • addValue

      public void addValue(double val)
      Add a value and update key variables.
      Parameters:
      val - Value to add.
    • addValue

      public void addValue(double val, double weight)
      Add a value and update key variables.
      Parameters:
      val - Value to add.
      weight - Weight to give the value.
    • reset

      public void reset()
      Add a RunningStatistics object to this one.
    • getCount

      public long getCount()
      Get the count.
      Returns:
      Returns the count.
    • getDOF

      public long getDOF()
      Get the DOF.
      Returns:
      Returns DOF.
    • getMax

      public double getMax()
      Get the max.
      Returns:
      Returns the max.
    • getMean

      public double getMean()
      Gets the mean as of the last value added.
      Returns:
      Current running mean.
    • getMin

      public double getMin()
      Get the min.
      Returns:
      Returns the min.
    • getPopulationStandardDeviation

      public double getPopulationStandardDeviation()
      Get the population standard deviations.
      Returns:
      The population standard deviation.
    • getPopulationVariance

      public double getPopulationVariance()
      Get the population variance.
      Returns:
      Returns the population variance.
    • getStandardDeviation

      public double getStandardDeviation()
      Get the standard deviation.
      Returns:
      Returns the standard deviation.
    • getSum

      public double getSum()
      Get the sum.
      Returns:
      Returns the sum.
    • getVariance

      public double getVariance()
      Get the variance.
      Returns:
      Returns the variance.
    • getWeight

      public double getWeight()
      Get the weight.
      Returns:
      Returns the weight.
    • describe

      public String describe()
      Describe the Summary Statistics.
      Returns:
      Return the description.