Judea Pearl's *The Book of Why* gives you the philosophy and mathematics of causal inference—the ladder of causation, the do-operator, counterfactuals. After reading it, you feel "causal inference matters," but you may have no idea what to do at work tomorrow.
Matheus Facure's *Causal Inference for the Brave and True* fills exactly that gap. It is an open-source, free, Python-based practical tutorial on causal inference, teaching you how to "bravely and correctly" uncover hidden causal relationships in real business and data settings.
If Pearl's book is the *Principia* of causal inference, Facure's book is its *Engineering Manual*.
1. Why Is This Book Different?
Most causal inference textbooks suffer from two problems:
Problem one: too mathematical. Pages of theorems and proofs, with no idea how to run anything on real data. Problem two: too academic. Examples revolve around "drug trials" and "education policy," disconnected from internet/business scenarios.
Facure's book solves both:
1. Free and open-source: readable online at https://matheusfacure.github.io/python-causality-handbook/ with all code on GitHub 2. Python hands-on: every chapter has runnable Jupyter Notebooks with real datasets 3. Business scenarios: examples from marketing attribution, pricing strategy, product evaluation 4. Toolchain integration: covers modern tools like EconML (Microsoft), CausalNLP, and DoWhy
> Facure's philosophy: causal inference shouldn't belong only to academia—it should be a standard skill for every data scientist. You don't need a PhD; you just need to be "brave"—willing to do causal inference on real data instead of hiding behind correlation.
2. A Tour of the Core Methodology
1. Potential Outcomes Framework
Unlike Pearl's graphical models, Facure primarily uses Donald Rubin's potential outcomes framework. Core concepts:
- Y(1): the potential outcome if an individual receives treatment
- Y(0): the potential outcome if they don't
- Individual Treatment Effect (ITE): Y(1) - Y(0)
- T-Learner: separate models for treated and control groups; predict the difference
- S-Learner: a single model with treatment as a feature
- X-Learner: a two-stage method that works better with imbalanced group sizes
- DoWhy (Microsoft): causal inference framework based on Pearl's graphical models
- EconML (Microsoft): heterogeneous treatment effect estimation
- CausalNLP: causal inference in natural language
- CausalImpact (Google): time-series causal inference
- SyntheticControl: synthetic control method
The problem: you can only ever observe one of the two. This is the "fundamental problem of causal inference."
2. Randomized Controlled Trials (RCT) — The Gold Standard
With random treatment assignment, confounders are evenly distributed between groups, so comparing group means directly gives the causal effect.
> But in business, RCTs are often impossible: you can't randomly raise prices or stop service for users. So you need other methods.
3. Propensity Score Matching (PSM)
Core idea: match control units "similar" to treated ones. Similarity is defined by the propensity score—the probability of receiving treatment P(T=1|X), usually estimated with logistic regression.
> Key assumption: ignorability—all confounders are measured. One unmeasured confounder and PSM's results are wrong.
4. Difference-in-Differences (DiD)
With a treated group, a control group, and treatment occurring only in the treated group, compare trends before and after.
DiD = (treated after - treated before) - (control after - control before)
Key assumption: parallel trends—without treatment, both groups would have changed identically.
> DiD is a workhorse of policy evaluation. Card & Krueger (1994) used it to study minimum wage effects on employment, overturning conventional wisdom.
5. Regression Discontinuity Design (RDD)
When treatment is determined by a threshold on a continuous variable, compare units just above and just below the cutoff—they are nearly randomly assigned.
> RDD is called "the observational study closest to an RCT." Its key assumption is that units cannot precisely manipulate their position near the threshold.
6. Doubly Robust (DR) Estimation
DR combines propensity scores and regression models. It's "doubly robust" because: as long as either the propensity model or the regression model is correct, the estimate is unbiased.
> Extremely valuable in practice—you only need one model to be right, greatly reducing misspecification risk.
7. Double Machine Learning (DML)
DML merges causal inference with machine learning: ML models predict Y and T separately, then the causal effect comes from regressing residuals.
> DML's advantage: handles high-dimensional confounders without manually selecting controls. Microsoft's EconML provides implementations.
8. Heterogeneous Treatment Effects (HTE) and Meta-Learners
Treatment effects differ across individuals. HTE estimation supports personalized decisions:
> HTE underpins personalized recommendations and precision medicine: not "does this ad work on average?" but "does this ad work for this kind of user?"
3. A Practical Case: Marketing Attribution
Problem: You ran ads; users saw them and bought. Did the ads cause the purchases, or would those users have bought anyway?
Wrong approach: Compare purchase rates of ad-viewers vs. non-viewers. Ad-viewers may have been more interested to begin with (selection bias).
Correct approaches: 1. If you have randomized data (A/B tests), compare directly 2. Otherwise, use PSM to match "similar" users 3. Or use instrumental variables (IV)—e.g., quasi-random ad exposure as the instrument
> Facure emphasizes: there is no perfect causal inference method, only methods "acceptable under specific assumptions." Know each method's assumptions and judge whether they're plausible in your setting.
4. Causal Inference vs. A/B Testing
Facure points out A/B testing's limits:
1. Costly: every experiment requires engineering effort and may hurt user experience 2. Ethics: some experiments can't be run (healthcare, finance) 3. External validity: effects during the experiment may not reflect long-term effects 4. Network effects: treated users' behavior spills over into the control group
> The value of causal inference: extracting causal signal from observational data when A/B tests aren't possible. It complements, not replaces, experimentation.
5. The Toolchain: From Theory to Code
pip install.6. Why "Brave and True"?
Brave: causal inference requires assumptions—no unmeasured confounding, parallel trends, functional forms. These may be wrong, and your conclusions may be wrong. You must bravely make assumptions, then honestly test them.
True: real data is dirty, incomplete, and selection-biased. You can't assume textbook-clean data; you need engineering methods to handle real-world complexity.
> Facure's attitude: don't skip a method because it's imperfect. Use the best method, make the most honest assumptions, give the most credible estimate—and let decision-makers know how uncertain that estimate is. That is "brave and true" causal inference.
7. Implications for the AI Era
As LLMs begin "analyzing data" and "making recommendations," causal inference matters more. LLMs can find correlations, but they can't tell you "if we change X, what happens to Y"—that's causal inference's domain.
The future data scientist needs not to "run more models" but to "ask better why questions." Facure's book is a starting point: upgrading from "X correlates with Y" to "X causes Y," from prediction to intervention, from curve-fitting to understanding the world.
> In an era where AI handles nearly all prediction tasks, causal inference remains a uniquely human reasoning ability—at least for now.
---
Book: Causal Inference for the Brave and True Author: Matheus Facure Free online: https://matheusfacure.github.io/python-causality-handbook/ Code: https://github.com/matheusfacure/python-causality-handbook