What does Simpson's Paradox and Back-Door Adjustment conclude, in numbers, about “How Common Are Reversals? The Smallest Example, Random Tables and Sampling Noise”?

Answer: Chapter 2 finds the smallest reversal, which needs nine customers, and a seeded simulation gives a reversal frequency of 0.01648 for random tables, in line with the published figure of about one in sixty.

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.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
Show the full program
# 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()

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 2: How Common Are Reversals? The Smallest Example, Random Tables and Sampling Noise. 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