Lesson 1.2: Stationarity
This is the most important lesson in this module. We introduce the concept of Stationarity—the assumption that a time series' statistical properties do not change over time. Understanding and verifying stationarity is the mandatory first step for almost every time series forecasting model. Without it, our models are built on quicksand.
Part 1: The Quicksand Problem
The Core Analogy: Predicting on Solid Ground vs. Quicksand
A **non-stationary** time series is like **quicksand**. The ground is constantly shifting. The average level is changing, the volatility is changing. Any patterns you learn today might be completely irrelevant tomorrow.
A **stationary** time series is like **solid bedrock**. The ground is stable. The average level is constant, and the shakiness is consistent. Patterns you learn from the past are likely to be relevant for the future.
Our primary job is to first test if we are on quicksand. If we are, we must find a way to transform our data until we are on solid bedrock before we build a forecasting model.
Part 2: What is Stationarity?
The Three Conditions for Weak Stationarity
A time series is weakly stationary if it satisfies these three conditions:
- Constant Mean: The expected value is constant for all .
- Constant Variance: The variance is constant and finite for all .
- Constant Autocovariance: The covariance between any two observations depends only on the lag between them, not on the time .
Part 3: The Practitioner's Toolkit - How to Test for Stationarity
Plot your data. Look for obvious violations:
- Is there an upward or downward Trend?
- Is there a repeating seasonal pattern?
- Does the "band" of fluctuations get wider or narrower over time (changing variance)?
This is the formal statistical test. It checks for a "unit root," the statistical signature of a non-stationary process like a random walk.
ADF Test Rule
Null Hypothesis (H₀): A unit root is present. The series is **non-stationary**.
Decision Rule: "If the p-value is low, the null must go." If the p-value from the test is less than 0.05, you reject H₀ and conclude your series is stationary.
Part 4: The Fix: Differencing
The most common method to make a non-stationary series stationary is **differencing**. Instead of modeling the variable's level, we model its change from one period to the next.
For example, while stock *prices* are non-stationary, stock *returns* (their period-to-period differences) are generally stationary.
What's Next? Exploring the Structure of Memory
We now have the tools to ensure our time series data is on "solid ground." We can confidently work with stationary series.
The next question is: what is the *structure* of this stationary series? How is an observation today related to an observation yesterday? To answer this, we need to learn about the **Autocorrelation Function (ACF)** and the **Partial Autocorrelation Function (PACF)**.