Skip to content

covariance_s

Sample covariance.

v = covariance_s(array1, array2)

Returns the sample covariance — sum((x - mean(x)) * (y - mean(y))) / (n-1). Equivalent to Excel’s COVARIANCE.S.

covariance_s([1 2 3 4], [4 3 2 1]) % -1.667
  • covariance_p — Population covariance.
  • pearson — Pearson product-moment correlation coefficient.
  • cov — Covariance.