Instant PDF download, name-and-email checkout. Complete Book Bundle: every Economics, Statistics, Mathematics and Econometrics book
Econometrics guide, Unit 5, step 18 of 20Previous stepNext step

Step 18: Stationarity and Unit Root Tests

SyllabusUndergraduate econometrics · Wooldridge, Introductory Econometrics, Ch. 11 and Ch. 18
In 30 seconds
  • A stationary series has a constant mean, a constant variance and a correlation pattern that does not depend on the date. It keeps returning to its mean.
  • A random walk, \( y_t = y_{t-1} + e_t \), has a unit root: every shock is permanent and the variance grows with time, \( \operatorname{Var}(y_t) = t\sigma_e^2 \).
  • Regressing one random walk on another, unrelated one gives a “significant” slope about 75% of the time with 100 observations: a spurious regression. In differences the rate falls back to about 5%.
  • The augmented Dickey–Fuller (ADF) test has a unit root as its null and needs special critical values: about \( -2.86 \) at 5% with a constant, \( -3.41 \) with a constant and trend. The KPSS test has stationarity as its null; use both together.
  • Exam point: never read the unit-root p-value from the ordinary regression table. For log US real GDP that table says \( p = 0.018 \); the correct MacKinnon p-value is 0.389.
Video lesson coming soonA short animated lesson for this step will appear here.

What you will learn

  • the definitions of weak stationarity and weak dependence, and how to recognise each in a time plot;
  • four benchmark processes: white noise, a stationary AR(1), a random walk and a random walk with drift;
  • the difference between trend-stationary and difference-stationary series, and the order of integration;
  • why spurious regressions happen, with the Granger–Newbold simulation;
  • how to run and interpret Dickey–Fuller, augmented Dickey–Fuller and KPSS tests;
  • what to do once you find a unit root: difference, or test for cointegration.

Stationary and non-stationary series

Step 12 ended with a warning. Regressing US real consumption on real disposable income, quarter by quarter from 1959 to 2009, gave \( R^2 = 0.998 \) and a Durbin–Watson statistic of 0.253. The fit looked perfect, but the residuals wandered away from zero for decades. Before you trust any regression between time series, you need to know whether the series settle around a fixed mean or trend, or wander without an anchor.

Key termA series is weakly stationary (covariance stationary) if (i) its mean is the same in every period, (ii) its variance is finite and the same in every period, and (iii) \( \operatorname{Cov}(y_t, y_{t+h}) \) depends only on the gap \( h \), not on the date \( t \). A stationary series is weakly dependent if \( \operatorname{Corr}(y_t, y_{t+h}) \to 0 \) quickly as \( h \) grows.
Econometrics Made Simple textbook coverChapter 18 of Econometrics Made Simple covers this in full: stationarity, random walks, spurious regression and the ADF and KPSS tests, with the simulations in code.Get the textbook · $15

A useful picture: cut the time plot of a stationary series into pieces and shuffle them, and no piece gives away whether it came from the start or the end. Real series usually fail the definition in one of four ways: a trend (the mean rises, as with real GDP), a stochastic trend (the series wanders with no level to return to), seasonality, or a structural break. Weak dependence matters because the law of large numbers and central limit theorem behind large-sample OLS inference were proved for independent data; with stationary, weakly dependent data, versions of both still hold.

Four benchmark processes

Each process is built from a white noise shock \( e_t \): mean zero, constant variance \( \sigma_e^2 \), and no correlation between any two periods.

ProcessEquationMeanVarianceStationary?
White noise\( y_t = e_t \)0\( \sigma_e^2 \)Yes
AR(1), \( |\rho| < 1 \)\( y_t = \rho y_{t-1} + e_t \)0\( \sigma_e^2/(1-\rho^2) \)Yes, and weakly dependent
Random walk\( y_t = y_{t-1} + e_t \)\( y_0 \)\( t\sigma_e^2 \)No: the variance grows
Random walk with drift\( y_t = \alpha + y_{t-1} + e_t \)\( y_0 + \alpha t \)\( t\sigma_e^2 \)No: trend in mean and variance

