AI Glossary / AI and machine learning / Intermediate
Bayesian structural time series
Definition
Bayesian structural time series, or BSTS, is a family of models that represents a time series through components such as trend, seasonality and regression effects, while using Bayesian inference to estimate them and their uncertainty.
What it means
A time series is a sequence of observations ordered in time. Its changes can reflect several processes at once: a long-term movement, a weekly pattern, outside influences and unexplained variation. A structural model represents selected processes as components rather than treating the series as an undifferentiated list.
The Bayesian approach places prior distributions on unknown quantities and updates them using observations. Forecasts can then reflect uncertainty about states, parameters and, in some formulations, predictor inclusion.
For business readers, the appeal is an interpretable decomposition with uncertainty. A trend component can help explain the forecast, but the model's labels are not automatically causal explanations. A component called seasonality is still an estimated pattern that should be checked.
How it works
A state-space formulation links observed values to hidden states, such as a changing level or seasonal effect. A transition model describes how those states evolve over time. Regression predictors can add information from related series when they are available at the relevant forecast time.
Inference estimates distributions over states and parameters. Simulating future states and observations produces a predictive distribution, from which summaries and intervals can be calculated. Some BSTS implementations use variable-selection priors to average over different predictor combinations.
Evaluation should respect time order. A rolling forecast test fits on the past and assesses later observations, avoiding future information leakage. Forecast intervals, unusual events and changing relationships need inspection. Using BSTS for a counterfactual or causal analysis adds further assumptions; a forecast alone does not establish what an intervention caused.
Three practical examples
- A retailer models weekly sales using a changing baseline, seasonal patterns and relevant known predictors.
- An operations team forecasts service volume while reporting a range rather than only one number.
- An analyst examines whether a time-series model's errors suggest missing seasonal structure or changing conditions.
Think of it this way
Think of listening to several instruments playing together. Separating their parts can help understand the combined sound. A structural model similarly represents components contributing to an observed series.
The analogy has limits because statistical components are inferred and may not be uniquely identifiable. A pleasing decomposition does not prove that the real process is divided exactly that way.
Worked example
Building a component-based forecast
In a simplified fictional forecast, the estimated baseline for next week is 120 orders, the seasonal contribution is +15 and a known predictor contributes -5. The point forecast is 120 + 15 - 5 = 130 orders.
Suppose the fitted model's predictive simulations produce a central 80% interval from 100 to 165. The interval reflects the model's uncertainty under its assumptions; it does not guarantee that eight out of every ten future weeks will fall inside unless calibration supports that interpretation over repeated forecasts.
The team can use 130 for a central plan and examine the interval when arranging flexibility. Simply adding the endpoints of separate component intervals would not generally give the correct total interval because components can be dependent. These figures illustrate interpretation, not a fitted real dataset.
Illustrative case study
A fictional repair center forecasts weekly incoming jobs. Its first model includes a seasonal component but assumes that a related enquiry count is available immediately. In practice, that count is finalized after the forecast must be issued.
The analysts rerun evaluation using only information available on each historical forecast date. They compare the revised model with a simple seasonal baseline and inspect interval coverage during busy periods.
The case shows that a sophisticated time-series structure cannot justify using future information. Operational timing is part of model validity.
Common misconceptions and mistakes
- Structural components prove causal effects. They describe the chosen model; causality needs additional design and assumptions.
- Bayesian intervals guarantee coverage in reality. Their usefulness depends on model fit and calibration.
- Any correlated series is a valid forecast predictor. It must be available at prediction time and remain relevant.
Business use
BSTS can support planning when trend, seasonality and external signals matter and uncertainty is useful. It is particularly valuable when teams need to discuss why a forecast changes rather than only consume a number.
Ask for comparisons with simple baselines, rolling evaluation and a clear record of predictor availability. For intervention studies, request the assumptions linking the counterfactual forecast to a causal interpretation. Report forecast uncertainty in terms decision-makers can use, such as capacity ranges or inventory scenarios.
People also ask
Does BSTS require every listed component?
No. The structure should fit the problem; trend, seasonality and regression are options.
Is it only for forecasting?
No. It can also support decomposition, nowcasting and carefully designed counterfactual analyses.
Does Bayesian mean the model updates instantly?
No. Update frequency and computation depend on the implementation.
Check your understanding
A predictor is published two weeks after the date being forecast. Can its final historical value be used as if it were known on that forecast date?
Answer: No. That would introduce future information and overstate realistic performance.
Related terms
- Time series
- Posterior predictive distribution
- state-space model
- seasonality
- trend
- nowcasting
- forecast evaluation
Learn next
Read state-space model and rolling-origin evaluation. List which inputs are actually known when your forecast must be issued before comparing model performance.
More in AI and machine learning
- Bayesian programming - Bayesian programming is an approach to specifying computational problems through probability models and answering questions by probabilistic inference.
- Bayesian regret - Bayesian regret is expected regret averaged over a prior distribution of possible environments or unknown parameters.
- Bayesian Ridge Regression - Bayesian ridge regression is linear regression with a Gaussian prior on the coefficients, producing a probability distribution over those coefficients.
- Behavioral clustering - Behavioral clustering groups entities according to similarities in observed behavior.
- Behavioral simulation
- Bidirectional - In AI, bidirectional describes a model that reads a sequence in both directions at once, from start to end and from end to start, so each word or item is...
Sources
Steven L. Scott and Hal R. Varian, Predicting the Present with Bayesian Structural Time Series: https://people.ischool.berkeley.edu/~hal/Papers/2013/pred-present-with-bsts.pdf. Author-provided research describes structural components, regression and Bayesian model averaging. The order forecast and repair-centre story are original examples.
Previous: Bayesian statistics Next: Bayesian survival analysis