jrfiedler/causal_inference_python_code
jrfiedler/causal_inference_python_code has 1,363 GitHub stars and 413 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-07 07:23 UTC. Last push 2022-01-08.
Python code for part 2 of the book Causal Inference: What If, by Miguel Hernán and James Robins
Measured star growth
- in 24h
- 0
- in 7 days
- Update delayed
- in 15 days
- Update delayed
- in 1 month
- Update delayed
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
OriginalPython 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):
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.
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
- tqdm
If you use the Anaconda 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.
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 and Piyush Madan
Explore related projects
Asabeneh/30-Days-Of-Python
The 30 Days of Python programming challenge is a step-by-step guide to learn the Python programming language in 30 days. This challenge may take more than 100 days. Follow your own pace. These videos may help too: https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw
78,303 starsgrafana/grafana
The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
77,752 starsredis/redis
For developers, who are building real-time data-driven applications, Redis is the preferred, fastest, and most feature-rich cache, data structure server, and document and vector query engine.
77,268 starsapache/superset
Apache Superset is a Data Visualization and Data Exploration Platform
75,448 stars