Skip to content

Latest commit

 

History

History

README.md

CausalPy tutorials

Three worked, runnable notebooks. Each has a rendered Markdown copy next to it so you can read it on GitHub without launching Jupyter.

  1. Identification  (markdown) — turn a causal graph into an estimand across seven cases: back-door, front-door, the Napkin graph, a nested Napkin, a multi-treatment sequential (mSBD) effect, plan identification, and a non-identifiable bow — each with the drawn ADMG and the rendered LaTeX formula.
  2. Estimation  (markdown) — estimate effects on four graphs, all with OM / balancing-IPW / DML: back-door, a multi-treatment sequential regime do(X1, X2), the Napkin ratio-form c-component effect, and a one-dimensional front-door graph — each with the drawn ADMG and a comparison to the SCM ground truth.
  3. Custom SCM  (markdown) — build your own structural causal model from scratch and run the full identify → estimate → validate loop on it.

Running them

From the repository root, in the environment that has requirements.txt installed:

pip install jupyter      # for the notebooks only — not a library dependency
jupyter lab tutorials/

Each notebook's first cell adds the repository root to sys.path, so imports such as import example_SCM resolve when the notebook is launched from tutorials/. The Markdown copies are generated from the executed notebooks with jupyter nbconvert --to markdown.