# Causal InferenceWhat If **Repository Path**: econometric/causal_inference_python_code ## Basic Information - **Project Name**: Causal InferenceWhat If - **Description**: Python Code for Causal Inference: What If - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 13 - **Forks**: 16 - **Created**: 2020-03-01 - **Last Updated**: 2025-03-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Python Code for _Causal Inference: What If_ This repo contains Python code for Part II of the book _Causal Inference: What If_, by Miguel Hernán and James Robins ([book site](https://www.hsph.harvard.edu/miguel-hernan/causal-inference-book/)): > Hernán MA, Robins JM (2020). _Causal Inference: What If_. Boca Raton: Chapman & Hall/CRC. The code here roughly corresponds to the Stata, R, or SAS programs found at the book site. ## Python dependencies Required Python packages: - numpy - pandas - statsmodels - scipy - matplotlib - linearmodels - tqdm If you use the [Anaconda](https://www.anaconda.com/distribution/) distribution of Python, you'll have most of those packages already, and you'll only need to install - linearmodels - tqdm ## Data The data can be obtained from the [book site](https://www.hsph.harvard.edu/miguel-hernan/causal-inference-book/). The notebooks all assume that the Excel version of the data has been saved in the same directory as the notebooks. ## Author James Fiedler, with contributions from [Petty PY Chen](https://github.com/pettypychen) and [Piyush Madan](https://github.com/piyushmadan)