What does Simpson's Paradox and Back-Door Adjustment conclude, in numbers, about “Enumerating Back-Door Sets: d-Separation, M-Bias and Counting Causal Graphs”?

Answer: Chapter 5 enumerates back-door sets and shows that adjusting for a pre-treatment collider creates a bias equal to 66.0 % of the effect.

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 only

descendants of X: C,M,Y
subsets tried 32  admissible 3  rejected 29
  admissible: {R,S}
  admissible: {S,F}
  admissible: {R,S,F}
minimal: {R,S}  {S,F}
  {S}: open back door
  {R,F}: open back door
  {S,R,M}: descendant of X
  {S,R,C}: descendant of X
Show the full program
# Chapter 5. p51: enumerate every back-door admissible set in a graph.
# Back-door criterion (Pearl 2009, 3.3.1): a set S is admissible for
# (X, Y) if no member of S descends from X and S d-separates X from Y
# in the graph with the arrows out of X removed. d-separation is
# tested by the moralised ancestral graph. Illustrative branch graph:
#   R region, S size, F footfall, X plan, M basket, Y sales,
#   C review (a collider of X and Y).
from itertools import combinations

EDGES = [("R", "X"), ("R", "F"), ("F", "Y"), ("S", "X"), ("S", "Y"),
         ("X", "M"), ("M", "Y"), ("X", "Y"), ("X", "C"), ("Y", "C"),
         ("R", "S")]
CANDS = ["R", "S", "F", "M", "C"]


def parents(edges, v):
    return [a for a, b in edges if b == v]


def ancestors(edges, nodes):
    out = set(nodes)
    stack = list(nodes)
    while stack:
        v = stack.pop()
        for p in parents(edges, v):
            if p not in out:
                out.add(p)
                stack.append(p)
    return out


def descendants(edges, v):
    out, stack = set(), [v]
    while stack:
        u = stack.pop()
        for a, b in edges:
            if a == u and b not in out:
                out.add(b)
                stack.append(b)
    return out


def dsep(edges, x, y, given):
    keep = ancestors(edges, [x, y] + list(given))
    sub = [(a, b) for a, b in edges if a in keep and b in keep]
    nb = {v: set() for v in keep}
    for a, b in sub:
        nb[a].add(b)
        nb[b].add(a)
    for v in sorted(keep):
        ps = sorted(parents(sub, v))
        for i, j in combinations(ps, 2):
            nb[i].add(j)
            nb[j].add(i)
    seen, stack = {x}, [x]
    while stack:
        u = stack.pop()
        for w in sorted(nb[u]):
            if w in given or w in seen:
                continue
            if w == y:
                return False
            seen.add(w)
            stack.append(w)
    return True


def main():
    cut = [(a, b) for a, b in EDGES if a != "X"]
    desc = descendants(EDGES, "X")
    print("descendants of X: " + ",".join(sorted(desc)))
    ok, bad = [], 0
    for r in range(len(CANDS) + 1):
        for s in combinations(CANDS, r):
            if set(s) & desc:
                bad = bad + 1
                continue
            if dsep(cut, "X", "Y", s):
                ok.append(s)
            else:
                bad = bad + 1
    print("subsets tried {}  admissible {}  rejected {}".format(
        2 ** len(CANDS), len(ok), bad))
    for s in ok:
        print("  admissible: {" + ",".join(s) + "}")
    mins = [s for s in ok if not any(set(t) < set(s) for t in ok)]
    print("minimal: " + "  ".join("{" + ",".join(s) + "}" for s in mins))
    for s in (("S",), ("R", "F"), ("S", "R", "M"), ("S", "R", "C")):
        why = "descendant of X" if set(s) & desc else (
            "ok" if dsep(cut, "X", "Y", s) else "open back door")
        print("  {" + ",".join(s) + "}: " + why)


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 5: Enumerating Back-Door Sets: d-Separation, M-Bias and Counting Causal Graphs. 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