Causal modeling using Python
Several Python libraries provide you with easy-to-use functionalities for using causal methods and conducting causal inference. Some of these are as follows:
dowhy
(https://pypi.org/project/dowhy/)pycausalimpact
(https://pypi.org/project/pycausalimpact/)causalnex
(https://pypi.org/project/causalnex/)econml
(https://pypi.org/project/econml/)bnlearn
(https://pypi.org/project/bnlearn/)
In the next few subsections, we will review dowhy
and bnlearn
.
Using dowhy for causal effect estimation
First, we want to practice with a propensity score matching approach that is useful when you have a treatment variable in mind – for example, when you want to identify the effect of a drug on patients and have other variables in the model, such as their diet, age, sex, and so on. Here, we will use the breast cancer dataset of scikit-learn
, where the target variable is a binary outcome telling us about the cells, from masses of...