| Series | ADF Statistic | p-value | Critical 1% | Critical 5% | Stationary | |
|---|---|---|---|---|---|---|
| 0 | Prices | 0.4934 | 0.9847 | -3.4356 | -2.8639 | No |
| 1 | Log Returns | -22.0448 | 0.0000 | -3.4356 | -2.8639 | Yes |
Stationarity
Time series stability testing
1 Abstract
A stationary time series has statistical properties (mean, variance, autocorrelation) that don’t change over time. Most financial prices are non-stationary, but returns are typically stationary. Testing for stationarity using the Augmented Dickey-Fuller (ADF) test is essential before applying many time series models.
2 Definition
A time series \(\{X_t\}\) is strictly stationary if the joint distribution of \((X_{t_1}, ..., X_{t_k})\) is identical to \((X_{t_1+h}, ..., X_{t_k+h})\) for all \(h\).
Weak stationarity (more practical) requires:
- Constant mean: \(E[X_t] = \mu\) for all \(t\)
- Constant variance: \(Var(X_t) = \sigma^2\) for all \(t\)
- Autocovariance depends only on lag: \(Cov(X_t, X_{t+h}) = \gamma(h)\)
3 Why Stationarity Matters
- Predictability: Non-stationary series have unpredictable statistical properties
- Model validity: ARMA, GARCH models assume stationarity
- Spurious regression: Regressing non-stationary series produces misleading results
- Mean reversion: Stationary series revert to their mean; non-stationary series don’t
4 Unit Root and Random Walk
A random walk is a classic non-stationary process:
\[ X_t = X_{t-1} + \varepsilon_t \]
This has a unit root (coefficient = 1). The variance grows without bound over time:
\[ Var(X_t) = t \cdot \sigma_\varepsilon^2 \]
5 Augmented Dickey-Fuller Test
The ADF test checks for a unit root:
\[ \Delta X_t = \alpha + \beta t + \gamma X_{t-1} + \sum_{i=1}^{p} \delta_i \Delta X_{t-i} + \varepsilon_t \]
- Null hypothesis: \(\gamma = 0\) (unit root exists, non-stationary)
- Alternative: \(\gamma < 0\) (stationary)
- Decision: Reject null if test statistic < critical value
6 Compute (Python)
7 Visual Comparison
8 Rolling Statistics
Non-stationary series have time-varying statistics.
9 Making Series Stationary
Common transformations:
- Differencing: \(\Delta X_t = X_t - X_{t-1}\) (removes trend)
- Log transform: Stabilizes variance
- Seasonal differencing: For seasonal patterns
- Detrending: Subtract fitted trend
| Series | ADF Statistic | p-value | Critical 1% | Critical 5% | Stationary | |
|---|---|---|---|---|---|---|
| 0 | Prices (Level) | 0.4934 | 0.9847 | -3.4356 | -2.8639 | No |
| 1 | Prices (1st Diff) | -19.6391 | 0.0000 | -3.4356 | -2.8639 | Yes |
| 2 | Prices (2nd Diff) | -13.6061 | 0.0000 | -3.4357 | -2.8639 | Yes |
10 Autocorrelation Analysis
Stationary series have autocorrelation that decays to zero; non-stationary series have persistent autocorrelation.
11 Multiple Assets
| Series | ADF Statistic | p-value | Critical 1% | Critical 5% | Stationary | |
|---|---|---|---|---|---|---|
| 0 | SPY Price | 0.4943 | 0.9847 | -3.4356 | -2.8639 | No |
| 1 | SPY Returns | -22.0447 | 0.0000 | -3.4356 | -2.8639 | Yes |
| 2 | TLT Price | -1.9229 | 0.3213 | -3.4356 | -2.8638 | No |
| 3 | TLT Returns | -27.5126 | 0.0000 | -3.4356 | -2.8638 | Yes |
| 4 | GLD Price | 4.0465 | 1.0000 | -3.4356 | -2.8639 | No |
| 5 | GLD Returns | -35.8817 | 0.0000 | -3.4356 | -2.8638 | Yes |
| 6 | BTC-USD Price | -0.8090 | 0.8165 | -3.4339 | -2.8631 | No |
| 7 | BTC-USD Returns | -8.0555 | 0.0000 | -3.4340 | -2.8631 | Yes |
12 Conclusion
Stationarity testing is a critical first step in time series analysis. Financial prices are typically non-stationary (trending, with growing variance), while returns are usually stationary. The ADF test provides a formal statistical test, and transformations like differencing or log returns can convert non-stationary series to stationary ones suitable for modeling.