Covariance¶

gsl_stats_covariance(data1, data2)

This function computes the covariance of the datasets data1 and data2 which must both be of the same length n.

$covar = {1 \over (n - 1)} \sum_{i = 1}^{n} (x_{i} - \hat{x}) (y_{i} - \hat{y})$
gsl_stats_covariance_m(data1, data2, mean1, mean2)

This function computes the covariance of the datasets data1 and data2 which must both be of the same length n.

$covar = {1 \over (n - 1)} \sum_{i = 1}^{n} (x_{i} - \hat{x}) (y_{i} - \hat{y})$

This function computes the covariance of the datasets data1 and data2 using the given values of the means, mean1 and mean2. This is useful if you have already computed the means of data1 and data2 and want to avoid recomputing them.