Augmented Dickey-Fuller test: check a series for a unit root
The augmented Dickey-Fuller (ADF) test checks whether a time series has a unit root, meaning that shocks never fade: the series wanders like a random walk instead of returning to a fixed mean or a fixed trend line. The answer decides whether to difference the series before fitting an ARIMA model, and it warns against regressions between wandering series, which can show strong but meaningless relationships.
When to use it
- You are choosing d, the number of differences, for an ARIMA model.
- A plot shows a series that drifts for long stretches and you want to know whether it is mean-reverting but slow, or truly wandering.
- The autocorrelation function decays very slowly.
- You plan to regress one time series on another and want to avoid spurious regression.
How it works
The test fits a regression of the change in the series on its previous level and on k lagged changes:
Δyₜ = α + γ·yₜ₋₁ + δ₁·Δyₜ₋₁ + … + δₖ·Δyₜ₋ₖ + eₜ
τ = γ̂ / SE(γ̂)- Null hypothesis: γ = 0, a unit root. The level carries no pull back toward a mean.
- Alternative: γ < 0, the series is stationary and reverts to its mean (or trend).
- Lagged changes soak up short-term autocorrelation so the errors are close to independent; that is the "augmented" part. This article chooses k by AIC on a common sample.
- Deterministic terms: no constant, a constant (series varies around a nonzero mean) or a constant plus trend (series reverts to a trend line). Each has its own critical values.
The statistic τ does not follow a t distribution under the null hypothesis, even though it is computed like a t statistic. Its critical values come from the Dickey–Fuller tables, refined by MacKinnon's response-surface tables. Approximate large-sample values:
| Deterministic terms | 1% | 5% | 10% |
|---|---|---|---|
| None | −2.57 | −1.94 | −1.62 |
| Constant | −3.43 | −2.86 | −2.57 |
| Constant + trend | −3.96 | −3.41 | −3.13 |
These are approximate; for short series the values are somewhat more negative. For n = 60 with a constant and one lagged change, a simulation of 60-point random walks gives about −3.54, −2.93 and −2.60. Reject the unit root when τ is below (more negative than) the critical value.
Example
The quench tank temperatures from forecast with best ARIMA: daily averages (°C) for 60 days, listed there.
Level, with a constant. The series has no clear trend, so the test uses a constant. AIC picks one lagged change (k = 1). With 58 usable observations:
| Term | Coefficient | SE |
|---|---|---|
| Constant | 2.7021 | 1.3826 |
| yₜ₋₁ (γ) | −0.0891 | 0.0452 |
| Δyₜ₋₁ | 0.4823 | 0.1214 |
τ = −0.0891 / 0.0452 = −1.97. That is well above the 10% critical value (about −2.60 for this sample size), so the unit root is not rejected. A simulated p-value is about 0.30. The result does not depend on the lag choice:
With a constant and trend, τ = −3.13, also short of the 5% value of about −3.41.
Differences. Testing the daily changes Δyₜ the same way, AIC picks k = 0 and γ̂ = −0.577, τ = −4.78 (58 observations), far below the 1% value. The changes are stationary.
Conclusion. The temperature level behaves like a series with a unit root, and its first differences are stationary, so d = 1. This matches the ARIMA(1,1,0) model chosen in the best-ARIMA article. Practically, the tank temperature does not return to a set level on its own; it drifts with ambient conditions and load, so the shop treats it as a quantity to control rather than one that corrects itself.
How to read the results
- τ below the critical value: reject the unit root; model the series in levels (d = 0).
- τ above it: you cannot reject the unit root; difference the series and test again.
- The γ̂ coefficient shows how strong the pull toward the mean is: −0.089 means only about 9% of a deviation is corrected per day, if any.
- Results that change with the lag order call for caution; check them against the plot and the ACF.
Common mistakes
- Using t-table critical values. The ordinary −1.96 or −1.67 would reject far too often.
- Choosing the wrong deterministic terms. Leaving out a trend that is present makes a trend-stationary series look like it has a unit root.
- Too few lags. Leftover autocorrelation in the errors distorts the size of the test.
- Reading "not rejected" as proof of a unit root. The test has low power in short series; a slowly reverting series of 60 points often fails to reject.
Frequently asked questions
Why is the test "augmented"?
The original Dickey–Fuller test has no lagged changes and assumes independent errors. Adding lagged changes handles autocorrelated errors.
What if the ADF test and the plot disagree?
Trust neither alone. A level shift can mimic a unit root, and a slowly reverting series can fail to reject. A complementary test whose null hypothesis is stationarity, such as the KPSS test, can help.
How do I get a p-value?
From MacKinnon's approximations or from simulation, as here. Because the distribution is nonstandard, p-values are approximate.
Do I need the test if the series clearly trends?
A clear trend still leaves the question of whether it is a fixed trend line or a random walk with drift. Use the constant-plus-trend version, which allows for a fixed trend line under the alternative. If the series turns out to be trend-stationary, a trend analysis is a reasonable model.