Computing Library › Machine Learning
Machine Learning

Stationarity and Autocorrelation

Stationarity means a series statistics do not change over time; autocorrelation measures how a series relates to its own lags.

Why stationarity matters

A time series is stationary if its statistical properties, mean, variance, and autocorrelation structure, do not change over time. Many classical forecasting methods, including ARIMA, assume stationarity because it lets the same relationships learned from the past apply to the future. Non-stationary series with trends or changing variance violate this and produce misleading fits and spurious correlations.

Making a series stationary

Kronos motion — lego machine

Formal tests help decide. The augmented Dickey-Fuller test has a null hypothesis of non-stationarity (a unit root); rejecting it supports stationarity. The KPSS test frames the null the other way, so the two are often used together for a fuller picture.

Autocorrelation

The autocorrelation function (ACF) measures the correlation between the series and itself at each lag; the partial autocorrelation function (PACF) measures that correlation after removing the effect of shorter lags. Together they reveal periodicity, the memory length of the process, and, for ARIMA, plausible AR and MA orders. A slowly decaying ACF signals a trend that needs differencing.

Reading the plots

A sharp spike in the ACF at the seasonal lag indicates seasonality; a PACF that cuts off after lag p suggests an AR(p) process, while an ACF that cuts off after lag q suggests MA(q). These diagnostics turn model selection from guesswork into a guided procedure, and they double as residual checks: a well-specified model should leave residuals with no significant autocorrelation.