Changed lags to AbstractVector and Integer, and avoided recomputing var(x)