29 Apr
2015
29 Apr
'15
3:51 p.m.
The weighted covariance function in PR #4960 <https://github.com/numpy/numpy/pull/4960> is evolving to the following, where frequency weights are `f` and reliability weights are `a`. Assume that the observations are in the columns of the observation matrix. the steps to compute the weighted covariance are as follows:: >>> w = f * a >>> v1 = np.sum(w) >>> v2 = np.sum(a * w) >>> m -= np.sum(m * w, axis=1, keepdims=True) / v1 >>> cov = np.dot(m * w, m.T) * v1 / (v1**2 - ddof * v2) Note that when ``a == 1``, the normalization factor ``v1 / (v1**2 - ddof * v2)`` goes over to ``1 / (np.sum(f) - ddof)`` as it should. This is probably a good time for comments from all the kibitzers out there. Chuck