Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jrfiedler/causal_inference_python_code
Python code for part 2 of the book Causal Inference: What If, by Miguel Hernán and James Robins
https://github.com/jrfiedler/causal_inference_python_code
causal-inference causality data-science python
Last synced: 12 days ago
JSON representation
Python code for part 2 of the book Causal Inference: What If, by Miguel Hernán and James Robins
- Host: GitHub
- URL: https://github.com/jrfiedler/causal_inference_python_code
- Owner: jrfiedler
- Created: 2018-02-04T23:00:19.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-01-08T02:29:18.000Z (almost 3 years ago)
- Last Synced: 2024-10-01T18:04:14.080Z (about 1 month ago)
- Topics: causal-inference, causality, data-science, python
- Language: Jupyter Notebook
- Homepage:
- Size: 1.51 MB
- Stars: 1,237
- Watchers: 51
- Forks: 387
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
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.
This Python version roughly corresponds to the Stata, R, or SAS programs found at the book site, and was also translated into Julia, [here](http://www.github.com/jrfiedler/causal_inference_julia_code).
The code in this repo has been checked against the 30 March 2021 version of the book.
## Python dependencies
Required Python packages:
- numpy
- pandas
- statsmodels
- scipy
- matplotlib
- linearmodels
- tqdmIf 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)