Level, slope, seasonal and irregular in one fitted model
Today let's understand a basic structural time series model, using one long monthly series as the running example throughout.
The series is AirPassengers, one of R's own built-in datasets: the monthly count of international airline passengers worldwide, from January 1949 to December 1960, 144 months in total, in thousands of passengers. It opens at 112 thousand and closes, twelve years later, at 432 thousand.
A basic structural model explains a series like this by splitting it into four separately moving pieces: level, slope, seasonal and irregular. This lesson names all four, fits them in R, and uses them to forecast ahead.
Here is the whole span, plotted in the order the months actually happened.
Look at that line. It climbs overall, from 112 up to a peak near 622 in the summer of 1960, and inside that climb, the same up-and-down wobble repeats every twelve months, a high every summer and a low every winter.
That's the shape a basic structural model is about to take apart.
Four states, and how level and slope evolve
A basic structural model writes the value observed each month as the sum of four hidden pieces, each moving by its own rule, instead of forcing the whole series through one smooth trend line.
- Level: roughly where the series sits right now.
- Slope: how fast that level is rising or falling.
- Seasonal: a pattern that repeats every twelve months.
- Irregular: whatever is left over once the other three are accounted for.
Statisticians call these four pieces states, and give each one a short symbol: level is \(\mu_t\) ("mu"), slope is \(\beta_t\) ("beta"), seasonal is \(\gamma_t\) ("gamma"), and irregular is \(\epsilon_t\) ("epsilon"). The small \(t\) just means "in month t", so \(\mu_{t-1}\) means the level one month before.
Level and slope work together the way a car's position and speed do. Next month's level is roughly this month's level plus this month's slope:
\(\mu_t = \mu_{t-1} + \beta_{t-1} + \eta_t\)
\(\eta_t\) ("eta") is a small, random nudge added fresh every month, so the level does not just move in a straight line, it bends gently as it goes. The slope itself is not fixed either. It drifts by its own small amount every month:
\(\beta_t = \beta_{t-1} + \zeta_t\)
\(\zeta_t\) ("zeta") is that month's own random nudge to the slope, separate from \(\eta_t\). A slope that can drift is allowed to speed up or slow down its own rate of climb over time, something a single, permanently fixed slope could never do.
See what a permanently fixed slope alone would look like against the real AirPassengers series.
The dashed red line is what a single, permanently fixed slope would trace: a straight line from the first month to the last. The solid blue line is the real series, and for most of its length it does not sit on that straight line, pulling above it through the second half of the 1950s. A level whose slope is allowed to drift, the way the equation above allows, has a mechanism to bend toward a curve like that. A level stuck with one fixed slope forever does not.