• Yoonkang Low

Causal Impact Analysis in R, and now Python!

What is Causal Impact?

According to the dedicated web page, Causal Impact implements an approach to estimate the causal effect of a designed intervention on a time series. For example, how many additional daily clicks were generated by an advertising campaign? Answering a question like this can be difficult when a randomized experiment is not available.

How does it work?

Given a response time series (e.g., clicks) and a set of control time series (e.g., clicks in non-affected markets or clicks on other sites), the package constructs a Bayesian structural time-series model. This model is then used to try and predict the counterfactual, i.e., how the response metric would have evolved after the intervention if the intervention had never occurred.

How do I get started in R?

The dedicated web page has a very comprehensive run-through, that includes:

Installing the package

Creating an example dataset

Running analysis

Plotting Results

Working with dates and times

Extracting and printing summary statistics

Adjusting the model

Customising the model

How do I get started in Python?

Recently, Jamal Senouci has "translated" the Causal Impact analysis package from R to Python! I've compiled a walk through on my github page for Python users so you too can now reap the benefits of this very useful package! I've included a link to Jamal's original page too.

Please click here to get started!

Yoonkang Low is a freelance Analytical and Data Science consultant with over 9 years experience, including time with analytical agencies, and at Amazon.

#python #r

9,607 views1 comment

Recent Posts

See All