11.2.5 Covariance

covariance( x, y)
Computes the covariance of the datasets x and y which must be of same length.

$\displaystyle c = \frac{1}{n-1} \sum^{n}_{i=1} (x_i - \hat x) (y_i - \hat y)$ (11.13)

lag1_autocorrelation_m( x, y, mean_x, mean_y)
Computes the covariance of the datasets x and y using the given values of the means mean_x and mean_y. The datasets x and y must be of equal length.

$\displaystyle c = \frac{1}{n-1} \sum^{n}_{i=1} (x_i - \var{mean\_x}) (y_i - \var{mean\_y})$ (11.14)