covariance(x, y, bias=False)¶
Calculate covariance of two array.
x – (array_like) A 1-D array containing multiple variables and observations.
y – (array_like) An additional set of variables and observations. y has the same form as that of x.
bias – (boolean) Default normalization (False) is by (N - 1), where N is the number of observations given (unbiased estimate). If bias is True, then normalization is by N.
from mipylib.numeric import stats x1 = [12, 2, 1, 12, 2] x2 = [1, 4, 7, 1, 0] c = stats.cov(x1, x2) print c
>>> run script... -7.28