This class is based on a paper written by Philippe Pébay:
Formulas for Robust, One-Pass Parallel Computation of Covariances and
Arbitrary-Order Statistical Moments, 2008, Technical Report SAND2008-6212,
Sandia National Laboratories. It computes the covariance for a pair of variables.
Use StorelessCovariance to estimate an entire covariance matrix.
Note
This class is package private as it is only used internally in
the StorelessCovariance class.
| Modifier and Type | Field and Description |
|---|---|
| private boolean | biasCorrected
flag for bias correction |
| private double | covarianceNumerator
the running covariance estimate |
| private double | meanX
the mean of variable x |
| private double | meanY
the mean of variable y |
| private double | n
number of observations |
| Access | Constructor and Description |
|---|---|
| pack-priv | StorelessBivariateCovariance()
Create an empty |
| pack-priv | StorelessBivariateCovariance(final boolean
if biasCorrection)true the covariance estimate is corrected
for bias, i.e. n-1 in the denominator, otherwise there is no bias correction,
i.e. n in the denominator.Create an empty |
| Modifier and Type | Method and Description |
|---|---|
| public void | append(StorelessBivariateCovariance
StorelessBivariateCovariance instance to append. cov)Appends another bivariate covariance calculation to this. |
| public double | |
| public double | |
| public void | increment(final double
the x value x, final double the y value y)Update the covariance estimation with a pair of variables (x, y). |
| biasCorrected | back to summary |
|---|---|
| private boolean biasCorrected flag for bias correction | |
| covarianceNumerator | back to summary |
|---|---|
| private double covarianceNumerator the running covariance estimate | |
| meanX | back to summary |
|---|---|
| private double meanX the mean of variable x | |
| meanY | back to summary |
|---|---|
| private double meanY the mean of variable y | |
| n | back to summary |
|---|---|
| private double n number of observations | |
| StorelessBivariateCovariance | back to summary |
|---|---|
| pack-priv StorelessBivariateCovariance() Create an empty | |
| StorelessBivariateCovariance | back to summary |
|---|---|
| pack-priv StorelessBivariateCovariance(final boolean biasCorrection) Create an empty
| |
| append | back to summary |
|---|---|
| public void append(StorelessBivariateCovariance cov) Appends another bivariate covariance calculation to this.
After this operation, statistics returned should be close to what would
have been obtained by by performing all of the
| |
| getN | back to summary |
|---|---|
| public double getN() Returns the number of observations.
| |
| getResult | back to summary |
|---|---|
| public double getResult() throws NumberIsTooSmallException Return the current covariance estimate.
| |
| increment | back to summary |
|---|---|
| public void increment(final double x, final double y) Update the covariance estimation with a pair of variables (x, y).
| |