CausalImpact: A new open-source package for estimating causal effects in time series

This blogpost, written by Mary Radomile for R-bloggers, looks at the open-source R package CausalImpact which can be used for causal analyses. The post looks at how CausalImpact works and provides a detailed example of its use. 

Excerpt

"The CausalImpact R package implements a Bayesian approach to estimating the causal effect of a designed intervention on a time series. Given a response time series (e.g., clicks) and a set of control time series (e.g., clicks in non-affected markets, clicks on other sites, or Google Trends data), the package constructs a Bayesian structural time-series model with a built-in spike-and-slab prior for automatic variable selection. This model is then used to predict the counterfactual, i.e., how the response metric would have evolved after the intervention if the intervention had not occurred.

As with all methods in causal inference, valid conclusions require us to check for any given situation whether key model assumptions are fulfilled. In the case of CausalImpact, we are looking for a set of control time series which are predictive of the outcome time series in the pre-intervention period. In addition, the control time series must not themselves have been affected by the intervention."

Sources

Mary Radomile (2014), CausalImpact: A new open-source package for estimating causal effects in time series, R-bloggers. Retrieved from: http://www.r-bloggers.com/causalimpact-a-new-open-source-package-for-estimating-causal-effects-in-time-series/