Regression Analysis for Financial Relationships › Robust Standard Errors
Quantitative FinanceAll chapters Regression Analysis for Financial Relationships › Robust Standard ErrorsOne section · Sections in this chapter6 / 12 ↓
When heteroskedasticity or autocorrelation are present, we can still obtain valid inference by using robust standard errors that don't assume constant variance or independence. These methods adjust the standard error calculation to account for the actual error structure, and gives valid confidence intervals and hypothesis tests even when classical assumptions fail. The coefficient estimates themselves remain unbiased; only the uncertainty quantification changes.
Heteroskedasticity-Consistent Standard Errors
White (1980) proposed heteroskedasticity-consistent (HC) standard errors that remain valid even when error variance varies across observations. The idea is to estimate the covariance matrix of using the squared residuals to account for varying error variance. Rather than assuming all errors have the same variance , we allow each observation to have its own variance, estimated by its squared residual.
where:
- : heteroskedasticity-consistent covariance matrix of coefficients
- : matrix of regressors
- : diagonal matrix with squared residuals on the diagonal, accounting for heteroskedasticity
This formula is sometimes called the "sandwich" estimator because the middle term is sandwiched between two copies of . The outer terms handle the variance of the regressors, while the middle term accounts for heteroskedastic errors.
HAC Standard Errors (Newey-West)
For financial time series with both heteroskedasticity and autocorrelation, Newey-West (1987) HAC (Heteroskedasticity and Autocorrelation Consistent) standard errors are the standard approach. These extend the White estimator by also accounting for correlation between errors at different time periods. The key insight is that autocorrelated errors cause cross-products of residuals at different lags to be non-zero, and these must be incorporated into the variance estimate.
where:
- : heteroskedasticity and autocorrelation consistent covariance matrix
- : matrix of regressors
- : estimate of the long-run covariance matrix, accounting for both heteroskedasticity and autocorrelation up to a specified lag
The matrix is computed using a weighted sum of autocovariance matrices at different lags, with weights that decline as the lag increases. This downweighting ensures that distant correlations, which are typically weaker and harder to estimate, have less influence on the variance estimate. The choice of maximum lag (bandwidth) involves a tradeoff: too few lags may miss important autocorrelation, while too many lags reduce precision.
# Compare standard errors: OLS vs. White (HC) vs. Newey-West (HAC)
# Original OLS on data with autocorrelation
model_ols = sm.OLS(stock_ac, X_ac).fit()
# Heteroskedasticity-consistent (HC3)
model_hc = sm.OLS(stock_ac, X_ac).fit(cov_type="HC3")
# HAC (Newey-West with 4 lags)
model_hac = sm.OLS(stock_ac, X_ac).fit(cov_type="HAC", cov_kwds={"maxlags": 4})Comparison of Standard Errors for Beta Coefficient: ------------------------------------------------------------ Method SE(Beta) t-stat p-value ------------------------------------------------------------ OLS (naive) 0.054965 21.89 6.8200e-75 White (HC3) 0.056571 21.26 2.4227e-100 Newey-West (HAC) 0.057793 20.82 3.1594e-96 ------------------------------------------------------------ Note: Larger standard errors (HAC) account for autocorrelation and lead to more conservative t-statistics.
The robust standard errors are typically larger than naive OLS standard errors when autocorrelation is present. This means t-statistics are smaller and p-values are larger, making it harder to reject null hypotheses. This is appropriate: we should be more uncertain about estimates when errors are correlated because we effectively have fewer independent observations. The adjustment prevents us from falsely claiming statistical significance based on overstated precision.
