Module 8 · Days 71–80 · Part III

Causal Inference with DoubleML

Isolating causal impacts from observational economic data.

Start Day 71
0/10 days completed
0/10 videos published

What you'll learn

  1. 1
    Days 71–73
    Causal inference theory, confounding variables, and Directed Acyclic Graphs (DAGs).

    By the end: Students can state a macroeconomic **causal question** precisely in the potential-outcomes framework, and explain, with simulations they wrote themselves, how **confounding**, **mediators**, **colliders** and **bad controls** bias estimates. They can draw and analyse a **DAG** for the curriculum's question, *"What is the causal effect of Bank of Canada overnight-rate hikes on housing starts?"*, derive a valid **adjustment set**, check **overlap** in real data, and write a reviewed **causal design specification** that Days 74–80 implement with DoubleML.

  2. 2
    Days 74–77
    Nuisance parameters, cross-fitting, and partially linear regression models.

    By the end: Students understand **why** Double/Debiased Machine Learning works: the **partially linear model** and its **nuisance functions**; why naive "plug-in" ML gives biased causal estimates (**regularisation** and **overfitting bias**); how **Neyman-orthogonal scores** and **cross-fitting** fix them.

  3. 3
    Days 78–80
    The causal impact of BoC overnight-rate hikes on housing starts, controlling for the business cycle.

    By the end: Students answer the curriculum's causal question with a defensible, reproducible analysis. **Housing starts** enter the platform through the same path as every other series (source, seed, staging, mart, tests). The pre-registered DoubleML design estimates the effect of overnight-rate increases on housing starts across horizons. Students test robustness, quantify **sensitivity to unobserved confounding**, examine **asymmetry and heterogeneity**, and write a policy memo. Finally, they integrate the causal results into the orchestrated platform and its dashboards, and complete the **final capstone**, which ties Parts I–III together.

Tools

DoubleMLDAGsstatsmodels

The ten days

Before you start: module setup and project structure

Audience: MSc Economics students who completed Days 1–70 Environment: GitHub Codespaces · .venv-ml (plus networkx, doubleml, optionally dowhy) · marts in data/marts/*.parquet Time per day: ~2.5 hours (including breaks and exercises) Goal by end of Day 73: Students can state a macroeconomic causal question precisely in the potential-outcomes framework, and explain, with simulations they wrote themselves, how confounding, mediators, colliders and bad controls bias estimates. They can draw and analyse a DAG for the curriculum's question, "What is the causal effect of Bank of Canada overnight-rate hikes on housing starts?", derive a valid adjustment set, check overlap in real data, and write a reviewed causal design specification that Days 74–80 implement with DoubleML.


From "what will happen" to "what would happen if…"

Module 7 asked ŷ questions: what will inflation be next year? Every SHAP chart came with a warning that it described the model's associations, not causal effects (Day 65.6). Module 8 asks β̂ questions (Day 61.1):

If the Bank of Canada raises its policy rate by 25 basis points, by how much do housing starts change over the following months?

This is the question a policymaker actually faces, and a forecasting model can't answer it. Here's why, in one picture:

              economic boom
             /              \
            ▼                ▼
   BoC raises rates     housing starts rise
            \                ▲
             \──── (−) ──────┘     ← the effect we want

Booms make the Bank raise rates and also make builders start more houses. In raw data, rate hikes and strong housing therefore occur together. A naive regression may even suggest that hikes increase housing starts. Separating the true (presumably negative) effect from this common cause is the core problem of causal inference.

The plan for Module 8

DaysFocus
71–73causal theory, confounding and bad controls, DAGs, design specification
74–77nuisance parameters, cross-fitting, the partially linear model (DoubleML)
78–80the effect of BoC rate hikes on housing starts, with robustness and sensitivity analysis, integrated into the platform

Target structure (by end of Day 73)

causal/                         ← NEW
├── __init__.py
├── simulate.py                 ← synthetic worlds where the truth is known
├── dag.py                      ← DAG, backdoor paths, adjustment sets, d-separation
├── balance.py                  ← overlap and balance diagnostics on real data
├── DAG.md                      ← the reviewed causal graph, edge by edge
└── design_spec.yml             ← treatment, outcome, controls, exclusions, assumptions
notebooks/day71.ipynb … day73.ipynb

Install the extra libraries into the modelling environment:

cd /workspaces/macro-data-course
source .venv-ml/bin/activate
pip install networkx doubleml
pip install dowhy            # optional: cross-checks adjustment sets on Day 73
pip freeze > forecasting/requirements-ml.txt
mkdir -p causal && touch causal/__init__.py