Package ffx.numerics.math
Class RunningStatistics
java.lang.Object
ffx.numerics.math.RunningStatistics
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addValue
(double val) Add a value and update key variables.void
addValue
(double val, double weight) Add a value and update key variables.describe()
Describe the Summary Statistics.long
getCount()
Get the count.long
getDOF()
Get the DOF.double
getMax()
Get the max.double
getMean()
Gets the mean as of the last value added.double
getMin()
Get the min.double
Get the population standard deviations.double
Get the population variance.double
Get the standard deviation.double
getSum()
Get the sum.double
Get the variance.double
Get the weight.void
reset()
Add a RunningStatistics object to this one.
-
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
Describe the Summary Statistics.- Returns:
- Return the description.
-