In a business context, the leadership is often interested in the impact of a decision or event on the KPI of interest. As a performance analyst, I spend most of my time answering some variant of this question: “What is the impact of {News, government announcement, special event…} in the Country’s X performance?”. Intuitively, we can answer this question if we had a way of knowing what would have happened if the News/ announcement/ Special event had never happened.
This is the essence of causal inference, and some very talented people are working hard to make causal inference frameworks available for us to use.
Google Causal Impact library is one of those frameworks. Developed by Google to help them make better marketing budget decisions, this library can help us quantify the impact of any event or intervention on a time series of interest. It may sound scary, but it’s actually quite intuitive.
As business analysts, we should leverage these tools in our day-to-day lives; here are 5 easy steps you can take to implement your first Causal Impact analysis.
For this guide, we will be using Python.
We will start by installing the Google Causal Impact package.
>pip install tfcausalimpact
you can find more information about this package in github:https://github.com/WillianFuks/tfcausalimpact
To run a Causal Impact analysis, you only need 4 packages.
from causalimpact import CausalImpact
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
We can think of the Causal Impact framework as a time series problem.
On a specific date, we observe an event, news, etc.… and track how our measure of interest changes after this event compared to some baseline. You can think of your baseline as…