If your thesis uses monthly inflation, yearly GDP, daily KSE-100 returns or quarterly exports, you are working with time series. These data carry a trap: regressing one trending series on another can produce impressive but meaningless results. This guide explains stationarity, the Augmented Dickey–Fuller (ADF) test and ARIMA modelling, with calculations you can follow by hand.
What Is Stationarity?
A time series is (weakly) stationary when its mean, variance and autocovariances do not change over time. Visually, it fluctuates around a constant level with a stable spread.
Most economic series are not stationary. GDP, prices and exchange rates usually trend upward. Two common types are:
- Trend-stationary: the series fluctuates around a deterministic trend, so removing the trend makes it stationary.
- Difference-stationary (unit root): shocks have permanent effects, and the series becomes stationary only after differencing. A random walk \( y_t = y_{t-1} + \varepsilon_t \) is the classic example.
Why It Matters
Granger and Newbold showed in 1974 that regressing two independent random walks on each other often gives a high \( R^2 \) and "significant" t-statistics, which is called spurious regression. A warning sign is an \( R^2 \) higher than the Durbin–Watson statistic. Testing for unit roots before modelling is therefore essential.
The ADF Test
The Dickey–Fuller idea starts from \( y_t = \rho y_{t-1} + \varepsilon_t \). Subtracting \( y_{t-1} \) from both sides gives
$$ \Delta y_t = \alpha + \gamma y_{t-1} + \sum_{j=1}^{p} \delta_j \Delta y_{t-j} + \varepsilon_t, \qquad \gamma = \rho - 1 $$
The lagged differences (the "augmented" part) remove serial correlation from the errors. The hypotheses are:
- \( H_0: \gamma = 0 \), so the series has a unit root and is non-stationary;
- \( H_1: \gamma < 0 \), so the series is stationary.
The test statistic is \( \tau = \hat{\gamma} / \text{SE}(\hat{\gamma}) \). It does not follow the usual t-distribution, so you compare it with Dickey–Fuller (MacKinnon) critical values. For a model with a constant and about 100 observations, the 5% critical value is roughly −2.89. With a constant and trend it is about −3.45.
Decision rule: if \( \tau \) is more negative than the critical value, reject \( H_0 \) and conclude that the series is stationary.
Practical choices you must justify:
- Deterministic terms: include a trend if the series visibly trends, and only a constant if it wanders around a non-zero level.
- Lag length \( p \): choose it with AIC or SIC (BIC). Software does this automatically.
- Confirmatory tests: the KPSS test reverses the hypotheses (H₀: stationary), and the Phillips–Perron test is robust to heteroskedasticity. Reporting ADF together with KPSS strengthens your conclusion.
Worked Example 1: Interpreting an ADF Test
A student tests the log of Pakistan's annual real GDP (made-up figures, T = 40) with a constant and trend. Software reports:
| Series | \( \hat{\gamma} \) | SE | τ |
|---|---|---|---|
| ln GDP (level) | −0.084 | 0.062 | ? |
| Δ ln GDP (first difference) | −0.912 | 0.168 | ? |
Step 1: Compute τ for the level.
$$ \tau = \frac{-0.084}{0.062} = -1.35 $$
For T = 40 with a trend, the 5% critical value is about −3.53. Since −1.35 is not below −3.53, we fail to reject \( H_0 \). The level has a unit root.
Step 2: Compute τ for the first difference (tested with a constant only, critical value about −2.94):
$$ \tau = \frac{-0.912}{0.168} = -5.43 $$
Since \( -5.43 < -2.94 \), reject \( H_0 \). The differenced series is stationary.
Conclusion: ln GDP is integrated of order one, written I(1).
APA-style report: An Augmented Dickey–Fuller test indicated that log GDP was non-stationary in levels, τ = −1.35, p > .05, but stationary in first differences, τ = −5.43, p < .01. The series was therefore treated as I(1).
Reading the ACF and PACF
The autocorrelation function (ACF) measures the correlation of a series with its own past values. At lag \( k \):
$$ r_k = \frac{\sum_{t=k+1}^{n} (y_t - \bar{y})(y_{t-k} - \bar{y})}{\sum_{t=1}^{n} (y_t - \bar{y})^2} $$
Worked Example 2: Lag-1 Autocorrelation by Hand
Take eight monthly sales figures: 2, 4, 3, 6, 5, 8, 7, 9. Their sum is 44, so \( \bar{y} = 5.5 \).
Deviations: −3.5, −1.5, −2.5, 0.5, −0.5, 2.5, 1.5, 3.5.
Denominator (sum of squared deviations):
$$ 12.25 + 2.25 + 6.25 + 0.25 + 0.25 + 6.25 + 2.25 + 12.25 = 42 $$
Numerator (products of neighbouring deviations):
$$ 5.25 + 3.75 - 1.25 - 0.25 - 1.25 + 3.75 + 5.25 = 15.25 $$
$$ r_1 = \frac{15.25}{42} = 0.363 $$
The approximate 95% significance band is \( \pm 2/\sqrt{n} = \pm 0.707 \), so with only eight points this autocorrelation is not significant. This is a reminder that time series methods need reasonably long samples, ideally at least 50 observations for ARIMA.
Patterns in the ACF and PACF guide model choice:
- AR(p): the ACF decays gradually and the PACF cuts off after lag p.
- MA(q): the ACF cuts off after lag q and the PACF decays gradually.
- Non-stationary: the ACF decays very slowly from values near 1, so difference the series first.
ARIMA Models
ARIMA(p, d, q) combines three parts:
- AR(p): the current value depends on p past values;
- I(d): the series is differenced d times to make it stationary (d comes from your ADF results);
- MA(q): the current value depends on q past forecast errors.
The Box–Jenkins procedure has four stages: identify (ADF, ACF, PACF), estimate (maximum likelihood), diagnose (the residuals should be white noise, checked with the Ljung–Box Q test) and forecast. Compare candidate models using AIC or BIC, where lower is better.
Worked Example 3: Forecasting with ARIMA(1, 1, 0)
Suppose the estimated model for monthly exports (USD million) is
$$ \Delta y_t = 0.5 + 0.4\,\Delta y_{t-1} + \varepsilon_t $$
and the last two observations are \( y_{T-1} = 116 \) and \( y_T = 120 \).
Step 1: Find the last difference. \( \Delta y_T = 120 - 116 = 4 \).
Step 2: Forecast the next difference.
$$ \Delta \hat{y}_{T+1} = 0.5 + 0.4(4) = 2.1, \qquad \hat{y}_{T+1} = 120 + 2.1 = 122.1 $$
Step 3: Forecast two steps ahead.
$$ \Delta \hat{y}_{T+2} = 0.5 + 0.4(2.1) = 1.34, \qquad \hat{y}_{T+2} = 122.1 + 1.34 = 123.44 $$
Sanity check: in the long run, the differences settle at \( 0.5/(1 - 0.4) = 0.833 \) per month, so the forecasts keep rising by smaller and smaller steps towards a steady growth rate. That makes sense for a series with positive drift.
Software
- EViews: View → Unit Root Test, then Quick → Estimate Equation with AR and MA terms.
- R:
tseries::adf.test(),urca::ur.df()andforecast::auto.arima(). - Python:
statsmodels.tsa.stattools.adfullerandstatsmodels.tsa.arima.model.ARIMA. - Stata:
dfuller y, lags(2) trendandarima y, arima(1,1,0).
python
from statsmodels.tsa.stattools import adfuller
stat, p, *_ = adfuller(series, regression="ct", autolag="AIC")
print(round(stat, 2), round(p, 3))
Did You Know?
- David Dickey and Wayne Fuller published their unit root test in 1979, and Said and Dickey added the "augmented" lags in 1984.
- Box and Jenkins popularised ARIMA modelling in their 1970 book on time series analysis.
- If two I(1) series move together in the long run, they are cointegrated, and regressing one on the other is not spurious. The Johansen and ARDL bounds tests examine this.
Key Takeaways
- Test every series for stationarity before regression or forecasting, or you risk spurious results.
- In the ADF test, the null hypothesis is a unit root. A τ more negative than the critical value means the series is stationary.
- Report ADF together with KPSS or Phillips–Perron, and state the deterministic terms and lag selection you used.
- ARIMA(p, d, q) takes d from unit root tests and p and q from the ACF, PACF and information criteria, and its residuals must pass the Ljung–Box test.
For help with unit root tests, ARIMA forecasting or your EViews and R output, Amathify's subject experts and PhD scholars can give you step-by-step solutions and thesis support. Reach out on WhatsApp or through the Ask a Question form.
Stuck on a problem or assignment?
Our experts and PhD scholars solve maths, physics and chemistry — step by step.