Package ffx.numerics.math
Class SummaryStatistics
java.lang.Object
ffx.numerics.math.SummaryStatistics
The SummaryStatistics class uses online, stable algorithms to calculate summary statistics from
double arrays/lists, 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).
- Since:
- 1.0
- Author:
- Michael J. Schnieders, Jacob M. Litman
-
Field Summary
Modifier and TypeFieldDescriptionfinal long
Count of observations.final long
Degrees of freedom.final double
Maximum value.final double
Mean value.final double
Minimum value.final double
Sample standard deviation.final double
Population standard deviation.final double
Sum of observations.final double
Sum of weights.final double
Sample variance.final double
Population variance. -
Constructor Summary
ConstructorDescriptionSummaryStatistics
(double[] values) Constructs a static summary of a statistic from provided values.SummaryStatistics
(double[] values, double[] weights, int first, int last, int stride) Constructs a static summary of a statistic from provided values.SummaryStatistics
(double[] values, int first) Constructs a static summary of a statistic from provided values.SummaryStatistics
(double[] values, int first, int last) Constructs a static summary of a statistic from provided values.SummaryStatistics
(double[] values, int first, int last, int stride) Constructs a static summary of a statistic from provided values.Builds a static view of a running statistic. -
Method Summary
Modifier and TypeMethodDescriptiondouble
Computes a 95% confidence interval based on a Student's T-distribution.double
confidenceInterval
(double alpha) Computes a confidence interval based on a Student's T-distribution.describe()
Describe the Summary Statistics.double
getMean()
The mean.double
getSd()
The standard deviation.double
getVar()
The variance.toString()
$
-
Field Details
-
mean
public final double meanMean value. -
var
public final double varSample variance. -
varPopulation
public final double varPopulationPopulation variance. -
sd
public final double sdSample standard deviation. -
sdPopulation
public final double sdPopulationPopulation standard deviation. -
sumWeights
public final double sumWeightsSum of weights. -
min
public final double minMinimum value. -
max
public final double maxMaximum value. -
count
public final long countCount of observations. -
sum
public final double sumSum of observations. -
dof
public final long dofDegrees of freedom.
-
-
Constructor Details
-
SummaryStatistics
Builds a static view of a running statistic.- Parameters:
rs
- Running statistic.
-
SummaryStatistics
public SummaryStatistics(double[] values) Constructs a static summary of a statistic from provided values. Assumes weights are all constant (1.0). Assumes all values will be used.- Parameters:
values
- Values to summarize.
-
SummaryStatistics
public SummaryStatistics(double[] values, int first) Constructs a static summary of a statistic from provided values. Assumes weights are all constant (1.0). Assumes all values from first to end will be used.- Parameters:
values
- Values to summarize.first
- First value to use.
-
SummaryStatistics
public SummaryStatistics(double[] values, int first, int last) Constructs a static summary of a statistic from provided values. Assumes weights are all constant (1.0). Assumes a stride of 1.- Parameters:
values
- Values to summarize.first
- First value to use.last
- Last value to use.
-
SummaryStatistics
public SummaryStatistics(double[] values, int first, int last, int stride) Constructs a static summary of a statistic from provided values. Assumes weights are all constant (1.0).- Parameters:
values
- Values to summarize.first
- First value to use.last
- Last value to use.stride
- Stride between values used.
-
SummaryStatistics
public SummaryStatistics(@Nullable double[] values, @Nullable double[] weights, int first, int last, int stride) Constructs a static summary of a statistic from provided values.- Parameters:
values
- Values to summarize.weights
- Weights for each value.first
- First value to use.last
- Last value to use.stride
- Stride between values used.
-
-
Method Details
-
confidenceInterval
public double confidenceInterval()Computes a 95% confidence interval based on a Student's T-distribution.- Returns:
- 95% confidence interval.
-
confidenceInterval
public double confidenceInterval(double alpha) Computes a confidence interval based on a Student's T-distribution.- Parameters:
alpha
- Alpha (e.g. 0.05 for a 95% CI).- Returns:
- Confidence interval.
-
getMean
public double getMean()The mean.- Returns:
- Return the mean.
-
getSd
public double getSd()The standard deviation.- Returns:
- Return the standard deviation.
-
getVar
public double getVar()The variance.- Returns:
- Return the variance.
-
toString
$ -
describe
Describe the Summary Statistics.- Returns:
- Return the description.
-