Course contentsShow
← Machine Learning and Deep Learning
Lesson 2401 of 3,53852. Time Series and ForecastingFree lesson

Differencing and Integration

Learning how differencing transforms non-stationary series to stationary and the concept of integration order.

Differencing and Integration

You'll learn how differencing transforms non-stationary time series into stationary ones and what integration order means.

The Core Problem

Most time series models (like ARMA) require stationarity—meaning the statistical properties don't change over time. But real-world data often has trends or varying means. Differencing is the surgical tool that removes these patterns.

What Is Differencing?

Differencing means subtracting the previous observation from the current one:

First difference: y'(t) = y(t) - y(t-1)

Think of it like measuring velocity instead of position. If a stock price trends upward (non-stationary position), the changes in price might fluctuate around zero (stationary velocity).

For stubborn trends, you can difference again:

Second difference: y''(t) = y'(t) - y'(t-1)

This is like measuring acceleration—the change in the changes.

Integration Order: The "I" in ARIMA

The order of integration (denoted d) tells you how many times you need to difference the series to achieve stationarity:

  • d = 0: Already stationary (no differencing needed)
  • d = 1: One differencing makes it stationary (most common)
  • d = 2: Requires two rounds of differencing (rare but happens)

"Integration" is the reverse operation—think of it as "undoing" the differencing to get back predictions in the original scale.

Why It Matters

When you fit an ARIMA(p, d, q) model, the d parameter controls differencing. If you pick d = 1, the model automatically differences your data once before applying AR and MA components, then integrates the forecast back to the original scale.

Key Takeaway: Differencing removes trends and seasonality by focusing on changes rather than levels; the integration order (d) counts how many differencing steps are needed to achieve stationarity.