The OpenD Programming Language

CovarianceAlgo

Covariance algorithms.

See Also: Algorithms for calculating variance.

Values

ValueMeaning
online

Performs Welford's online algorithm for updating covariance. While it only iterates each input once, it can be slower for smaller inputs. However, it is also more accurate. Can also put another CovarianceAccumulator of the same type, which uses the parallel algorithm from Chan et al.

naive

Calculates covariance using E(x*y) - E(x)*E(y) (alowing for adjustments for population/sample variance). This algorithm can be numerically unstable.

twoPass

Calculates covariance using a two-pass algorithm whereby the inputs are first centered and then the sum of products is calculated from that. May be faster than online and generally more accurate than the naive algorithm.

assumeZeroMean

Calculates covariance assuming the mean of the inputs is zero.

hybrid

When slices, slice-like objects, or ranges are the inputs, uses the two-pass algorithm. When an individual data-point is added, uses the online algorithm.

Meta