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 is really important," but you may not know 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 hands-on tutorial that teaches you how to uncover hidden causal relationships "bravely and correctly" in real business and data environments.
If Pearl's book is the *Principia* of causal inference, Facure's book is its *engineering handbook*.
1. Why Is This Book Different?
Most causal inference textbooks have 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 are "drug trials" and "education policies," disconnected from internet/business scenarios.
Facure's book addresses both directly:
1. Free and open-source: read the whole book at https://matheusfacure.github.io/python-causality-handbook/ ; all code is on GitHub 2. Python in practice: every chapter has runnable Jupyter Notebooks with real datasets 3. Business scenarios: examples come from marketing attribution, pricing strategy, product evaluation—directly relevant to what data scientists face daily 4. Toolchain integration: covers modern tools like EconML (Microsoft's causal inference library), 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 Methods
The book covers the main practical methods of causal inference, from simple to complex:
1. Potential Outcomes Framework
Unlike Pearl's graphical models, the book 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 not treated
- Individual Treatment Effect (ITE): Y(1) - Y(0)
- T-Learner: train separate models on treated and control, predict the difference
- S-Learner: include treatment as a feature in a single model
- X-Learner: a more complex two-stage approach, 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 catch: you can only observe one of the two—the same person can't be treated and untreated simultaneously. This is the "fundamental problem of causal inference."
2. Randomized Controlled Trials (RCT) — The Gold Standard
With random assignment, confounders are evenly distributed between treatment and control groups, so comparing group means directly yields the causal effect.
> But in business, RCTs are often impossible: you can't randomly raise prices or randomly stop service. Hence the other methods.
3. Propensity Score Matching (PSM)
Core idea: match control units "similar" to treated ones. "Similar" is defined via the propensity score—the probability of receiving treatment P(T=1|X), usually estimated with logistic regression.
> The key assumption is ignorability—all confounders are measured. One unmeasured confounder and PSM results are wrong.
4. Difference-in-Differences (DiD)
With a treatment and a control group where treatment affects only one, compare the change in trends before and after.
DiD = (treated after − treated before) − (control after − control before)
Key assumption: parallel trends—without treatment, both groups would change identically.
> DiD is a policy-evaluation workhorse. Card & Krueger (1994) used DiD to study minimum wage effects on employment, overturning the conventional wisdom.
5. Regression Discontinuity Design (RDD)
When treatment is determined by a threshold on a continuous variable (e.g., a passing exam score), compare units just above and just below the cutoff—they're nearly randomly assigned.
> RDD is called "the observational study closest to an RCT." Its key assumption is that individuals cannot precisely manipulate their position near the threshold.
6. Doubly Robust Estimation (DR)
DR combines propensity scores with regression models. It's "doubly robust" because: as long as either the propensity model or the regression model is correct, the estimate is unbiased.
> Hugely important in practice—you don't need both models right, just one. This greatly reduces model misspecification risk.
7. Double Machine Learning (DML)
DML combines causal inference with ML: use machine learning models to predict Y and T (treatment) separately, then regress residuals to get the causal effect.
> DML's advantage: handles high-dimensional confounders without manually selecting controls. Microsoft's EconML provides DML implementations.
8. Heterogeneous Treatment Effects (HTE) and Meta-Learners
Treatment effects vary across individuals. HTE estimation supports personalized decisions:
> HTE underlies personalized recommendations and precision medicine: not "does this ad work on average?" but "does it work for this type of user?"
3. Case Study: Marketing Attribution
The book's most typical business case is marketing attribution:
Question: Users saw your ad and then bought. Did the ad cause the purchase, or would they have bought anyway?
Wrong approach: compare purchase rates of ad-exposed vs. unexposed users. Exposed users may already be more interested (selection bias)—that comparison is not a causal effect.
Right approach: 1. If randomized experiment data (A/B test) exists, compare directly 2. Otherwise, use PSM to match "similar" users 3. Or use instrumental variables (IV)—e.g., quasi-random ad exposure as an instrument
> Facure stresses: there is no perfect causal inference method, only methods "acceptable under specific assumptions." Know each method's assumptions and judge whether they hold in your scenario.
4. Causal Inference vs. A/B Testing
Internet companies love A/B tests, but Facure points out their limits:
1. Cost: each experiment needs 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: in social networks, treated behavior spills over to controls
> The value of causal inference: extracting causal signals from observational data when A/B tests aren't possible. It complements, not replaces, experimentation.
5. The Toolchain: From Theory to Code
pip install away.6. Why "Brave and True"?
The words in the title aren't decoration.
Brave: causal inference requires assumptions—no unmeasured confounding, parallel trends, functional form. They may be wrong, and so may your conclusions. Be brave enough to make assumptions, then honestly test them.
True: real data is dirty, incomplete, selection-biased. You can't assume textbook-clean data; you need engineering methods to handle real-world complexity.
> Facure's attitude: don't skip causal inference because methods are imperfect. Use the best methods, make the most honest assumptions, give the most credible estimates—and make sure decision-makers know the uncertainty. 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 find correlations, but they can't tell you "if we change X, what happens to Y"—that's causal inference's domain.
Future data scientists need not "better model running" but "better asking why." Facure's book is a starting point: upgrade from "X correlates with Y" to "X causes Y," from prediction to intervention, from curve fitting to understanding the world.
> In an era when AI handles nearly every prediction task, causal inference remains an irreplaceably human reasoning skill—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