Substituting backwards, the AR(1) is \( y_t = e_t + \rho e_{t-1} + \rho^2 e_{t-2} + \cdots \): a shock from \( j \) periods ago still counts, but with weight \( \rho^j \), which shrinks. The AR(1) is mean-reverting, and \( \operatorname{Corr}(y_t, y_{t+h}) = \rho^h \). Set \( \rho = 1 \) and the random walk is \( y_t = y_0 + e_1 + e_2 + \cdots + e_t \): every shock that has ever hit the series is still in it with full weight.

\[ \text{Random walk: } E(y_t) = y_0, \qquad \operatorname{Var}(y_t) = t\,\sigma_e^2, \qquad \operatorname{Corr}(y_t, y_{t+h}) = \sqrt{\frac{t}{t+h}} \]

After 100 periods with \( \sigma_e = 1 \) a random walk has standard deviation 10; after 200, 14.1. The correlation barely dies out: with \( t = 100 \), \( \operatorname{Corr}(y_{100}, y_{110}) = \sqrt{100/110} = 0.953 \), and even a 100-period gap leaves \( \sqrt{0.5} = 0.707 \). In a random walk shocks are permanent; “unit root” refers to \( \rho = 1 \).

Same shocks, two processes: a stationary AR(1) and a random walk
AR(1), ρ = 0.8Random walk, ρ = 1
0255075100125150175200-30-20-100102030tyrandom walk band: ±2√tAR(1) band: ±3.33
Figure 1. Both series are built from the same 200 standard normal shocks (seed 18, as in the book). The AR(1) keeps returning to zero and stays inside a band of fixed width, ±3.33. The random walk averages 5.05 in the first 100 periods and -5.48 in the next 100, although its true mean is zero, and its ±2 standard deviation band widens with √t. Chapter 18.

The book’s simulation of 5,000 independent paths shows the variance formulas at work. The AR(1) variance settles at about 2.8 whatever the date, close to the theoretical \( 1/(1-0.8^2) = 2.78 \). The random walk’s variance is close to \( t \): 100.63 at \( t = 100 \) and 198.37 at \( t = 200 \).

Worked example

A quarterly series follows \( y_t = 0.8\,y_{t-1} + e_t \) with \( \sigma_e = 1 \). (a) Find its variance. (b) How much of a one-unit shock is left after 4 and after 12 quarters? (c) Find the half-life of a shock. (d) Answer (b) for a random walk.

Step 1\( \operatorname{Var}(y_t) = 1/(1-0.64) = 2.78 \), a standard deviation of 1.67.
Step 2After \( h \) quarters \( \rho^h \) remains: \( 0.8^4 = 0.410 \) and \( 0.8^{12} = 0.069 \).
Step 3Solve \( 0.8^h = 0.5 \): \( h = \ln 0.5/\ln 0.8 = 3.11 \) quarters.
Step 4In a random walk the whole shock remains for ever: \( 1^4 = 1^{12} = 1 \). There is no half-life.

Trend-stationary or difference-stationary?

Most macroeconomic series grow, and there are two very different ways to generate growth. A trend-stationary series is \( y_t = \alpha_0 + \alpha_1 t + u_t \) with \( u_t \) stationary: deviations from the trend line die out. A difference-stationary series has \( \Delta y_t \) stationary but not \( y_t \), as in the random walk with drift: deviations from any line are permanent. Over a few decades the two can look identical, but the economics differ sharply. If real GDP is trend-stationary, a recession is a temporary dip and output catches up. If it has a unit root, part of every recession’s lost output is lost for ever.

The fixes differ too. Detrend a trend-stationary series (include \( t \) as a regressor, as in Step 17). Difference a difference-stationary one (use \( \Delta y_t \), or the growth rate \( 100\,\Delta\log y_t \)). Detrending a random walk leaves residuals that still wander and can show fake cycles. Differencing a series that was already stationary, over-differencing, introduces negative autocorrelation: for white noise, \( \operatorname{Corr}(\Delta e_t, \Delta e_{t-1}) = -0.5 \).

