AI Glossary / Time series and signal processing / Intermediate
Differencing
Definition
Differencing is a time-series transformation that replaces observations with changes between observations at a specified lag. First-order differencing usually subtracts the immediately preceding value. Repeated or seasonal differencing can remove particular forms of trend or seasonal persistence, often making a series more suitable for a stationary time-series model.
What it means
A growing series may be easier to model through its changes than through its levels. For example, a business might study the weekly change in workload instead of the total workload each week.
Differencing changes the quantity being analyzed. A forecast of next week's change is not yet a forecast of next week's level. The original scale must be reconstructed using the appropriate past values, and uncertainty must be carried through that reconstruction.
How it works
For observations yt at regular intervals, the ordinary first difference is delta yt = yt - y(t-1). With n observations and no missing values, this creates n-1 first differences.
A second-order difference applies the first-difference operation again: delta-squared yt = yt - 2y(t-1) + y(t-2). It measures the change in the previous change. This is different from a lag-two difference, yt - y(t-2).
For a seasonal period m, seasonal differencing subtracts y(t-m). Monthly data with annual seasonality often use m = 12; quarterly data with annual seasonality use m = 4. The period should follow the actual time structure, not a convenient arbitrary number.
Using the backward-shift operator B, ordinary differencing is (1-B)y and seasonal differencing is (1-B-to-the-m)y. Combining ordinary and seasonal differencing applies both operators. In standard ARIMA notation, d and D record the ordinary and seasonal differencing orders.
Use evidence and context to choose the transformation. A deterministic trend can sometimes be modeled directly, while a stochastic trend motivates differencing. Structural breaks, changing variance, and unusual observations are not automatically repaired by repeated subtraction.
Avoid over-differencing. Differencing a series that is already stationary can introduce unnecessary dependence and increase noise. For independent zero-mean noise with variance sigma-squared, its first difference has variance 2 sigma-squared and lag-one covariance minus sigma-squared, giving autocorrelation -0.5.
Treat missing periods carefully. The difference between adjacent rows is a one-period change only when those rows represent consecutive periods. Missing observations, irregular spacing, and revisions can otherwise make the transformed values misleading.
Fit and evaluate the complete forecasting pipeline using information available at each forecast origin. After predicting differences, reconstruct levels using known anchors. Multi-step forecast errors are correlated through accumulation, so prediction intervals should come from the fitted model or a suitable simulation rather than adding interval endpoints mechanically.
Three practical examples
- A demand forecaster models weekly changes when demand levels display persistent wandering.
- An analyst compares each month's sales with the same month a year earlier using a seasonal difference.
- A monitoring team examines changes in changes to identify acceleration, while keeping the distinction from a two-period change explicit.
Think of it this way
Think of a vehicle's position and movement. First differences describe how far it moved between recorded times; differences of those movements describe how the movement changed. Neither is the original position, and the time interval determines how each should be interpreted.
Worked example
Consider an original five-period series: 100, 103, 107, 112, 118. Its first differences are 3, 4, 5, 6. Differencing those changes gives second-order differences 1, 1, 1.
By contrast, lag-two differences of the original series are 107-100 = 7, 112-103 = 9, and 118-107 = 11. These are clearly not the second-order differences.
Suppose, purely as a toy forecasting assumption, the next second-order difference is predicted to be 1. The next first difference is then 6 + 1 = 7, and the next level forecast is 118 + 7 = 125.
The arithmetic reconstructs the level from the change model. It does not prove that the pattern will continue, that second-order differencing is appropriate for a real process, or that the forecast has no uncertainty. A short sequence of smooth values is insufficient to establish a stochastic model's stationarity or forecast performance.
Illustrative case study
Fictional case: Pinebank Services initially models monthly workload in levels, then explores differencing because the series drifts over time. A revised pipeline improves some short-horizon forecasts, but a second round of differencing produces noisy alternating changes.
The analysts compare the candidate pipelines on rolling forecast origins and inspect residuals. They retain the smallest justified differencing order and publish forecasts back on the workload scale, with intervals that reflect accumulated uncertainty.
Common misconceptions and mistakes
Differencing is not the same as subtracting a fitted trend. A second-order difference is not a lag-two difference. Subtracting consecutive values does not automatically create independent observations or constant variance. A differenced forecast must be converted back if users need a level forecast. Repeatedly differencing until a plot looks flat can remove useful structure and create unnecessary noise.
Business use
Differencing supports forecasting, anomaly analysis, and dynamic regression when changes are the relevant modeling scale. Record the lag, order, frequency, and reconstruction rule. Explain whether a reported number is a level, a one-period change, or a seasonal change, since those quantities can lead to different operational decisions.
People also ask
Does differencing always make a series stationary?
No.
Can ordinary and seasonal differencing be combined?
Yes, when justified by the process and diagnostics.
Is a first difference a growth rate?
Not usually; it is an absolute change. A percentage change or log difference uses a different scale.
Check your understanding
What is the final first difference in the example?
Answer: Six.
What is the final lag-two difference?
Answer: Eleven.
If the next first difference is seven, what is the next level forecast?
Answer: 125.
Why is that not a guaranteed future value?
Answer: The continuation rule is an assumption.
Related terms
- First difference
- Seasonal difference
- Stationarity
- Backward shift operator
- ARIMA
- unit root
- detrending
- forecast reconstruction
Learn next
Compute first, second-order, and seasonal differences on a short series. Then compare an appropriately differenced model with a model containing a deterministic trend using time-respecting evaluation.
More in Time series and signal processing
- Delphi method - The Delphi method is a structured process for collecting and refining judgments from a panel through repeated rounds of questions and controlled feedback.
- Diagnostic checking - Diagnostic checking is the examination of a fitted model for signs that its assumptions or structure are inadequate for the intended use.
- Difference-equation filtering - Difference-equation filtering computes a discrete-time output from weighted current and past inputs and, in recursive filters, past outputs.
- Error cost function - An error cost function assigns a loss or cost to a forecasting error.
- Ex ante forecast - An ex ante forecast is a forecast produced using only information available at the time it is made.
- Exogenous variable - An exogenous variable is a variable whose value is treated as determined outside the model or system being analyzed.
Sources
Hyndman-hosted Glossary of Forecasting Terms, Differencing and backward-shift operator: https://robjhyndman.com/mwh3/FG4.pdf Hyndman and Athanasopoulos, Forecasting: Principles and Practice, ARIMA models and stationarity: https://otexts.com/fpp3/arima.html
Previous: Difference scores Next: Differentiable cross-entropy method