libb.covars

covars(x, y)[source]

Compute sample covariance between x and y.

Parameters:
  • x – First array.

  • y – Second array (same length as x).

Returns:

Sample covariance.

Return type:

float

Example:

>>> x = [3, 2, 4, 5, 6]
>>> y = [9, 7, 12, 15, 17]
>>> "{:.5}".format(covars(x, y))
'6.5'