Key termA series is integrated of order \( d \), I(\( d \)), if it must be differenced \( d \) times to become stationary. An I(0) series is already stationary; an I(1) series, such as a random walk, has a stationary first difference. “Has a unit root” and “is I(1)” mean the same in practice. Growth rates and inflation are natural candidates for I(0); the logs of GDP, consumption and prices for I(1).

Spurious regression

Regress one random walk on another, completely independent one. The true slope is zero. Granger and Newbold (1974) showed by simulation that the usual t test rejects far more often than 5% of the time. The book repeats their experiment 2,000 times for each sample size.

Spurious regression: how often is an unrelated slope ‘significant’? % of 2,000 regressions
Levels (two independent random walks)First differences of the same series
T = 50T = 100T = 200020406080100% rejecting65.2%5.8%74.9%5.1%82.1%4.9%nominal 5%
Figure 2. Share of 2,000 regressions of one independent random walk on another in which the slope has |t| > 1.96. In levels the test rejects far too often, and more often as T grows; in differences it rejects about 5% of the time, as it should. Simulation results from Econometrics Made Simple, Chapter 18.

With \( T = 100 \), the slope is “significant” in 74.9% of regressions, the median \( R^2 \) is 0.164 and the median Durbin–Watson statistic is 0.156, far below 2. The problem gets worse with more data: 65.2% at \( T = 50 \), 82.1% at \( T = 200 \). The reason is that the error, \( u_t = y_t-\beta_0 \), is itself a random walk, so every assumption behind OLS inference fails; Phillips (1986) proved the t statistic keeps growing with \( T \). A practical warning sign from Granger and Newbold: if \( R^2 \) is larger than the Durbin–Watson statistic, suspect a spurious regression. Our post on the Durbin–Watson test explains the statistic.

Common mistake“The series are strongly correlated, so they must be related.” Any two trending series, such as mobile phones in use and life expectancy, are highly correlated in levels. First establish whether the series are I(0) or I(1), and if they are I(1), whether they are cointegrated.

The Dickey–Fuller test

Start with \( y_t = \alpha + \rho y_{t-1} + e_t \) and subtract \( y_{t-1} \) from both sides:

\[ \Delta y_t = \alpha + \theta\,y_{t-1} + e_t, \qquad \theta = \rho-1, \qquad H_0\colon \theta = 0 \text{ (unit root)} \quad H_1\colon \theta < 0 \text{ (stationary)} \]

The test is one-sided and uses the ordinary t statistic \( \hat\theta/\operatorname{se}(\hat\theta) \). The twist: under the null the regressor \( y_{t-1} \) is a random walk, so the t statistic does not follow a t or normal distribution. It follows the Dickey–Fuller distribution, shifted left and skewed. In the book’s simulation of 10,000 random walks of length 200, the 5% quantile is \( -2.86 \) with a constant and \( -3.43 \) with a constant and trend. Using the normal value of \( -1.645 \) instead would reject a true unit root 45.4% of the time rather than 5%.

Test regressionUse it for1%5%10%
No constantregression residuals (mean zero)−2.57−1.94−1.62
Constantseries without a trend: rates, inflation, growth−3.43−2.86−2.57
Constant and trendtrending series such as log GDP−3.96−3.41−3.13
Standard normal (one-sided)for comparison only−2.33−1.645−1.28

Asymptotic MacKinnon critical values as computed by statsmodels. Reject a unit root if the statistic is more negative than the critical value. Software reports slightly more negative finite-sample values for your \( T \).

The test also has low power. When the true \( \rho \) is 0.95, so the series is stationary, the test with \( T = 200 \) rejects the unit root in only 33.3% of samples; with \( \rho = 0.90 \), in 88.1%. Failing to reject a unit root does not prove there is one.

Econometrics Made Simple practice questions coverPractise reading ADF and KPSS output and choosing the right critical values. Over 1,150 practice questions, every one with a worked answer.Practice book · $9

The augmented Dickey–Fuller test

If \( \Delta y_t \) has its own dynamics, the DF error is autocorrelated and the critical values no longer apply. The fix is to add lagged differences until the error is clean:

