Inspired by my 2025 data science internship | By Chris Oh
Most people think of time series analysis as forecasting – predicting what comes next. But forecasting isn’t the only thing we can do with time series data. We can also use it to answer a causal question: what was the effect of an intervention?
This is something that happened in the past, and is especially useful when experiments aren’t possible. Think of a Super Bowl ad, a global product launch, or a nationwide policy change. You can’t run an A/B test in those cases.
That’s where Bayesian Structural Time Series (BSTS) models come in.
A time series is just data collected over time at regular intervals. Examples:
What makes time series special is that each data point is not independent; today’s value is often influenced by yesterday’s. Time series analysis tries to capture these patterns: trend, seasonality, and noise.
Formally, a time series model can be written as:
$$ y_t = \mu_t + \tau_t + \beta X_t + \epsilon_t $$
Where:
This decomposition allows us to not just fit a line through the past, but to model the underlying structure of the system.
When measuring causal impact in time series, we split the data into two periods: