In a business context, leadership is typically 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 variation of this question: “What is the impact of {News, government announcements, special event…} on the performance of Country X?” 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 so that we can use causal inference frameworks.
The Google Causal Impact library is one such framework. Developed by Google to help you make better marketing budget decisions, this library can help us quantify the impact of any event or intervention over a time series of interest. It may seem scary, but it’s actually quite intuitive.
As business analysts, we should take advantage of these tools in our daily lives; Here are 5 easy steps you can follow to implement your first causal impact analysis.
For this guide, we will use Python.
We will start by installing the Google Causal Impact package.
>pip install tfcausalimpact
You can find more information about this package on 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 look at an event, news story, etc.… and track how our measure of interest changes after this event compared to some baseline. You can think of your baseline as…