Local Linear Trend and Seasonality
Summary
The BSTS model decomposes trend as a local linear trend with a stochastic slope (random walk with drift) and seasonality as a sum-to-zero constraint over seasons. Both are modular state-space components that can be combined independently. The local linear trend adapts quickly to short-term variation but can produce implausibly wide uncertainty for long-horizon predictions.
Local Linear Trend
Definition: Local Linear Trend
The level and slope evolve as:
- : current level (value of trend at time )
- : slope (expected increment in per time step)
Both the level and slope evolve as random walks.
Interpretation:
- controls level noise — how quickly the trend level jumps
- controls slope noise — how quickly the trend slope changes
Trade-off: Very flexible (adapts to local variation), but produces wide prediction intervals for long-horizon forecasting since the slope itself drifts.
Generalization: AR(1) Slope
A more stable variant allows the slope to exhibit AR(1) variation around a long-term slope :
where is the learning rate. This model balances short-term local variation with a long-term slope , preventing the slope from drifting without bound.
Seasonality Component
Definition: Seasonal State Component
For seasons, the seasonal effect evolves as:
where is the number of seasons per period and denotes their joint contribution to the observed response.
Key property: The mean of is zero when summed over seasons — this is the sum-to-zero seasonal constraint.
Example: For monthly seasonality (), each new month’s seasonal effect is minus the sum of the previous 11 months’ effects, plus noise.
Transition matrix for seasonality: An matrix with ‘s along the top row, ‘s along the subdiagonal, and ‘s elsewhere.
Multiple seasonal periods: For daily data, one might include (day-of-week) and (annual). The cycle: set when not a new week, standard seasonal matrix when starting a new week.
Combining Components
The full state vector concatenates all components:
The overall matrices , , become block-diagonal with one block per component (assuming independent component errors).
Choosing Components in Practice
- Always include: Local level (at minimum gives random walk)
- Seasonality: Include when seasonal pattern is obvious by inspection
- Trend: Include local linear trend for data with visible trend; use AR(1) slope for longer-range forecasting
- Static vs. dynamic regression: Static when treatment-control relationship is stable; dynamic when relationship changes over time
Connections
- Components of Bayesian Structural Time-Series Model
- Fits are used in MCMC Inference for CausalImpact (Kalman filter/smoother)
- The resulting counterfactual prediction drives Counterfactual Impact Estimation
See Also
- Bayesian Structural Time-Series Model — full state-space setup
- MCMC Inference for CausalImpact — how these components are estimated
- Single Marketing Time Series — ARIMA and classical time series models that these state-space components complement
- Linear-Gaussian State-Space Models — these are state components of the general state-space form