When the errors remember
Ordinary standard errors assume that each error is independent of the others. Overlapping returns break that: the return of January to March and the return of February to April share two months, so their errors move together. The coefficients are still fine, but their classical standard errors are too small and the t-statistics too big. The Newey–West (HAC) covariance repairs this. It starts from the usual 'sandwich' (XᵀX)⁻¹ S (XᵀX)⁻¹ and builds the middle with the products xₜeₜ of each row and its residual: S=Σₜeₜ²xₜxₜᵀ+ Σₖ₌₁^LwₖΣₜeₜeₜ₋ₖ (xₜxₜ₋ₖᵀ+ xₜ₋ₖxₜᵀ), where the Bartlett weights wₖ=1-k/(L+1) shrink the older autocovariances towards zero and keep the matrix valid.
In statsmodels you get the same matrix with sm.OLS(y, X).fit(cov_type='HAC', cov_kwds={'maxlags': L}), and res.tvalues then uses the robust standard errors. Writing it by hand once is worth the effort: you see that with zero lags it collapses to White's heteroskedasticity-robust covariance, that positive autocorrelation makes the robust variance larger than the classical one, and that the choice of lags is a judgement (a common rule is about the length of the overlap). For the three-month returns of SPY, 256 overlapping observations from May 2005 to August 2026 average 2.78% and the classical t is 6.10. With Newey–West it falls to 4.18 with 2 lags and to 3.65 with 6 lags: still significant, but the evidence is weaker than the first number suggested.
- Overlap means memory: overlapping returns have autocorrelated errors, so the classical t-statistic overstates the evidence.
- The sandwich: Newey–West is (X'X)^-1 S (X'X)^-1 with S built from x_t e_t and Bartlett-weighted autocovariances.
- Check the library against your formula: when a by-hand matrix equals the library's, you understand what the option does.
Lab · what's graded
- Overlapping returns10 pts
- The classical t-statistic10 pts
- Bartlett weights10 pts
- Newey–West by hand25 pts
- HAC t-statistics with statsmodels15 pts
- The SPY study30 pts