add covariance matrix calculation