Weighting with covariance matrix