CausalMBSTS: MBSTS Models for Causal Inference and Forecasting

Iavor Bojinov, Fiammetta MenchettiOpenalex Unknown 2020 · DOI · OpenAlex

Abstract

Infers the causal effect of an intervention on a multivariate response through the use of Multivariate Bayesian Structural Time Series models (MBSTS) as described in Menchetti & Bojinov (2020). The package also includes functions for model building and forecasting.

Introduction

Determining the causal impact of an intervention—such as a marketing campaign or a policy shift—is a fundamental task in data science. When dealing with multiple related time series, univariate analysis can be insufficient as it ignores the dependencies between variables. The CausalMBSTS R package provides a robust framework for multivariate causal inference, allowing researchers to construct sophisticated counterfactuals that account for shared trends, seasonality, and cycles across a multivariate response.

Methodology

The core of the package is the Multivariate Bayesian Structural Time Series (MBSTS) model. This approach decomposes time series into interpretable components:

  • Structural Components: Users can define combinations of local levels (trends), slopes, seasonal patterns, and cycles.
  • Bayesian Inference: The model employs Markov Chain Monte Carlo (MCMC) sampling, specifically a Gibbs sampler, to estimate the joint posterior distribution of parameters and latent states.
  • Causal Estimation: By training on pre-intervention data and using post-intervention covariates, the model samples from the Posterior Predictive Distribution (PPD). The causal effect is defined as the difference between observed outcomes and the mean of this predicted counterfactual.
  • Variable Selection: To handle high-dimensional predictors, the model incorporates a sparsity assumption, automatically selecting the most relevant covariates during the estimation process.

The primary function, CausalMBSTS, requires several parameters to define the model structure and the intervention event, as detailed in the documentation.

Parameters for the CausalMBSTS function, including structural components and intervention details.

Key Insights

  • Multivariate Synergy: Modeling responses together captures dependencies that univariate models miss, leading to more stable and accurate counterfactual predictions.
  • Interpretability via Decomposition: Unlike "black-box" models, MBSTS allows users to see exactly how much of the signal is attributed to trend versus seasonality, making causal claims more transparent.
  • Integrated Uncertainty: As a fully Bayesian framework, it provides a full distribution of effects, allowing for the calculation of credible intervals for both pointwise and cumulative impacts.
  • Automated Feature Selection: The inclusion of a selection matrix in the regression component means the model can effectively ignore irrelevant predictors, reducing the risk of overfitting.

Results and Output

The package generates a comprehensive set of outputs for causal analysis, including pointwise effects at each time step and cumulative effects over the post-intervention period. It also provides Bayesian p-values to assess statistical significance.

The output structure of the CausalMBSTS function, detailing the estimated effects and MCMC results.

Built-in plotting functions (plot.CausalMBSTS) facilitate the visualization of these effects alongside posterior predictive checks to validate model performance in the pre-intervention phase.

Conclusion and Limitations

While powerful, CausalMBSTS has limitations. MCMC-based estimation is computationally intensive, often requiring at least 1,000 iterations for reliable results. Additionally, the current implementation assumes Gaussian disturbance terms and is designed for a single, well-defined intervention date. Future work may address non-Gaussian data and more complex intervention scenarios.

Summary updated

Abstract

Infers the causal effect of an intervention on a multivariate response through the use of Multivariate Bayesian Structural Time Series models (MBSTS) as described in Menchetti &amp; Bojinov (2020) &lt;<a href="https://doi.org/10.48550/arXiv.2006.12269" target="_top">doi:10.48550/arXiv.2006.12269</a>&gt;. The package also includes functions for model building and forecasting.
BibTeX
@inproceedings{bojinov2020causalmbsts,
  author = {Iavor Bojinov and Fiammetta Menchetti},
  title = {{CausalMBSTS: MBSTS Models for Causal Inference and Forecasting}},
  booktitle = {Openalex Unknown},
  year = {2020},
  doi = {10.32614/cran.package.causalmbsts},
}
Figure