Time Series Lesson 4 – Stationarity | Dataplexa

Stationarity in Time Series

Before learning forecasting models, there is one question we must answer first:

Can this data be trusted by mathematical models?

That is exactly what stationarity decides.


Why Stationarity Exists (Real Reason)

Most time series models are built on mathematical assumptions. One of the biggest assumptions is:

The data should not change its behavior over time.

If the data keeps changing its average, its spread, or its pattern, models get confused.

Think like this:

  • A ruler works only if length stays constant
  • A weighing scale works only if gravity is constant
  • Time series models work only if statistics stay stable

That stability is called stationarity.


What Does “Stationary” Mean (In Simple Words)

A time series is stationary if:

  • Its average does not drift over time
  • Its variance does not explode or shrink
  • Its pattern stays consistent

Let’s see this visually — not just in words.


Example 1: Non-Stationary Series (Trending Data)

First, let’s create data that clearly breaks stationarity.

Python: Non-Stationary Trend
import numpy as np
import matplotlib.pyplot as plt

time = np.arange(100)
trend = time * 0.6

plt.plot(trend)
plt.title("Non-Stationary Series (Trend)")
plt.show()

This is what that data looks like:

What your eyes should catch immediately:

  • The average keeps increasing
  • The future looks very different from the past

This data is NOT stationary.


Why Models Hate This Data

If the average keeps changing:

  • Yesterday’s behavior does not explain today
  • Today’s behavior will not explain tomorrow

So the model keeps chasing a moving target.


Example 2: Stationary Series (Stable Behavior)

Now let’s create data that stays stable.

Python: Stationary Data
noise = np.random.normal(0, 5, 100)

plt.plot(noise)
plt.title("Stationary Series")
plt.show()

Here is the actual plot:

Notice the difference:

  • The average stays around zero
  • Ups and downs look similar everywhere
  • Past and future behave similarly

This data IS stationary.


Side-by-Side Thinking (Very Important)

When models look at stationary data:

  • Patterns repeat statistically
  • Relationships stay valid
  • Forecasts become meaningful

When models look at non-stationary data:

  • Rules keep changing
  • Predictions drift
  • Errors explode

Real-World Examples

Data Stationary? Why
Daily temperature deviations Yes Fluctuates around an average
Company revenue No Long-term growth trend
Stock price No Random walk behavior
Stock returns Yes Mean-reverting

Key Rule to Remember

Most classical forecasting models REQUIRE stationarity.

  • AR, MA, ARMA → need stationarity
  • ARIMA → forces stationarity using differencing
  • SARIMA → handles seasonality + stationarity

Stationarity is not optional — it is a gatekeeper.


Practice Questions

Q1. Can trending data be used directly in ARIMA?

No. It must be transformed to stationary first.

Q2. Why is noise usually stationary?

Because its mean and variance remain constant over time.

Quick Recap

  • Stationarity means stable statistics
  • Models assume stable behavior
  • Non-stationary data breaks assumptions
  • We fix it before modeling

Next Lesson

Next, we’ll see a dangerous case called Random Walk — where data looks predictable but is actually not.