关于「后门集合的枚举:d 分离、M 型偏差与因果图的计数」,《辛普森悖论与后门调整》给出的定量结论是什么?
结论:第五章枚举后门集合,并说明对一个处理前的对撞变量作调整会带来相当于效应 66.0 % 的偏差。
数据口径:书中门店、方案与成交数均为示意;全部计算由书中程序生成。 第一章在伯克利六个最大院系上复算反转:合并后男性录取率 0.445、女性 0.304,按申请者构成标准化后男性 0.387、女性 0.430;三店示意报表中甲在每店都高 0.050,合并后却落后 0.2493,并给出反转可能的充要条件。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库
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查看完整验算程序
# 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()唯一数据源与引用
范雅福(Fan, Y.). (2026). 《辛普森悖论与后门调整准则、多分店数据合并结论反转与因果图去混杂母典》第 5 章「后门集合的枚举:d 分离、M 型偏差与因果图的计数」(版本 1.0.0). 5D Library. DOI 待发布
DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 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}
}