What does Library Conflicts, Reproducibility and Erasure Codes conclude, in numbers, about “The Sampling Theory of Regression Audits: the Rule of Three and the Finite-Population Correction”?

Answer: Chapter 3 gives the rule of three for clean audits: showing a conflict rate below 0.01 with 95 % confidence takes 299 clean checks, almost regardless of library size.

Scope of the numbers: Library sizes, error rates, hazards and failure rates are illustrative; all calculations are generated by the programs in the book; the book is not legal, financial, procurement or storage-service advice. Chapter 1 draws the library as a knowledge graph and shows that the more volumes there are, the fewer places an error can hide: at 200 volumes, 0.9821 of deviant definitions in the illustrative library sit where another volume can contradict them.

中文版

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.01, 299, 95

(a) upper 95 % bound on the conflict rate
n x0 x = 1 x = 2 x = 5
1000.02951 0.04656 0.06162 0.10225
3000.00994 0.01571 0.02084 0.03472
1,0000.00299 0.00473 0.00628 0.01048
(b) n needed to certify a rate below 0.01
x <0: n = 299; x <= 1: n = 473; x <= 2: n = 628; x <= 3: n = 773
(c) N19,200 claims, D = 192 bad (rate 0.01)
n100: P(no bad in sample) hypergeometric 0.36508, binomial 0.36603
n299: P(no bad in sample) hypergeometric 0.04838, binomial 0.04954
n500: P(no bad in sample) hypergeometric 0.00615, binomial 0.00657
Show the full program
# Chapter 3. p32: audits that find some conflicts, and finite libraries.
# (a) Exact (Clopper-Pearson) one-sided 95 % upper bound when x of n
#     audited claims conflict, found by bisection on the binomial tail.
# (b) Smallest n that certifies a rate below 0.01 if at most x conflicts
#     are allowed in the sample (an acceptance-sampling plan).
# (c) Finite population: a library of 19,200 claims (the illustrative
#     size of p11) with 192 bad ones; the hypergeometric chance that a
#     sample of n contains none, against the binomial approximation.
import math

ALPHA = 0.05


def tail_le(x, n, p):
    terms = [math.comb(n, k) * p ** k * (1 - p) ** (n - k)
             for k in range(x + 1)]
    return math.fsum(terms)


def upper(x, n):
    lo, hi = x / n, 1.0
    for _ in range(80):
        mid = (lo + hi) / 2
        if tail_le(x, n, mid) > ALPHA:
            lo = mid
        else:
            hi = mid
    return hi


print("(a) upper 95 % bound on the conflict rate")
print("{:>6} {:>10} {:>10} {:>10} {:>10}".format(
    "n", "x = 0", "x = 1", "x = 2", "x = 5"))
for n in (100, 300, 1000):
    print("{:>6,} {:>10.5f} {:>10.5f} {:>10.5f} {:>10.5f}".format(
        n, upper(0, n), upper(1, n), upper(2, n), upper(5, n)))
print("(b) n needed to certify a rate below 0.01")
plan = []
for x in (0, 1, 2, 3):
    n = x + 1
    while upper(x, n) > 0.01:
        n += 1
    plan.append("x <= {}: n = {}".format(x, n))
print("    " + ";  ".join(plan))
N, D = 19200, 192
print("(c) N = {:,} claims, D = {} bad (rate 0.01)".format(N, D))
for n in (100, 299, 500):
    hyper = math.comb(N - D, n) / math.comb(N, n)
    print("    n = {:>3}: P(no bad in sample) hypergeometric {:.5f},"
          " binomial {:.5f}".format(n, hyper, (1 - D / N) ** n))

Single source and citation

Fan, Y. (2026). Cross-Volume Theorem-Conflict Detection in Large Bilingual Monograph Libraries, Anti-Decay of Code Reproducibility and Erasure-Coded Cold Storage (Version 1.0.0), Chapter 3: The Sampling Theory of Regression Audits: the Rule of Three and the Finite-Population Correction. 5D Library. DOI pending

DOI pending · monograph page goes live after publication · 5DL-B-182 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026182,
  author    = {Fan, Yafu},
  title     = {Cross-Volume Theorem-Conflict Detection in Large Bilingual Monograph Libraries, Anti-Decay of Code Reproducibility and Erasure-Coded Cold Storage},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

Other chapter answers in this book