Welcome to Non-stationary Time Series!
In our previous studies of time series (like AR and MA models), we assumed the world was "stationary"—meaning the statistical properties like the average (mean) and the wiggle (variance) stayed the same over time. But let’s be honest: financial markets are rarely that well-behaved! Stock prices tend to grow over years, and volatility can explode during a crisis. These are non-stationary series.
In this chapter, we will learn how to spot these "unstable" series, why they can trick us into seeing patterns that aren't there, and how to fix them so we can build reliable models. Don't worry if the math looks a bit scary at first—we'll break it down using simple analogies!
1. What is Non-stationarity?
A time series is stationary if its mean, variance, and covariance are constant over time. Think of a stationary series like a pendulum swinging in a room: it might move back and forth, but it always stays around the same center point and doesn't suddenly start flying across the building.
A non-stationary series is the opposite. Its mean or variance changes over time. Examples include:
The Mean Changes: Like the price of Amazon stock over 10 years (it generally goes up).
The Variance Changes: Like a market that is calm for a month and then becomes extremely volatile for the next month.
Why should we care?
If you try to run a standard regression on non-stationary data, you might get "Spurious Regression." This is a fancy way of saying the model shows a strong relationship between two variables that actually have nothing to do with each other, simply because they are both trending upward. Mistake to Avoid: Never trust a high R-squared value between two trending variables without checking for stationarity first!
Quick Summary: Stationary = Stable/Predictable properties. Non-stationary = Changing properties over time.
2. The Random Walk Model
The most famous non-stationary model in finance is the Random Walk. It is the mathematical equivalent of a "Drunkard’s Walk." Imagine a person takes a step, and then their next step is completely random based on where they are standing right now.
The formula: \( Y_t = Y_{t-1} + \epsilon_t \)
Where \( \epsilon_t \) is white noise (a random shock).
Key Features of a Random Walk:
1. No Long-run Mean: The series doesn't "revert" to an average. It just wanders.
2. Variance Increases with Time: The further into the future you look, the more uncertain the position becomes. Specifically, the variance at time \( t \) is \( t \times \sigma^2 \).
3. Shocks are Permanent: If a "shock" (like a news event) hits the price today, that change stays in the price forever. It does not die out like it does in a stationary AR(1) model.
Random Walk with Drift
Sometimes, the "drunkard" has a slight tendency to lean forward. This is a Random Walk with Drift:
\( Y_t = \delta + Y_{t-1} + \epsilon_t \)
Here, \( \delta \) (delta) is the drift. Over time, the series will trend upward (if \( \delta > 0 \)) or downward (if \( \delta < 0 \)).
Did you know? Many economists believe that stock prices roughly follow a random walk because all known information is already "baked into" today's price.
3. Trends: Deterministic vs. Stochastic
It’s important to know why a series is trending because the "fix" is different for each.
Deterministic Trend: The trend is a simple function of time. It’s like a train on a track. It goes up because time goes forward.
Formula: \( Y_t = \alpha + \beta t + \epsilon_t \)
How to fix: Subtract the trend (Detrending).
Stochastic Trend: The trend is caused by the accumulation of random shocks. This is our Random Walk.
Formula: \( Y_t = Y_{t-1} + \epsilon_t \)
How to fix: Differencing (subtracting yesterday's value from today's).
Memory Aid: Deterministic = Destined (follows a set path). Stochastic = Shocks (path changes based on random events).
4. The Unit Root and the Dickey-Fuller Test
How do we mathematically prove a series is non-stationary? We look for a Unit Root.
In an AR(1) model: \( Y_t = \phi Y_{t-1} + \epsilon_t \)
If \( |\phi| < 1 \), the series is stationary.
If \( \phi = 1 \), we have a Unit Root (this is exactly what a Random Walk is!).
The Dickey-Fuller (DF) Test
We can't just use a standard t-test on \( \phi \) because the distribution is weird when \( \phi=1 \). Instead, we rearrange the equation:
\( \Delta Y_t = (\phi - 1) Y_{t-1} + \epsilon_t \)
We let \( \gamma = \phi - 1 \). Now we test if \( \gamma = 0 \).
The Hypotheses:
Null Hypothesis (\( H_0 \)): \( \gamma = 0 \) (There is a Unit Root / Series is Non-stationary).
Alternative Hypothesis (\( H_a \)): \( \gamma < 0 \) (Series is Stationary).
Important Point: If the test statistic is more negative than the critical value, we reject the null and conclude the series is stationary. Warning: We use a special "Dickey-Fuller Table" for critical values, NOT the standard t-table!
Key Takeaway: Dickey-Fuller tests for a Unit Root. Fail to reject \( H_0 \) = Bad news (Non-stationary). Reject \( H_0 \) = Good news (Stationary).
5. Fixing Non-stationarity: Differencing
If your data has a unit root (stochastic trend), you usually "fix" it by differencing. This means instead of looking at the price, you look at the change in price.
First Difference: \( \Delta Y_t = Y_t - Y_{t-1} \)
If you difference a Random Walk (\( Y_t = Y_{t-1} + \epsilon_t \)), you are left with \( \epsilon_t \), which is white noise. White noise is perfectly stationary! This is why we usually model stock returns instead of stock prices.
Quick Tip: If a series becomes stationary after differencing once, we say it is Integrated of order 1, or I(1). If it was already stationary, it is I(0).
6. Cointegration: The "Leash" Effect
Usually, when you regress one non-stationary variable on another, you get garbage (spurious regression). However, there is a special exception called Cointegration.
Analogy: Imagine a man walking a dog with a leash. The man is walking randomly (non-stationary). The dog is wandering randomly (non-stationary). But because of the leash, they can never get too far apart. The distance between them is stationary.
In Finance: Two stocks in the same industry (like Coca-Cola and Pepsi) might both wander off in price, but their spread (Price A - Price B) might stay constant. If they are cointegrated, we can use them for Pairs Trading.
Key Definition: Two I(1) series are cointegrated if a linear combination of them is I(0) (stationary).
Final Quick Review Box
1. Stationarity: Constant mean and variance. Essential for reliable models.
2. Random Walk: \( Y_t = Y_{t-1} + \epsilon_t \). Non-stationary. Variance grows with time.
3. Spurious Regression: Seeing a fake relationship between two trending variables.
4. Dickey-Fuller: Null hypothesis is that the series HAS a unit root (non-stationary).
5. Differencing: Subtracting the previous value to make a series stationary.
6. Cointegration: When two non-stationary series move together in the long run.
Great job! You've navigated the tricky waters of non-stationary data. Just remember: when in doubt, check for a unit root and difference the data before you model it!