\[ \Delta y_t = \alpha + \delta t + \theta\,y_{t-1} + \gamma_1 \Delta y_{t-1} + \cdots + \gamma_p \Delta y_{t-p} + e_t \]

The lagged differences do not change the null distribution of the t statistic on \( y_{t-1} \), so the same DF critical values apply. Choose \( p \) with an information criterion (AIC or BIC) on a common sample; statsmodels’ default is autolag="AIC" with a maximum of \( 12(T/100)^{1/4} \) lags, 15 for the US data. Check that the conclusion does not hinge on the choice. Our full post on the augmented Dickey–Fuller test walks through each option in Python, R and Stata.

Worked example

The ADF regression for log US real GDP, with a constant, a trend and two lagged differences (chosen by AIC), gives \( \hat\theta = -0.0400 \) with \( t = -2.383 \). The lagged differences have coefficients 0.2766 and 0.1756. Test for a unit root.

Step 1\( \hat\rho = 1 + \hat\theta = 0.960 \).
Step 2GDP trends, so use the constant-and-trend critical value: \( -3.433 \) at 5% for \( T = 200 \).
Step 3\( -2.383 \) is above (less negative than) \( -3.433 \): do not reject the unit root. The MacKinnon p-value is 0.389.
Step 4The regression table prints \( p = 0.018 \) for \( y_{t-1} \). That uses the t distribution and is wrong for this coefficient.

The lagged-difference coefficients are significant in the ordinary sense: GDP growth is positively autocorrelated, which is why the lags are needed. For GDP growth itself, the ADF statistic is \( -6.973 \), far below the critical value: growth is stationary.

Exam tipState the test in full: the regression you ran, the null and alternative in words, the statistic, the DF critical value (not the normal one) and the conclusion. “The ADF statistic of \( -2.38 \) is above the 5% critical value of \( -3.43 \), so we cannot reject the null of a unit root” earns the marks.

The KPSS test

Because the ADF test has low power, a failure to reject is weak evidence. Kwiatkowski, Phillips, Schmidt and Shin (1992) turned the question round: the KPSS test takes stationarity as the null (around a constant, or around a trend) and a unit root as the alternative. It regresses \( y_t \) on a constant (or constant and trend), forms running sums of the residuals, and computes \( \text{KPSS} = \sum_t S_t^2 / (T^2\hat\sigma^2) \) with a long-run variance \( \hat\sigma^2 \). If \( y_t \) is stationary the residuals keep crossing zero and the sums stay small. Large values reject stationarity. The 5% critical values are 0.463 (level) and 0.146 (trend).

KPSS does not rejectKPSS rejects
ADF rejectsBoth point to I(0)Conflict: suspect a break, a near-unit root or wrong deterministic terms
ADF does not rejectInconclusive: persistent I(0) or I(1)?Both point to I(1)

Unit roots in US macroeconomic data

SeriesTermsADF (5% cv)KPSS (5% cv)Conclusion
Log real GDPc, t−2.38 (−3.43)0.207 (0.146)I(1): both agree
GDP growthc−6.97 (−2.88)0.324 (0.463)I(0): both agree
Inflationc−3.09 (−2.88)0.392 (0.463)I(0), only just (\( p = 0.027 \))
Unemployment ratec−2.54 (−2.88)0.232 (0.463)Inconclusive
T-bill ratec−2.04 (−2.88)0.450 (0.463)Leans to I(1)
Δ unemploymentc−4.17 (−2.88)0.097 (0.463)I(0)
Δ T-bill ratec−6.03 (−2.88)0.136 (0.463)I(0)

This is the classic pattern: levels I(1), growth rates I(0). Unemployment is the inconclusive case (ADF \( p = 0.107 \), KPSS does not reject). Economic reasoning helps: a rate bounded between 0 and 100 with no trend cannot be a random walk for ever, so it is better seen as stationary but very persistent. Nelson and Plosser (1982) famously could not reject a unit root in 13 of 14 long annual US series; Perron (1989) showed that allowing one break in the trend reverses many of those results. Both are reminders that unit-root tests have low power and that breaks can mimic unit roots.

