## gov.sandia.cognition.math Class MultivariateStatisticsUtil

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

`public class MultivariateStatisticsUtilextends Object`

Some static methods for computing generally useful multivariate statistics.

Since:
2.0
Author:
Kevin Dixon

Constructor Summary
`MultivariateStatisticsUtil()`

Method Summary
```static <RingType extends Ring<RingType>> RingType ``` `computeMean(Iterable<? extends RingType> data)`
Computes the arithmetic mean (average, expectation, first central moment) of a dataset
`static Pair<Vector,Matrix>` `computeMeanAndCovariance(Iterable<? extends Vectorizable> data)`
Computes the mean and unbiased covariance Matrix of a multivariate data set.
```static <RingType extends Ring<RingType>> RingType ``` `computeSum(Iterable<? extends RingType> data)`
Computes the arithmetic sum of the dataset
`static Matrix` `computeVariance(Collection<? extends Vector> data)`
Computes the variance (second central moment, squared standard deviation) of a dataset.
`static Matrix` ```computeVariance(Collection<? extends Vector> data, Vector mean)```
Computes the variance (second central moment, squared standard deviation) of a dataset
`static Pair<Vector,Matrix>` `computeWeightedMeanAndCovariance(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(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(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(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(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(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(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