What does Simpson's Paradox and Back-Door Adjustment conclude, in numbers, about “The Back-Door Adjustment Formula: Standardisation, Inverse Probability Weighting and a Structural Model with a Known Answer”?
Answer: Of all customers, the flagship holds 41/112, the community branch 5/16 and the outlet 9/28. With this mix, the conversion rate if everyone received plan A is 223/448, or 0.4978; if everyone received plan B it is 1003/2240, or 0.4478; the average effect is exactly 1/20, that is, 0.0500. Weighted by plan A's mix, A is at 0.3455 and B at 0.2955; weighted by plan B's mix, A is at 0.6447 and B at 0.5947. Under all three weightings the effect is plus 0.0500, because in this illustrative example the within-branch gap is the same in every branch. The last line prints the naive pooled gap again, minus 0.2493, for comparison.
Scope of the numbers: Branches, plans and conversions are illustrative; all calculations are generated by the book's programs. This is general analysis, not individualised business advice.
Data table
The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 0.0500, 0.2955, 0.3455, 0.4478, 0.4978, 0.5947
| P(z): flagship 41/112 community 5/16 outlet 9/28 | |
| P(buy | do(A)) | 223/448 = 0.4978 |
| P(buy | do(B)) | 1003/2240 = 0.4478 |
| average effect A-B | 1/20 = +0.0500 |
| A's mix : A 0.3455 B 0.2955 A-B +0.0500 | |
| B's mix : A 0.6447 B 0.5947 A-B +0.0500 | |
| naive P(buy|A) - P(buy|B) | -0.2493 |
Show the full program
# Chapter 3. p31: the back-door adjustment formula on the p12 counts.
# If the branch Z blocks every back-door path from plan X to purchase
# Y, then P(y | do(x)) = sum_z P(y | x, z) P(z) (Pearl 2009, 3.3.1).
# Three weightings: P(z) over all customers (average effect), the mix
# of A's customers (effect on those offered A) and the mix of B's.
# Exact Fraction arithmetic; counts illustrative.
from fractions import Fraction as F
DATA = [("flagship", 40, 50, 270, 360),
("community", 90, 200, 60, 150),
("outlet", 60, 300, 9, 60)]
def standardise(weights):
da = F(0)
db = F(0)
for (name, y1, n1, y2, n2), w in zip(DATA, weights):
da = da + w * F(y1, n1)
db = db + w * F(y2, n2)
return da, db
def main():
na = nb = 0
for row in DATA:
na, nb = na + row[2], nb + row[4]
n = na + nb
pz = [F(r[2] + r[4], n) for r in DATA]
print("P(z): " + " ".join("{} {}".format(r[0], p)
for r, p in zip(DATA, pz)))
da, db = standardise(pz)
print("P(buy | do(A)) = {} = {:.4f}".format(da, float(da)))
print("P(buy | do(B)) = {} = {:.4f}".format(db, float(db)))
print("average effect A-B = {} = {:+.4f}".format(
da - db, float(da - db)))
for label, nn, col in (("A's mix", na, 2), ("B's mix", nb, 4)):
w = [F(r[col], nn) for r in DATA]
a, b = standardise(w)
print("{} : A {:.4f} B {:.4f} A-B {:+.4f}".format(
label, float(a), float(b), float(a - b)))
ya = yb = 0
for r in DATA:
ya, yb = ya + r[1], yb + r[3]
print("naive P(buy|A) - P(buy|B) = {:+.4f}".format(
float(F(ya, na) - F(yb, nb))))
if __name__ == "__main__":
main()Single source and citation
Fan, Y. (2026). Simpson's Paradox and the Back-Door Criterion: Reversals When Branch Data Are Pooled and De-Confounding with Causal Graphs (Version 1.0.0), Chapter 3: The Back-Door Adjustment Formula: Standardisation, Inverse Probability Weighting and a Structural Model with a Known Answer. 5D Library. DOI pending
DOI pending · monograph page goes live after publication · 5DL-B-302 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026302,
author = {Fan, Yafu},
title = {Simpson's Paradox and the Back-Door Criterion: Reversals When Branch Data Are Pooled and De-Confounding with Causal Graphs},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}Other chapter answers in this book
- Chapter 1 · Every Branch Wins, the Total Loses: the Reversal Condition for 2 x 2 x k Tables
- Chapter 2 · How Common Are Reversals? The Smallest Example, Random Tables and Sampling Noise
- Chapter 4 · One Table, Three Causal Graphs: Confounder, Mediator and Collider
- Chapter 5 · Enumerating Back-Door Sets: d-Separation, M-Bias and Counting Causal Graphs
- Chapter 6 · Sampling Error in Stratified Estimates: Intervals, Power and Sparse Strata
- Chapter 7 · Classics East and West: the Lüshi Chunqiu on Examining Hearsay, and Yule 1903
- Chapter 8 · Forced Stratification and Adjustment of Multi-Branch Reports: the Closed Loop, the Tool and a Pre-Registered Test