You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suppose we have a DataFramedata recording daily measures for three different markets y, x1 and x2, for t = 0..365).
The y time series in data is the one we will be modeling, while other columns (x1 and x2 here) will be used as a set of control time series.
At t = date_inter = 280, a marketing campaing (the intervention) is run for market y. We want to understand the impact of that campaign on our measure.
from causal_impact import CausalImpact
ci = CausalImpact(data, date_inter, n_seasons=7)
ci.run(max_iter=1000)
ci.plot()
After fitting the model, and estimating what the y time series would have been without any intervention, this will typically produce the following plots:
If you need access to the data behind the plots for further analysis, you can simply use the ci.result attribute (pandas.DataFrame object). Alternatively, you can also call
result = ci.run(return_df=True)
and skip the plotting step.
Issues and improvements
This package is still being developed. Feel free to contribute through github by sending pull requests or reporting issues.
About
Python package for causal inference using Bayesian structural time-series models.