Bayesian Causal Impact Analysis

Statistics
Introduced by
Brodersen, Gallusser, Koehler, Remy & Scott (Google)
Year
2015
Type
Bayesian causal inference / time series
Family
Quasi-experimental / causal inference

What does it do?

Bayesian Causal Impact Analysis estimates the causal effect of an intervention on a time series outcome using a Bayesian structural time series (BSTS) model.

Brodersen and colleagues at Google introduced it in 2015. The model is fitted to pre-intervention data and projected forward to give a probabilistic counterfactual, an estimate of what the series would have looked like without the intervention. This is compared with the observed post-intervention values to yield a posterior distribution over the causal effect. The uncertainty is conditional on the assumed state-space structure, the priors and the control covariates; the method does not make the estimate free of model assumptions.

The intuition behind the method

Suppose a marketing campaign started on a known date and you want to know whether it changed sales. Sales would have moved anyway because of seasonality, trends, or correlated markets. The method models the outcome before the campaign using its own history and related control series, such as sales in markets the campaign did not reach. It then asks what the model, trained only on the pre-campaign period, predicts for the post-campaign period if nothing had changed. The gap between that prediction and the observed values is the estimated effect, reported as a probability distribution rather than a single number. The counterfactual plays the role of a synthetic control built from the control series.

History

Kay H. Brodersen and colleagues at Google introduced Bayesian Causal Impact Analysis in a 2015 paper in the Annals of Applied Statistics. Scott and Varian (2014) had described the Bayesian structural time series framework with spike-and-slab selection of predictors for short-term forecasting; Brodersen et al. adapted this type of model to estimate causal impact via a counterfactual. The 2015 paper states that the CausalImpact R package implements the approach.

When to use it

Use Bayesian Causal Impact when there is a single treated time series with a clearly defined intervention date, a pre-intervention history long enough to learn the trend, any seasonality and the relationship with the controls, and, ideally, control series that were not affected by the intervention and that move together with the outcome before it. It suits digital marketing, product launches, policy roll-outs, and other settings where randomisation is not possible and a probabilistic effect estimate is needed. A longer, stable pre-period generally gives more stable estimates; check the fit and the width of the credible intervals on your own data. Avoid it when the pre-intervention period is very short, when the intervention is gradual with no clear start date, or when the pre-period is too unstable to anchor the counterfactual. Control series are strongly recommended; without them the counterfactual rests on the outcome's own history and is more trend-dependent. In such cases interrupted time series or difference-in-differences may be more suitable, depending on the data available.

Limitations and considerations

  • Requires a sufficiently long and stable pre-intervention period; a short or structurally changing pre-period can give an unreliable counterfactual.
  • The counterfactual depends on the quality of the control covariates; without informative controls, the forecast largely extrapolates the outcome's own trend.
  • Assumes the relationship between the controls and the outcome observed before the intervention would have continued unchanged afterwards. If the intervention alters that relationship, the estimated effect is biased.
  • Spillover from the intervention into the control series violates the requirement that covariates are unaffected, and the estimate is then unreliable.
  • Relies on MCMC posterior sampling, so it is more computationally demanding than least-squares interrupted time series analysis, although this is usually manageable for applied data sizes.
  • Assumes the pre-intervention model structure is correct; misspecified trend or seasonal components can bias the counterfactual.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Gives a posterior distribution over the causal effect, so credible intervals and posterior probabilities of a positive or negative effect come from the same model fit.
  • Models trend and, when included, seasonality within the state-space structure, so recurring patterns in the pre-period are represented explicitly rather than left in the residuals.
  • Uses spike-and-slab priors on regression coefficients to select among many candidate control series, reducing the need for manual covariate selection.
  • Builds the counterfactual from control time series rather than requiring a parallel group of comparison units, so it can be applied when only one treated series is available.
  • Its pointwise and cumulative effect plots, with uncertainty bands, show when an effect appears and how it accumulates over the post-intervention period.

Applications

  • Estimating the sales lift or user-engagement impact of a digital marketing campaign launched on a specific date.
  • Evaluating the effect of a public health policy (e.g., a ban, mandate, or programme) on a health outcome time series.
  • Measuring the causal impact of a product feature release on platform metrics such as retention or revenue.
  • Assessing the economic impact of a natural disaster, regulation, or shock on regional output or employment.
  • Evaluating educational reforms or curriculum changes on standardised test score trends.
  • Quantifying the effect of media coverage events (news, social media spikes) on stock prices or search volumes.

How it works

How it works

1

The pre-intervention outcome is modelled as a local linear trend (a level and a slope that each evolve over time) plus a regression term on the control covariates. The first formula gives the observation and level equations; the slope evolves as a random walk, delta_t = delta_{t-1} + zeta_t, with its own disturbance term. Seasonal components are optional and can be added when the outcome is seasonal. Spike-and-slab priors on the regression coefficients, as used by Scott and Varian, allow the model to shrink most coefficients toward zero and retain the predictors the data support. This matters when many candidate control series are available.

