using covariance and lags