What to do with a unit root

  1. All variables I(0): use the methods of Step 17 directly; standard inference applies.
  2. I(1) and not cointegrated: difference. For consumption and income, moving to growth rates cut the slope from 0.954 to 0.341 and raised the Durbin–Watson statistic from 0.253 to 1.889. The price is that differences say nothing about the long-run link between the levels.
  3. I(1) and cointegrated: keep the levels information with an error-correction model.
Key termTwo I(1) series are cointegrated if some combination \( y_t-\beta x_t \) is I(0): they wander, but together. The Engle–Granger test regresses \( y \) on \( x \) in levels and runs an ADF test (no constant) on the residuals, using its own, more negative critical values: about \( -3.34 \) at 5% asymptotically for two variables.

For log consumption on log income, the levels regression gives a slope of 1.0320 with \( R^2 = 0.9984 \), and the residual ADF statistic is \( -2.539 \). Against the ordinary DF value of \( -1.942 \) that would look decisive, but the correct Engle–Granger 5% value for this sample is \( -3.367 \) (\( p = 0.262 \)): we cannot reject “no cointegration”. Step 19 takes cointegration further.

Common mistakeTesting the residuals of a levels regression with ordinary Dickey–Fuller critical values. OLS chose the coefficients to make the residuals look as stationary as possible, so the residual test needs the more negative Engle–Granger values. The wrong yardstick turns “no evidence of cointegration” into “strong evidence”.

Practise: 6 questions

Try each one on paper first, then check the worked answer.

EasyQ1. A series follows \( y_t = 0.9\,y_{t-1} + e_t \) with \( \sigma_e = 1 \). Find its variance and the half-life of a shock. Show worked answer
\( \operatorname{Var}(y_t) = 1/(1-0.81) = 5.26 \) (standard deviation 2.29).
Half-life: \( 0.9^h = 0.5 \), so \( h = \ln 0.5/\ln 0.9 = 6.58 \) periods.
After 10 periods \( 0.9^{10} = 0.349 \) of a shock is still left: this series is far more persistent than one with \( \rho = 0.8 \).
EasyQ2. A random walk has \( \sigma_e = 3 \). Find the standard deviation of \( y_{16} \) and of \( y_{64} \) around the starting value. Show worked answer
\( \operatorname{Var}(y_t) = t\sigma_e^2 \), so the standard deviation is \( \sigma_e\sqrt{t} \).
\( y_{16} \): \( 3 \times 4 = 12 \). \( y_{64} \): \( 3 \times 8 = 24 \).
Quadrupling the horizon doubles the standard deviation.
MediumQ3. For an interest-rate series with no trend, the DF regression gives \( \widehat{\Delta y}_t = 0.8-0.12\,y_{t-1} \) with \( \operatorname{se}(\hat\theta) = 0.045 \). Test for a unit root at 5% and 10%, and find \( \hat\rho \). Show worked answer
\( t = -0.12/0.045 = -2.67 \); \( \hat\rho = 1-0.12 = 0.88 \).
The regression has a constant, so the critical values are \( -2.86 \) (5%) and \( -2.57 \) (10%).
At 5%: \( -2.67 > -2.86 \), do not reject the unit root. At 10%: \( -2.67 < -2.57 \), reject.
The evidence of stationarity is weak; run a KPSS test as well before deciding.
MediumQ4. For a series, the ADF test with a constant gives \( -3.60 \) (5% critical value \( -2.88 \)) and the KPSS level test gives 0.61 (5% critical value 0.463). What do you conclude, and what would you look at next? Show worked answer
ADF rejects a unit root; KPSS rejects stationarity. The two tests conflict.
Likely causes: a structural break (a shift in mean makes KPSS reject and can confuse ADF), a near-unit root, or the wrong deterministic terms (for example a trend that was left out).
Next: plot the series, look for a break date, and re-run both tests on sub-samples or with a trend if the plot shows one.
MediumQ5. A student differences a series that is in fact white noise with variance 4. Find the variance of the differenced series and the first-order autocorrelation it shows. Why is this a problem? Show worked answer
\( \Delta e_t = e_t-e_{t-1} \), so \( \operatorname{Var}(\Delta e_t) = 4 + 4 = 8 \).
\( \operatorname{Cov}(\Delta e_t, \Delta e_{t-1}) = -\operatorname{Var}(e_{t-1}) = -4 \), so the correlation is \( -4/8 = -0.5 \).
Over-differencing creates negative autocorrelation that was not in the original series and doubles the noise, so a model fitted to the differences describes an artefact of the method.
ExamQ6. Log prices of a good in two cities are both I(1). The regression of one on the other in levels gives residuals with an ADF statistic (no constant) of \( -3.12 \). (a) A student compares \( -3.12 \) with \( -1.94 \) and concludes the series are cointegrated. Explain the error. [2] (b) Using an Engle–Granger 5% critical value of \( -3.34 \), state the correct conclusion. [2] (c) Suppose a longer sample does establish cointegration and the error-correction model has a speed-of-adjustment coefficient of \( -0.15 \). Interpret it and find the half-life of a gap. [3] Show worked answer
(a) \( -1.94 \) is the ordinary DF value. OLS picked the coefficients to make the residuals look as stationary as possible, [1] so the residual-based test needs the more negative Engle–Granger critical values. [1]
(b) \( -3.12 > -3.34 \): do not reject the null of no cointegration at 5%. [1] The price gap may wander; a regression in levels could be spurious. [1]
(c) Each period 15% of any gap between the two prices and their long-run relationship is closed. [1] After \( n \) periods \( 0.85^n \) of the gap remains; \( 0.85^n = 0.5 \) gives \( n = \ln 0.5/\ln 0.85 \) [M1] \( = 4.27 \) periods. [A1]
Total: 7 marks.

