关于「反转有多常见:最小反例、随机表频率与抽样噪声」,《辛普森悖论与后门调整》给出的定量结论是什么?

结论:第二章找出只需九个顾客的最小反例,并用固定种子模拟得到随机表反转频率 0.01648,与约六十分之一的文献结果一致。

数据口径:书中门店、方案与成交数均为示意;全部计算由书中程序生成。 第一章在伯克利六个最大院系上复算反转:合并后男性录取率 0.445、女性 0.304,按申请者构成标准化后男性 0.387、女性 0.430;三店示意报表中甲在每店都高 0.050,合并后却落后 0.2493,并给出反转可能的充要条件。

English version

对照数据表

下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.01648

draws per k: 200000(uniform on the simplex)
reference 1/60 = 0.01667
k = 2P(reversal) = 0.01648se 0.000281 in 61
k = 3P(reversal) = 0.00596se 0.000171 in 168
k = 4P(reversal) = 0.00168se 0.000091 in 595
k = 6P(reversal) = 0.00014se 0.000031 in 7143
查看完整验算程序
# Chapter 2. p22: how often does a random 2 x 2 x k table reverse?
# Cell probabilities of the 4k cells (plan x outcome x branch) are
# drawn uniformly from the simplex (Dirichlet with all parameters 1,
# the prior used by Pavlides and Perlman 2009, who report about 1/60
# for k = 2). A reversal: every branch shows the same sign of the
# A-B gap and the pooled gap has the opposite sign (either way).
# Unnormalised exponentials suffice: every sign is scale-free.
# Fixed seed; standard library only.
import math
import random

DRAWS = 200000


def reversal(cells, k):
    # cells[s] = (A buy, A not, B buy, B not) probabilities
    signs = set()
    for a1, a0, b1, b0 in cells:
        g = a1 * (b1 + b0) - b1 * (a1 + a0)
        signs.add(g > 0)
    if len(signs) != 1:
        return False
    pa1 = math.fsum(c[0] for c in cells)
    pa = math.fsum(c[0] + c[1] for c in cells)
    pb1 = math.fsum(c[2] for c in cells)
    pb = math.fsum(c[2] + c[3] for c in cells)
    g = pa1 * pb - pb1 * pa
    return (g > 0) != signs.pop()


def rate(k, rng):
    hit = 0
    for _ in range(DRAWS):
        cells = [tuple(rng.expovariate(1.0) for _ in range(4))
                 for _ in range(k)]
        if reversal(cells, k):
            hit = hit + 1
    return hit / DRAWS


def main():
    rng = random.Random(20261113)
    print("draws per k: {}  (uniform on the simplex)".format(DRAWS))
    print("reference 1/60 = {:.5f}".format(1 / 60))
    for k in (2, 3, 4, 6):
        p = rate(k, rng)
        se = math.sqrt(p * (1 - p) / DRAWS)
        print("k = {}  P(reversal) = {:.5f}  se {:.5f}  1 in {:.0f}"
              .format(k, p, se, 1 / p))


if __name__ == "__main__":
    main()

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《辛普森悖论与后门调整准则、多分店数据合并结论反转与因果图去混杂母典》第 2 章「反转有多常见:最小反例、随机表频率与抽样噪声」(版本 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}
}

本书其他章节结论