Stationarity: why a series gets differenced
Forecasting models learn from the past and carry what they learned into the future. Carrying it over only makes sense while the rules of the game stay the same: the mean holds its place, the spread does not grow, the link between neighbouring days is the same at the start and at the end. A series with that property is called stationary. Growing revenue does not have it โ and it is brought into shape by moving from the values themselves to their increments.
Differencing subtracts the previous value from each one. It removes the trend โ but every extra difference eats one observation and amplifies noise.
Below the chart run two gauges: a rolling mean and a rolling spread, both over a two-week window. That is the eyeball test for stationarity. On the raw series the mean line crawls steadily upwards โ the series is growing, so its mean depends on the moment you look at it.
What it means
The routine is standard: look at the chart and the correlogram, take a difference, look again. If after the first difference the correlogram stops decaying slowly, that much differencing is enough.
Automatic selection (auto_arima and friends) picks d by stationarity tests on its own. It is still worth checking: on short series the tests are unstable, and an extra difference costs more than a missing one.
Series in money and in counts are often better logged before differencing. Then the difference of logs reads as a relative increment โ ยซso many percent versus yesterdayยป โ and a spread that grows with the level is stabilised.
Where it shows up
Stock prices are nearly non-stationary, while their daily returns are nearly stationary. That is why finance models the return rather than the price: precisely the move to a difference of logs.
Inflation is published not as a price level but as the increment over the previous period โ the same first difference in everyday language.
The ยซyear over yearยป comparison in reporting is essentially a seasonal difference with period 12: a way to remove the annual cycle and part of the trend in one go.
Definitions
When the method lies (assumptions)
Differencing cures non-stationarity in the mean, but not in the spread. If the size of the swings grows with the level, a transformation comes first โ a log or Box โ Cox โ and only then the difference.
Stationarity is an assumption of the model, not a property of the business. A change in pricing policy, a launch in a new country or a pandemic make the past unfit to carry into the future, and no amount of differencing will fix that: the series has to be cut into periods.
Deep dive: the math and the mechanism (optional)
There are two kinds of non-stationarity and they are treated differently. A series with a deterministic trend (values wobbling around a straight line) only needs to be cleaned by a regression on time. A series with a stochastic trend โ a random walk where each value equals yesterday's plus noise โ is not cured by a regression on time, it needs a difference. Confusing them is expensive: an extra difference on the first inflates noise, a missing one on the second leaves false predictability.
The same effect produces spurious regression: take two independent random walks, regress one on the other, and Rยฒ comes out high with a confidently significant t-statistic โ although there is no relationship at all. The famous ยซcorrelationsยป between cheese consumption and the divorce rate live on exactly this: both series simply grow.