The OpenD Programming Language

CorrelationAlgo

Correlation algorithms.

See Also: CovarianceAlgo Algorithms for calculating variance.

Values

ValueMeaning
online

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

naive

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

twoPass

Calculates correlation 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 correlation assuming the mean of the inputs is zero.

assumeStandardized

Calculates correlation assuming the mean of the inputs is zero and standard deviation is one.

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