Step 12: Autocorrelation
- Autocorrelation (serial correlation) means the errors of a time-series regression are correlated from one period to the next: \( \text{Corr}(u_t, u_s) \neq 0 \) for some \( t \neq s \).
- The workhorse model is the AR(1): \( u_t = \rho u_{t-1} + e_t \). Errors \( s \) periods apart then have correlation \( \rho^s \).
- Under strict exogeneity OLS stays unbiased, but the usual standard errors are wrong, usually too small, so “significant” results appear too often.
- Detect it with residual plots, the correlogram, the Durbin–Watson statistic (\( d \approx 2(1-\hat\rho) \)) and the Breusch–Godfrey test (\( TR^2 \sim \chi^2_p \)).
- Fix inference with Newey–West (HAC) standard errors, or quasi-difference the data by Cochrane–Orcutt / Prais–Winsten. Often the real cure is a better model of the dynamics.
Why time-series errors are correlated
In a cross-section of 1,000 workers, one worker’s error tells you nothing about the next: they were sampled independently. A time series is different. The observations come in a fixed order, and if consumption was unusually high relative to income last year, it is likely to be unusually high this year too. With time-series data we write \( t \) for the period and \( T \) for the number of observations:
The classical assumptions for time series state explicitly what random sampling gave us for free: no serial correlation, \( \text{Corr}(u_t, u_s \mid \mathbf{X}) = 0 \) for all \( t \neq s \).
Four mechanisms produce it.
- Inertia. Habits, contracts and expectations carry over from year to year. A burst of consumer optimism fades gradually.
- Omitted persistent variables. If the error contains consumer confidence or credit conditions, which move slowly, successive errors share a common component.
- Misspecified dynamics. If consumption depends on last year’s income too, the missing term sits in the error, and income is persistent. A straight line fitted to a curved trend leaves residuals on one side for long stretches.
- Data construction. Smoothed, interpolated or overlapping-average data have autocorrelation built in.
The AR(1) error model
The simplest and most widely used model is the first-order autoregressive process:
where \( e_t \) is a fresh, unpredictable shock with variance \( \sigma_e^2 \). Each period’s error is a fraction \( \rho \) of last period’s plus something new. Substituting repeatedly shows that \( u_t = e_t + \rho e_{t-1} + \rho^2 e_{t-2} + \cdots \), a weighted sum of all past shocks. Two results follow:
The correlation decays geometrically with the distance between periods. The condition \( |\rho| < 1 \) makes the process stable: shocks die away instead of piling up.
The errors in a quarterly model follow an AR(1) with \( \rho = 0.6 \) and \( \sigma_e = 1 \). Find the standard deviation of \( u_t \) and the correlation between errors one, two and four quarters apart.
Errors a year apart are only weakly related, but neighbouring quarters are strongly linked.
What does it look like? With \( \rho = 0.6 \) a series moves in smooth waves, staying above or below zero for several periods at a time. With \( \rho = -0.6 \) it zig-zags. Counting sign changes is a quick informal check: for independent errors the sign changes about half the time.
What autocorrelation does to OLS
The proof that OLS is unbiased never used the correlation between errors. For time series it needs strict exogeneity: \( E(u_t \mid \mathbf{X}) = 0 \) for every \( t \), so each error is unrelated to the regressors in all periods, past and future. Under that assumption OLS is unbiased whether or not the errors are autocorrelated. Strict exogeneity rules out feedback, such as a central bank raising rates because consumption was unexpectedly strong. It always fails when \( y_{t-1} \) is a regressor, which matters later.
The damage is to the variance. With \( \tilde{x}_t = x_t – \bar{x} \), the variance of the slope includes every covariance between the errors:
The usual formula keeps only the first term. If the errors are AR(1) with parameter \( \rho \) and \( x \) is also persistent, with autocorrelation roughly \( \phi \), the true variance is approximately
When both are positive the factor exceeds 1: the usual standard errors are too small, \( t \) statistics too large, confidence intervals too narrow, and true null hypotheses are rejected too often. Intuitively, fifty years in which the error stays positive for a decade at a time carry less information than fifty independent draws. OLS is also no longer BLUE.
Figure 1 comes from a Monte Carlo experiment in Econometrics Made Simple, Chapter 12: 2,000 samples of \( T = 50 \), a true slope of zero, a regressor with \( \phi = 0.8 \). The mean of \( \hat\beta_1 \) is essentially zero in every design, so OLS stays unbiased. But with \( \rho = 0.55 \) the estimates have a standard deviation of 0.178 while OLS reports 0.114 on average, so a 5% test rejects 20.3% of the time. The formula predicts this well: with \( \rho\phi = 0.44 \) the variance factor is \( 1.44/0.56 = 2.57 \), so the true standard deviation should be \( \sqrt{2.57} = 1.60 \) times the usual one; the simulation gives \( 0.178/0.114 = 1.56 \).
The running example: a consumption function
The book’s file consumption.csv holds annual data for 1975–2024 (\( T = 50 \)) on real consumption, disposable income and household wealth per person, plus a real interest rate. The data are simulated with AR(1) errors and \( \rho = 0.55 \), so we can check each method against the truth. OLS gives
An extra dollar of income goes with about 70 cents more consumption, a dollar of wealth with 3.1 cents, and a one-point rise in the interest rate with $109 less per person. The very high \( R^2 \) is typical of trending series and says little on its own.
Detecting autocorrelation
The correlogram and the residual regression
Always plot the residuals in time order first, as in Figure 2. Then compute the sample autocorrelations \( r_j \) of the residuals at lags \( j = 1, 2, \dots \) and plot them: the correlogram. If the errors are uncorrelated, each \( r_j \) has a standard deviation of about \( 1/\sqrt{T} \), so values outside \( \pm 2/\sqrt{T} \) are individually significant at roughly 5%. For the consumption function that band is \( \pm 2/\sqrt{50} = \pm 0.283 \). The first two autocorrelations are 0.225 and −0.256: both inside the band.
Under AR(1) errors, \( u_t = \rho u_{t-1} + e_t \) is itself a regression. Regress \( \hat{u}_t \) on \( \hat{u}_{t-1} \) and test \( \rho = 0 \) with an ordinary \( t \) test (valid in large samples when the regressors are strictly exogenous). Here \( \hat\rho = 0.227 \), \( t = 1.62 \), \( p = 0.112 \): not significant at 5%.
The Durbin–Watson statistic
The oldest test, still printed by most software, is due to Durbin and Watson (1950):
Expand the numerator and the approximation follows. So \( d \) near 2 means no first-order autocorrelation, values towards 0 mean positive autocorrelation, and values towards 4 mean negative autocorrelation. For the consumption function \( d = 1.509 \); the approximation gives \( 2(1-0.227) = 1.546 \).
The exact distribution of \( d \) depends on the regressors, so printed tables give only a lower bound \( d_L \) and an upper bound \( d_U \) for the critical value. Against positive autocorrelation: reject if \( d < d_L \), do not reject if \( d > d_U \), and the test is inconclusive in between. With \( T = 50 \) and three regressors, the 5% bounds are \( d_L = 1.421 \) and \( d_U = 1.674 \). Our 1.509 is in between. Modern software can compute the exact \( p \)-value: R’s lmtest::dwtest gives 0.018, so at 5% the test does detect positive autocorrelation. Our article on the Durbin–Watson test works through the bounds procedure in detail.
The Breusch–Godfrey test
The Breusch–Godfrey (BG) test, from Breusch (1978) and Godfrey (1978), is an LM test for autocorrelation up to any order \( p \), with \( H_0: \rho_1 = \dots = \rho_p = 0 \).
| Step | What you do |
|---|---|
| 1 | Estimate the model by OLS and save the residuals \( \hat{u}_t \). |
| 2 | Regress \( \hat{u}_t \) on all the original regressors and on \( \hat{u}_{t-1}, \dots, \hat{u}_{t-p} \) (missing early lags set to zero). Record \( R^2_{\hat{u}} \). |
| 3 | \( LM = T \times R^2_{\hat{u}} \), approximately \( \chi^2_p \) under \( H_0 \). Reject if it exceeds the critical value. |
Including the original regressors in step 2 is what keeps the test valid when they are not strictly exogenous, for example when \( y_{t-1} \) is among them. Choose \( p \) to match the data: one or two lags for annual data, four for quarterly, twelve for monthly.
For the consumption function, the BG auxiliary regression with \( p = 1 \) has \( R^2_{\hat{u}} = 0.0523 \). With \( p = 2 \), \( LM = 7.825 \). Carry out both tests at 5%.
The evidence is mixed: the residual regression and BG(1) do not reject; the exact DW test and BG(2) do.
Remedy 1: Newey–West (HAC) standard errors
Since OLS is still unbiased, the simplest response keeps the coefficients and fixes the standard errors. This is the time-series version of the robust standard errors of Step 11. Newey and West (1987) proposed, for simple regression with \( \hat{v}_t = \tilde{x}_t\hat{u}_t \) and lag length \( L \),
The first sum alone is the White variance. The second adds estimated covariances up to lag \( L \), with Bartlett weights that shrink as the lag grows and guarantee a positive variance. The result is valid under heteroskedasticity and autocorrelation of unknown form: HAC standard errors.
In Python: smf.ols(...).fit(cov_type="HAC", cov_kwds={"maxlags": 3}). In R: coeftest(m, vcov = NeweyWest(m, lag = 3, prewhite = FALSE)). In Stata: newey y x1 x2, lag(3) after tsset.
For the consumption function the HAC(3) standard errors are slightly smaller than the usual ones, by 3–4%: 0.0246 against 0.0254 for income. That fits the correlogram: the positive first autocorrelation is roughly offset by the negative second one. Here the correction changes nothing. In real US quarterly data (1959–2009), a static regression of consumption on income gives a usual standard error of 0.00287 and a Newey–West one, with \( L = 4 \), of 0.00645: the \( t \) statistic falls, and the confidence interval widens, by a factor of 2.25.
Remedy 2: feasible GLS by quasi-differencing
If the errors really are AR(1), the model can be transformed so its errors are uncorrelated. Write the model for period \( t \), subtract \( \rho \) times the model for \( t-1 \), and use \( u_t – \rho u_{t-1} = e_t \):
This quasi-differencing leaves the slope unchanged and gives a serially uncorrelated error, so OLS on the transformed data is GLS. In practice \( \rho \) is estimated first, from the OLS residuals, which makes it feasible GLS. Cochrane–Orcutt drops the first observation; Prais–Winsten keeps it, multiplied by \( \sqrt{1-\hat\rho^2} \). Both can be iterated until \( \hat\rho \) settles.
Consumption was 15,297 in 1975 and 15,592 in 1976; income was 18,401 and 18,912. With \( \hat\rho = 0.2262 \), compute the transformed 1976 values and the Prais–Winsten 1975 consumption.
Iterated to convergence, both estimators give \( \hat\rho \approx 0.24 \), an income coefficient of about 0.70 and an interest-rate effect of about −120 instead of −109 (from Econometrics Made Simple, Chapter 12).
FGLS needs more than OLS does. The transformed error must be uncorrelated with \( x_t – \rho x_{t-1} \), which requires strict exogeneity. If interest rates respond to last year’s consumption surprise, FGLS is inconsistent while OLS, which needs only contemporaneous exogeneity, is still consistent. That is why OLS with HAC standard errors is the modern default, with FGLS reserved for short samples with strongly autocorrelated errors and credibly exogenous regressors.
Re-thinking the dynamics
Autocorrelated residuals often signal that something evolving over time has been left out. Rearranging the quasi-differenced model shows that AR(1) errors are a dynamic model in disguise:
Estimating \( y_t \) on \( y_{t-1} \), \( x_t \) and \( x_{t-1} \) without the restriction lets the data decide how \( y \) responds over time. In the consumption data the lags do not help (\( t \) statistics below 0.5), and BG(2) still rejects (\( p = 0.023 \)): these data really are a static relationship with autocorrelated errors. With real data you rarely know that, so it is worth trying.
Practise: 6 questions
Try each one on paper first, then check the worked answer.
EasyQ1. Errors follow \( u_t = 0.7u_{t-1} + e_t \) with \( \sigma_e = 2 \). Find the standard deviation of \( u_t \) and the correlation between \( u_t \) and \( u_{t-3} \). Show worked answer
\( \text{Corr}(u_t, u_{t-3}) = 0.7^3 = 0.343 \).
EasyQ2. A regression on \( T = 60 \) years with two regressors gives \( d = 1.10 \). The 5% bounds are \( d_L = 1.51 \) and \( d_U = 1.65 \). Estimate \( \hat\rho \) and carry out the test against positive autocorrelation. Show worked answer
\( d = 1.10 < d_L = 1.51 \), so reject \( H_0: \rho = 0 \): there is evidence of positive first-order autocorrelation.
(Had \( d \) been between 1.51 and 1.65, the bounds test would be inconclusive.)
MediumQ3. A model on 80 quarters is tested for autocorrelation up to order 4. The Breusch–Godfrey auxiliary regression has \( R^2 = 0.15 \). Compute LM, state the distribution under \( H_0 \) and conclude at 5%. Why does the auxiliary regression include the original regressors? Show worked answer
The 5% critical value is 9.49; \( 12.0 > 9.49 \), so reject (\( p = 0.017 \)).
Including the regressors keeps the test valid when they are not strictly exogenous (for example a lagged dependent variable), because it allows for any correlation between the residuals and the regressors.
MediumQ4. Using the rule \( L \approx 0.75T^{1/3} \), choose the Newey–West lag length for \( T = 120 \) monthly observations, and write down the Bartlett weights \( w_j \). Show worked answer
\( w_j = 1 – j/(L+1) = 1 – j/5 \): \( w_1 = 0.8 \), \( w_2 = 0.6 \), \( w_3 = 0.4 \), \( w_4 = 0.2 \).
More distant covariances get less weight. With monthly data and persistent errors, also check a larger \( L \) such as 12.
MediumQ5. With \( \hat\rho = 0.5 \), the data for 2023 and 2024 are \( y = 200, 212 \) and \( x = 150, 160 \). Compute the quasi-differenced 2024 values, the 2024 value of the intercept column, and the Prais–Winsten factor for the first observation. Show worked answer
\( \tilde{x}_{2024} = 160 – 0.5 \times 150 = 85 \).
Intercept column: \( 1 – 0.5 = 0.5 \).
Prais–Winsten factor: \( \sqrt{1-0.25} = 0.866 \), applied to every variable (and the intercept) in the first year.
ExamQ6. A study regresses annual GDP growth on a persistent policy index (\( \phi \approx 0.6 \)) and reports \( t = 2.5 \) using the usual OLS standard error. The residuals suggest AR(1) errors with \( \rho \approx 0.5 \). (a) Explain why the usual standard error is likely to be too small. [2] (b) Using \( \text{Var} \approx (\sigma^2/\text{SST}_x)(1+\rho\phi)/(1-\rho\phi) \), estimate the corrected \( t \) statistic and say whether the result is still significant at 5%. [3] (c) Recommend a remedy and say what it does and does not change. [2] Show worked answer
(b) \( \rho\phi = 0.3 \); factor \( = 1.3/0.7 = 1.857 \). [M1] Standard errors scale by \( \sqrt{1.857} = 1.363 \). [A1] Corrected \( t \approx 2.5/1.363 = 1.83 < 1.96 \): no longer significant at 5%. [A1]
(c) Newey–West (HAC) standard errors with \( L \approx 0.75T^{1/3} \). [B1] They fix the standard errors and tests but leave the OLS coefficients unchanged. [B1]
Total: 7 marks.
Check yourself
1. A Durbin–Watson statistic close to 2 indicates
2. With strictly exogenous regressors and AR(1) errors, the OLS coefficients are
3. The model includes \( y_{t-1} \) as a regressor. Which test for autocorrelation is valid?
Your score: 0 out of 3
The short version
- Time-series errors are often autocorrelated: inertia, omitted persistent variables, missing dynamics or the way data are built.
- AR(1): \( u_t = \rho u_{t-1} + e_t \), \( \text{Var}(u_t) = \sigma_e^2/(1-\rho^2) \), \( \text{Corr}(u_t,u_{t-s}) = \rho^s \).
- Under strict exogeneity OLS is unbiased, but usual standard errors are too small when errors and regressors are both persistent.
- Detect with plots, the correlogram, \( d \approx 2(1-\hat\rho) \) (bounds, inconclusive region, invalid with \( y_{t-1} \)) and Breusch–Godfrey \( TR^2 \sim \chi^2_p \).
- Newey–West HAC standard errors fix inference (\( L \approx 0.75T^{1/3} \)); Cochrane–Orcutt and Prais–Winsten quasi-difference the data but need strict exogeneity.
- Very high \( R^2 \) with very low \( d \) is a warning of a spurious regression, not a job for HAC.
- The full chapter in Econometrics Made Simple has the code in Python, R and Stata, the real US data and a complete set of exercises with answers.
Studying more than one subject? The Complete Book Bundle gives you every Economics, Statistics, Mathematics and Econometrics book in one download.
Further reading on EconTutorials
Related in-depth articles from our blog:
