Understand what is CausalImpact and how it can be used to understand the causal effect of an event in the absence of an experiment.
What is CausalImpact?
CausalImpact is a package created by Kay H. Brodersen that uses Bayesian statistics to infer the causal effect of an event.
It is commonly used in pre-post experiments or to evaluate the effect of a past event.
How CausalImpact Works?
CausalImpact (CI) uses predictive analytics to estimate what would have happened to a variable in the absence of an event.
Then, it compares the actual results to the estimation.
In other words, it tries to estimate the counterfactual and compare it to the observations.
CausalImpact can be used in two ways
- Simple pre-post experiment
- Compared against control groups
Simple pre-post experiment
CausalImpact can be used with a single dataset (y) without any control group.
In which case, using seasonality and other factors, Causalimpact will make a prediction based on previously observed data in the absence of an event.
Then, it will compare the actual observation to the predicted data.
Compared against control groups
CausalImpact can be used with a test dataset (y) with 1 or multiple control groups (X1, X2, …, Xn).
In this case, it will use the control groups to try to make a better estimation of the data in the absence of the event.
How to use CausalImpact
Below are two tutorials to help use CausalImpact in R (original package) or Python (wrapper).
Intepret the CausalImpact Graph
Regardless of the style applied to your graphs, it should look something like this.
In the graph above:
- the vertical dotted line represents the intervention date
dotted line represents the boundary where above means positive variations and below negative variations.
- The shaded area represents the confidence interval.
The top graph shows the observed data against the predicted values.
The middle graph shows the point effect of one against each other
The bottom graph shows the cumulative effect of the confidence interval.
Given a 95% confidence interval, Causal Impact will tell you whether your experiment is statistically significant.
In the graph, statistical significance is reached whenever the shade area goes above or below the 0 line (like in the example below).
Science Behind CausalImpact
Sr SEO Specialist at Seek (Melbourne, Australia). Specialized in technical SEO. In a quest to programmatic SEO for large organizations through the use of Python, R and machine learning.