gov.sandia.cognition.math

## Class MultivariateStatisticsUtil

• java.lang.Object
• gov.sandia.cognition.math.MultivariateStatisticsUtil

• ```public class MultivariateStatisticsUtil
extends java.lang.Object```
Some static methods for computing generally useful multivariate statistics.
Since:
2.0
Author:
Kevin Dixon
• ### Constructor Summary

Constructors
Constructor and Description
`MultivariateStatisticsUtil()`
• ### Method Summary

All Methods
Modifier and Type Method and Description
`static <RingType extends Ring<RingType>>RingType` `computeMean(java.lang.Iterable<? extends RingType> data)`
Computes the arithmetic mean (average, expectation, first central moment) of a dataset
`static Pair<Vector,Matrix>` `computeMeanAndCovariance(java.lang.Iterable<? extends Vectorizable> data)`
Computes the mean and unbiased covariance Matrix of a multivariate data set.
`static <RingType extends Ring<RingType>>RingType` `computeSum(java.lang.Iterable<? extends RingType> data)`
Computes the arithmetic sum of the dataset
`static Matrix` `computeVariance(java.util.Collection<? extends Vector> data)`
Computes the variance (second central moment, squared standard deviation) of a dataset.
`static Matrix` ```computeVariance(java.util.Collection<? extends Vector> data, Vector mean)```
Computes the variance (second central moment, squared standard deviation) of a dataset
`static Pair<Vector,Matrix>` `computeWeightedMeanAndCovariance(java.lang.Iterable<? extends WeightedValue<? extends Vectorizable>> data)`
Computes the mean and biased covariance Matrix of a multivariate weighted data set.
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Constructor Detail

• #### MultivariateStatisticsUtil

`public MultivariateStatisticsUtil()`
• ### Method Detail

• #### computeSum

`public static <RingType extends Ring<RingType>> RingType computeSum(java.lang.Iterable<? extends RingType> data)`
Computes the arithmetic sum of the dataset
Type Parameters:
`RingType` - The type of data to compute the sum over, which must implement the `Ring` interface.
Parameters:
`data` - Dataset to consider
Returns:
Arithmetic sum of the given dataset
• #### computeMean

`public static <RingType extends Ring<RingType>> RingType computeMean(java.lang.Iterable<? extends RingType> data)`
Computes the arithmetic mean (average, expectation, first central moment) of a dataset
Type Parameters:
`RingType` - The type of data to compute the sum over, which must implement the `Ring` interface.
Parameters:
`data` - Collection of Vectors to consider
Returns:
Arithmetic mean of the given dataset
• #### computeVariance

`public static Matrix computeVariance(java.util.Collection<? extends Vector> data)`
Computes the variance (second central moment, squared standard deviation) of a dataset. Computes the mean first, then computes the variance. If you already have the mean, then use the two-argument computeVariance(data,mean) method to save duplication of effort
Parameters:
`data` - Collection of Vector to consider
Returns:
Variance of the given dataset
• #### computeVariance

```public static Matrix computeVariance(java.util.Collection<? extends Vector> data,
Vector mean)```
Computes the variance (second central moment, squared standard deviation) of a dataset
Parameters:
`data` - Collection of Doubles to consider
`mean` - Pre-computed mean (or central value) of the dataset
Returns:
Full covariance matrix of the given dataset
• #### computeMeanAndCovariance

`public static Pair<Vector,Matrix> computeMeanAndCovariance(java.lang.Iterable<? extends Vectorizable> data)`
Computes the mean and unbiased covariance Matrix of a multivariate data set.
Parameters:
`data` - Data set to consider
Returns:
Mean and unbiased Covariance
• #### computeWeightedMeanAndCovariance

`public static Pair<Vector,Matrix> computeWeightedMeanAndCovariance(java.lang.Iterable<? extends WeightedValue<? extends Vectorizable>> data)`
Computes the mean and biased covariance Matrix of a multivariate weighted data set.
Parameters:
`data` - Data set to consider
Returns:
Mean and biased Covariance