MerQuR+Statistics Glossary

Statistics Glossary → Differencing

Differencingconcept

A transformation that subtracts from each value of a time series the previous value (or the value one season earlier) in order to remove trend and non-stationarity.

The first difference is Δy_t = y_t - y_(t-1); it turns a series of levels into a series of changes and removes a linear trend. The second difference is the difference of the first difference and removes a quadratic trend. The seasonal difference Δ_m y_t = y_t - y_(t-m), for example with m = 12 for monthly data, compares this year's value with the same month last year and removes the seasonal pattern. In an ARIMA model, d is the number of times the series is differenced to make it stationary.

Models such as ARIMA require stationary series, whose mean and variance do not change over time. Too little differencing leads to spurious regression and unreliable forecasts, while too much (over-differencing) induces artificial negative autocorrelation and needlessly large forecast variance. How many times to difference is decided from the ACF plot and unit-root tests such as ADF or KPSS; in practice d is usually 0, 1 or 2. Differencing removes trend but not changing variance; if the variance grows with the level, a logarithm may need to be taken first.

An everyday example

A city's population grows by roughly 20,000 people a year. Because the population series keeps rising, its mean changes over time. Subtracting each year's population from the previous year's gives a series of 'annual increases' that fluctuates around 20,000: the trend has gone and the series is stationary.

In MerQur

It is set in ARIMA Forecast by d (0-2) in the 'AR (p), Difference (d), MA (q)' parameter and by the seasonal D. In the Time Series analysis the 'Differencing recommendation (ndiffs / nsdiffs)' extra output suggests the required number of differences and seasonal differences.

Analyses where this concept appears

Time SeriesARIMA Forecast

Related concepts

StationarityARIMA orders (p, d, q) and drift