Time Series Components

Pull up the monthly sales of a coffee chain over five years and you will not see a single trend — you will see several patterns tangled together. Sales drift upward year on year as the brand grows. They spike every December and sag every summer. Some years the whole economy runs hot or cold, dragging everything with it. And on top of all that sits a layer of unpredictable jitter. A time series is almost never one story; it is a sum of stories, and the first job of time-series analysis is to pull them apart.

Do that cleanly and the forecast, the anomaly alarm and the "is this year really better?" question all become tractable. Leave them tangled and every model you fit will be confused.

The four components

The classical decomposition splits a series y_t at each time t into four parts:

They combine in one of two ways. An additive model, y_t = T_t + S_t + C_t + R_t, fits when the seasonal swing is a roughly constant size regardless of the level. A multiplicative model, y_t = T_t \times S_t \times C_t \times R_t, fits when the seasonal swing grows with the level — December is always +20%, not always +500 units. A quick test: if the peaks fan out as the trend climbs, go multiplicative (or take logs, which turns a multiplicative model back into an additive one).

Trend plus seasonality, drawn

The curve below is a synthetic monthly series built from exactly two ingredients — a gentle upward trend and a repeating annual wave: y_t = 2 + 0.15\,t + 1.4\sin(t). Real data would add cyclical swings and noise on top, but even this toy shows the signature you learn to spot: a line that climbs while it oscillates.

The straight dashed line is the trend alone; the wavy curve is trend + seasonality. The vertical gap between them at any point is the seasonal contribution — here a fixed-amplitude wave, the hallmark of an additive series.

Autocorrelation: a series remembers itself

What makes time series special is that neighbouring points are not independent — today's value is a good clue to tomorrow's. We measure that self-similarity with autocorrelation: the ordinary correlation of the series with a lagged copy of itself. A lag of k means "shift the series by k steps and line it up against the original."

Plot the autocorrelation at every lag and you get the ACF (autocorrelation function). It is a fingerprint: a slow, gradual decay signals a strong trend; a spike that recurs every 12 lags in monthly data screams "annual seasonality." Reading an ACF tells you which components are present before you fit anything.

Stationarity: why models demand it

Most classical forecasting models assume the series is stationary — its statistical character does not drift over time. Concretely: constant mean, constant variance, and an autocorrelation that depends only on the lag, not on when you look. A stationary series has no trend and no seasonality; it looks the same in 2020 as in 2025.

Why insist on this? Because a model learns a relationship from the past and projects it forward — and that is only valid if the relationship is stable. A trending series breaks the assumption: its mean is a moving target, so any correlation you measure is dominated by the shared drift (the same spurious-correlation trap that makes two unrelated rising series look linked).

The cure is differencing: instead of modelling y_t, model the change \nabla y_t = y_t - y_{t-1}. Differencing a straight-line trend turns it into a flat constant — a stationary series — and a second difference kills a curved trend. Seasonal differencing, y_t - y_{t-12}, removes an annual pattern the same way. This is the "I" (integrated) at the heart of ARIMA.

The number of Nobel laureates a country produces and its chocolate consumption are famously correlated — not because chocolate makes you brilliant, but because both have risen over time alongside national wealth. Any two series that trend upward will correlate strongly, however unrelated, because the shared drift dominates the arithmetic. This is the time-series face of confounding, and it is exactly why we difference: comparing the year-to-year changes strips out the common trend and reveals whether the two things actually move together once the tide is removed. Correlate levels and you fool yourself; correlate changes and you have a fighting chance.

Beginners lump "seasonality" and "cyclical" together, but the distinction is sharp and it matters. Seasonality has a fixed, known period — 12 months, 7 days, 24 hours — so you can put a confident marker on next December before it arrives. A cycle has no fixed period: the business cycle averages maybe five years but the next recession could be in two years or eight, and its timing is genuinely uncertain. That difference decides your model: seasonal patterns are predictable and get a dedicated seasonal term; cyclical swings are largely unpredictable and mostly widen your forecast's uncertainty bands. Calling a cycle "seasonal" will make you dangerously overconfident about when the next turn comes.

Learn this on Kaggle

Kaggle Learn's Time Series course walks through trend and seasonality decomposition, lag features and autocorrelation on real forecasting datasets in Python — the natural place to see these components extracted and plotted with pandas and statsmodels.