A Gentle Introduction to Stationarity
1) The Basic Time Series Modeling Paradigm
The Key Difficulty: One Observation per Time
In time series analysis, you start with observed data:
The modeling goal is to associate these observations with a stochastic process (a sequence of random variables):
where each is a random variable that could have produced the observed value .
Conceptually, we would like each to represent:
- all plausible values that could occur at time , and
- a probability distribution describing how likely each value is.
But there is a fundamental problem: at each time $t$, you only observe one value $x_t$.
From a single draw at each time, you cannot directly infer the full distribution of .
A helpful analogy illustrates this difficulty:
imagine having different biased coins.
If each coin is flipped only once, it is essentially impossible to determine the bias of any individual coin.
This highlights why time series modeling is hard if you treat each time step as a completely separate distribution.
2) Why Stationarity Helps
Stationarity (Preliminary Definition)
A process is stationary (roughly) if its statistical properties do not depend on time.
Informally, “the distribution looks the same today as it does tomorrow” in a probabilistic sense.
What “statistical properties” typically means:
- the mean does not change over time,
- the variance does not change over time,
- the way values depend on each other across time (correlation structure) does not change over time.
The critical benefit:
- If the process is stationary, then information from different time points can be pooled.
- A long time series acts like a “large dataset” for estimating the process’s behavior, because the distribution is assumed to be stable over time.
Even when observations are correlated across time (which is common), stationarity still makes modeling feasible because the dependence structure is also assumed to be time-invariant.
3) Getting to Stationarity: The Common Workflow
Transform → Model → Undo Transform
Many real-world series are not stationary. For example:
- an upward trend suggests the mean is increasing over time → not stationary.
So a common approach is:
- Transform the original series into a new series that is closer to stationary
(often called “residual-like” series after removing trend/seasonality). - Model $y_t$ using a stationary stochastic process .
- Undo the transformation to map the stationary model back to a model for the original scale .
This idea is central in classical time series methods: you try to isolate the “stationary core” because stationary processes are far easier to analyze and forecast with.
4) Why a Time Series Can Be Nonstationary (and What to Do)
A time series may be nonstationary for several common reasons:
- Trend (long-term increase/decrease)
- Seasonality (regular periodic pattern)
- Structural breaks (sudden change in behavior)
- Changing variance / scale (small variability earlier, large variability later)
Brief approaches for handling cases (3) and (4) are outlined below:
Structural breaks
If the series suddenly changes regime (e.g., policy change, economic shock), you may:
- split the series into segments and model each segment separately.
Changing variance / changing magnitude
If variability grows as the level grows, a common transformation is the log transform:
If some , you might use:
for a constant large enough to make all terms positive.
This often stabilizes variance and makes patterns easier to model.
5) Classical Decomposition: Trend + Seasonality + Stationary Component
A common modeling assumption is the classical additive decomposition:
where:
- is a deterministic trend function (slowly varying),
- is a deterministic seasonal function (periodic),
- is a stationary stochastic process capturing the remaining fluctuations.
The core idea:
- Identify and remove and ,
- then focus analysis on , which is stationary.
Two major ways to remove trend/seasonality are mentioned:
- regression/parameter fitting (explicitly estimate , ),
- differencing (the method emphasized here).
6) Differencing: The Main Tool Introduced
6.1 First difference (lag-1)
The first difference is:
This often removes a trend.
In R, this is done with:
diff(x)(default is lag 1)
6.2 Example: Lake Huron (Removing a Trend)
The Lake Huron annual water level series shows a downward trend.
Model idea:
(no seasonality; trend plus stationary fluctuations)
After differencing:
If is stationary and is stationary, then must be constant (not time-varying).
That implies must be linear:
Interpretation:
- If differencing once makes the series look stationary, you are effectively assuming the original trend is approximately linear.
An important clarification is the following:
- The differenced series is associated with , not directly with the stationary component .
You can recover in principle, but that step was not performed here.
6.3 Higher-order differencing removes higher-order trends
If the trend is quadratic:
then differencing once produces something still trending (because the slope changes over time), but differencing twice removes the quadratic component:
Define second difference:
When mt is a quadratic function, it can be shown that:
which is constant.
General rule:
- differencing times removes a polynomial trend of degree .
7) Seasonal Differencing (Lag- Differencing)
7.1 Lag- difference
To remove seasonality with period , use:
In R:
diff(x, lag = d)
7.2 Example: Nottingham Temperatures (Monthly, strong yearly cycle)
Monthly temperatures typically have strong seasonality with period .
So use lag-12 differencing:
This subtracts “the value from the same month last year,” which often removes seasonal patterns.
7.3 Important notation warning: two very different operations
It is important not to confuse the following:
- Repeated lag-1 differencing (apply times)
- Single lag-$d$ differencing (apply a lag once)
Example when :
- Repeated lag-1 differencing:
- Lag-2 differencing:
These are not the same and serve different modeling purposes:
- targets polynomial trend curvature,
- targets seasonality of period 2.
8) Removing Multiple Nonstationary Features Together
Example: Johnson & Johnson Quarterly Earnings
This dataset shows:
- increasing variance (fluctuations become larger over time),
- trend,
- seasonality (quarterly cycle).
Step-by-step transformation strategy shown:
- Apply log to stabilize variance:
- Remove quarterly seasonality using lag-4 differencing:
- If needed, remove remaining trend by differencing once more:
A key modeling judgment issue is the following:
- The series after step 2 might already be “stationary enough.”
- Adding another differencing step increases model complexity.
- Deciding whether it is necessary requires more formal diagnostic tools and statistical tests, which are introduced later.
9) Why Differencing Is So Useful (Quick Review of Key Points)
- First differencing: often removes trend.
- Repeated differencing can remove higher-order polynomial trends.
- Seasonal (lag-$d$) differencing: removes seasonality with period .
- These transformations can be combined (log + seasonal difference + regular difference).
- Differencing is reversible (information is not “lost” if you keep an initial value).
For example, given and the differenced series, you can reconstruct: (same idea extends to stochastic processes).
Bottom line
Stationarity is introduced because it turns an otherwise impossible inference task (learning time-varying distributions from one observation per time) into a feasible one by assuming time-invariant statistical structure. When a series is nonstationary, you often transform it (log, differencing, seasonal differencing, segmentation) to isolate a stationary component that can be modeled and used for forecasting.