Check yourself

1. In a random walk \( y_t = y_{t-1} + e_t \), the variance of \( y_t \)

\( y_t = y_0 + e_1 + \cdots + e_t \), so \( \operatorname{Var}(y_t) = t\sigma_e^2 \). That breaks condition (ii) of stationarity.

2. The null hypothesis of the augmented Dickey–Fuller test is that the series

ADF: \( H_0\colon \theta = 0 \), a unit root. KPSS is the test with stationarity as the null.

3. A levels regression of one trending series on another has \( R^2 = 0.97 \) and Durbin–Watson \( d = 0.21 \). The best first reaction is

Granger and Newbold’s rule of thumb: \( R^2 > d \) is a warning sign of a spurious regression.

Your score: 0 out of 3

The short version

  • Stationary: constant mean, variance and autocovariances. Weakly dependent: correlations die out with the gap.
  • AR(1) with \( |\rho| < 1 \): variance \( \sigma_e^2/(1-\rho^2) \), shocks decay as \( \rho^h \). Random walk: variance \( t\sigma_e^2 \), shocks permanent.
  • Trend-stationary series are detrended; I(1) series are differenced. An I(\( d \)) series needs \( d \) differences.
  • Spurious regression: 74.9% false rejections for independent random walks with \( T = 100 \); about 5% in differences. Warning sign: \( R^2 > d \).
  • ADF: regress \( \Delta y_t \) on \( y_{t-1} \), deterministic terms and lagged differences; compare with DF critical values (\( -2.86 \), or \( -3.41 \) with a trend). KPSS reverses the null; use both.
  • US data: log GDP I(1), growth I(0), inflation borderline I(0), unemployment inconclusive. Log consumption and income are not cointegrated by Engle–Granger (\( -2.54 \) against \( -3.37 \)).
  • Chapter 18 of Econometrics Made Simple covers all of this in full, with the simulations and tests in Python, R and Stata. The Complete Book Bundle adds every Economics, Statistics and Mathematics book as well.
Econometrics Made Simple complete bundle coverUnit roots, cointegration and forecasting in one set. Get the textbook and the practice book together for $19 (was $24).Both books · $19
Want more questions like these, with worked answers?
The practice book has over 1,150 more, graded from easy to exam level.
Next: step 19 of 20Forecasting and Cointegration