Applied Health Economics, RWE & HTA
Overview / Module 3
Module 3 · Part 2 · Causal evidence · Days 21–30

Causal Inference for Real-World Evidence

DAGs, target trial emulation, time-related biases, propensity scores, doubly robust estimators, MSMs, subgroups and bias analysis for comparative effectiveness.

Tools

Pythonscikit-learnRWeightItcobaltMatchItgrf

Module capstone

Emulated trial of Renavex vs standard care

The 10 days

About this module

Renavex reached Ontario's formulary in October 2025 and Quebec's in February 2026. A payer now asks the question every HTA agency asks after listing: does it work as well in routine care as in the trial? The patients are older and sicker, nobody was randomized, and doctors gave the drug to the people they were most worried about. Module 3 answers the question with the methods RWE teams use: causal diagrams, target trial emulation, propensity scores, doubly robust estimators, and sensitivity analysis. As in every module, the generator knows the true effect, so every estimate is graded.

The real-world extract. python data/make_data.py now also writes the Renavex RWE extract: the 9,805 Corridor Health adults with type 2 diabetes and CKD stage 3a–4 who were alive and not on dialysis on 1 January 2026, followed to 31 December 2028. Earlier files come out byte-identical.

FileWhat
rwe_persons.csvthe extract's people, their usual prescriber, nephrology care, and the date of any Renavex start in 2025
rwe_labs.csveGFR and urine albumin-to-creatinine ratio (UACR) results, 2024–2028
rwe_dispensations.csvRenavex and new SGLT2 inhibitor dispensings (90-day supplies), 2026–2028
rwe_events.csvkidney failure, hospitalization and death, 2026–2028
truth/rwe_*.csvhidden: each person's true kidney function and its decline, their frailty, and their outcomes under other treatment strategies

Baseline history (diagnoses, drugs, hospital stays) comes from the 2019–2025 warehouse, joined on person_id. In the generator, Renavex multiplies the hazard of kidney failure by 0.75 while it is taken and slows eGFR decline by 40%. Doctors start it more often when eGFR is low, albuminuria is present and a nephrologist is involved, and less often in frail patients.

What you build in Days 21–23

DayYou buildYou learn
21corridor/dag.py, corridor/renavex_dag.py, corridor/rwe.pyDAGs, d-separation, the backdoor criterion; confounders, mediators and colliders; confounding by indication
22corridor/tte.py (sequential target trials)The target trial protocol, eligibility and time zero, new users, the g-formula, bootstrapping people
23corridor/exposure.py (dispensing episodes, person-months)Immortal time, time-varying exposure, grace periods, risk sets with left truncation

What you build in Days 24–26

DayYou buildYou learn
24corridor/ps.py (propensity scores, balance, weights, matching)Propensity score models, overlap, balance diagnostics, matching, IPW, the ATE / ATT / ATO estimands, effective sample size
25corridor/dr.py (AIPW and TMLE by hand)Doubly robust estimation, influence-function standard errors clustered by person, TMLE's targeting step, what double robustness does and does not protect against
26corridor/msm.py (censoring weights, stabilized treatment weights, a marginal structural model)Treatment–confounder feedback, inverse probability of censoring weights, per-protocol effects of sustained strategies, MSMs, the parametric g-formula

Days 24 and 25 reuse the twelve monthly sequential trials from Day 22 (m3/trials.parquet). Day 26 goes back to the person-months from Day 23, because "always" and "never" are strategies over 36 months, not decisions on one day.

What you build in Days 27–29

DayYou buildYou learn
27corridor/hte.py (subgroup effects, interaction tests, shrinkage, cross-fitting, DR-learner)Relative vs absolute heterogeneity, risk-based subgroups (PATH), double machine learning, causal forests (grf), presenting subgroups to an HTA committee
28corridor/bias.py (negative control outcome, E-values, simple and probabilistic bias analysis)Detecting residual confounding, how strong a confounder would need to be, correcting for a confounder measured in a validation substudy
29corridor/reporting.py (CDA-AMC section checker, deviation log)The CDA-AMC Guidance for Reporting Real-World Evidence, the HARPER protocol template, RECORD-PE, data fitness, design diagrams, pre-specification

New data (Day 28). python data/make_data.py now also writes rwe_frailty_substudy.csv: a chart review that recorded the Clinical Frailty Scale for a random 1,000 people in the extract (frail_cfs5 = CFS 5 or more), with the imperfect accuracy of a real chart review (sensitivity 0.85, specificity 0.95). Earlier files come out byte-identical. New packages: scikit-learn (Python, Day 27) and grf (R, Day 27).