Formula
y_t = \mu_t + x_t^\top \beta + \varepsilon_t, \quad \mu_t = \mu_{t-1} + \delta_{t-1} + \eta_t, \quad \delta_t = \delta_{t-1} + \zeta_t
2

The fitted model is projected forward through the post-intervention period using the control covariates observed in that period, without using the outcome values observed after the intervention. The result is a posterior predictive distribution for what the outcome would have been without the intervention. This distribution reflects uncertainty in the fitted parameters and in future disturbances, conditional on the assumed model structure and priors.

Formula
\hat{y}_t^{\text{cf}} = \mathbb{E}[y_t \mid y_{1:T_0}, x_{1:T}, \theta]
3

At each post-intervention time point, the pointwise effect is the observed value minus the counterfactual prediction, as in the third formula. These pointwise effects are summed or averaged to give cumulative and average effect estimates, each with a posterior credible interval.

Formula
\hat{\tau}_t = y_t - \hat{y}_t^{\text{cf}}, \quad t > T_0
4

Because the whole procedure is Bayesian, uncertainty in the counterfactual, the pointwise effects and the cumulative effect all comes from one posterior distribution, so no separate bootstrap or permutation step is needed. Posterior samples of the counterfactual are subtracted from the observed series to give samples of the effect, from which intervals and probabilities are computed. This uncertainty is conditional on the chosen model structure and priors; a different specification can produce different intervals.

5

The summary reports the average and cumulative estimated effects with credible intervals, together with the posterior probability that the effect is positive (or negative). The average effect describes the typical per-period difference over the post-period; the cumulative effect is the total accumulated difference, which is meaningful for additive quantities such as sales. If an interval for the effect includes zero, or the posterior probability of a positive effect is near 0.5, the evidence for the direction of the effect is weak. This probability is not a classical p-value and not a threshold test, and all intervals are conditional on the model. A plot shows the observed series, the counterfactual, and the pointwise and cumulative effects with uncertainty bands.

Common pitfalls

  • Using control covariates that were themselves affected by the intervention. This biases the counterfactual and therefore the estimated effect.
  • Reading a high posterior probability as proof of causality. The probability is conditional on the model, the priors, and the assumption that the control-outcome relationship would have held without the intervention. Its credibility depends on how well the model fits the pre-period and whether the controls remained stable.
  • Choosing an intervention date after the effect has already begun, or ignoring anticipation before launch. The pre-period then contains part of the treatment effect, which the counterfactual carries forward as if it were baseline.
  • Applying the method to a very short pre-intervention window, which leaves the BSTS model poorly identified and the counterfactual unreliable.
  • Omitting seasonal components when the outcome is seasonal, so that a recurring seasonal swing after the intervention date is attributed to the intervention.

Frequently asked questions

What makes this Bayesian rather than a standard interrupted time series?

Standard interrupted time series fits a regression with a structural break and typically reports frequentist confidence intervals. Bayesian Causal Impact places priors on the model parameters, propagates uncertainty through a state-space model, and delivers a full posterior over the counterfactual trajectory, pointwise effects and cumulative impact. This uncertainty is conditional on the assumed state-space structure, the priors and the control covariates; it does not make the estimate free of model assumptions.

How many pre-intervention time points do I need?

There is no universal cut-off. The BSTS model needs enough pre-intervention data to learn the trend, any seasonal pattern and the covariate relationships. A longer pre-period generally gives more stable estimates; check the pre-period fit and the width of the credible intervals on your own data, and be cautious when the pre-period is short.

Do I need control series (covariates)?

They are not strictly required, but they are strongly recommended. Without control covariates, the counterfactual is based only on the outcome's own history and trend, which is a weaker basis and may miss external shocks. Good control series are variables that correlate with the outcome in the pre-period but were not affected by the intervention.

What does the posterior probability of a causal effect mean?

It is the probability, given the model and data, that the intervention had a positive (or negative) effect. A value of 0.97 means that 97% of the posterior mass falls on the side of a positive effect. It is not a classical p-value, but it plays an analogous communicative role. A value near 0.5 indicates weak evidence of direction, and the probability remains conditional on the model and its assumptions.

When should I prefer difference-in-differences over this method?

Prefer difference-in-differences when you have multiple treated and comparison units and a credible parallel-trends assumption that can be examined with pre-treatment data. Bayesian Causal Impact is more suitable when you have a single treated series with a long history and valid control series, but no natural comparison group.

Related methods

Sources

  1. Brodersen, K. H., Gallusser, F., Koehler, J., Remy, N., & Scott, S. L. (2015). Inferring causal impact using Bayesian structural time-series models. Annals of Applied Statistics, 9(1), 247-274.

    Open DOI reference
  2. Scott, S. L., & Varian, H. R. (2014). Predicting the present with Bayesian structural time series. International Journal of Mathematical Modelling and Numerical Optimisation, 5(1-2), 4-23.

    Open DOI reference