关于「相关检验:共享对照、正回归相依与 BY 修正」,《伪发现率与文案规则检验》给出的定量结论是什么?

结论:第五章处理共享对照组的正相关、双侧与负相关,并精确构造一个让 BH 的伪发现率达到 0.0750 的反例,说明 BY 因子的必要。

数据口径:书中转化率、访客数与规则条数均为示意参数;全部计算由书中程序生成;本书属于非个人化经营建议。 本书用精确概率推翻这条常识:四十条全部无效的规则同时检验,平均每周冒出两条假冠军,至少一条的概率为 0.8715;模拟中每周最佳假冠军宣称的相对提升平均为 34.2 %,而真实提升为零。

English version

对照数据表

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

check: p1 takes every grid value once (uniform): True
check: p2 takes every grid value once (uniform): True
all nulls true, so FDR = P(any rejection)
BH at q0.05: FDR = 3/40 = 0.0750
bound q * H_20.0750
BY at q / H_2: FDR167/4000 = 0.0418
H_m for m2, 10, 40, 100:
m2 H_m = 1.5000 BY level = 0.03333
m10 H_m = 2.9290 BY level = 0.01707
m40 H_m = 4.2785 BY level = 0.01169
m100 H_m = 5.1874 BY level = 0.00964
查看完整验算程序
# Chapter 5. p52: under arbitrary dependence BH can exceed q, and the
# Benjamini-Yekutieli factor H_m is exactly what it can cost.
# Model: two true-null rules whose p-values are built from one
# uniform U so that each p is exactly uniform but the pair is
# arranged against BH (negative dependence on the low end):
#   U in [0, q/2):      p1 = U,         p2 = U + q
#   U in [q/2, q):      p1 = U + q/2,   p2 = U - q/2
#   U in [q, 3q/2):     p1 = p2 = U - q/2
#   U in [3q/2, 1):     p1 = p2 = U
# The FDR is computed exactly over a grid of U cells with Fraction,
# and the marginals are checked to be uniform. q = 0.05 illustrative.
import operator
from fractions import Fraction
from functools import reduce

Q = Fraction(1, 20)
CELLS = 4000


def pair(u, q):
    if u < q / 2:
        return u, u + q
    if u < q:
        return u + q / 2, u - q / 2
    if u < 3 * q / 2:
        return u - q / 2, u - q / 2
    return u, u


def bh_rejects(ps, q):
    m = len(ps)
    srt = sorted(ps)
    kmax = 0
    for k, p in enumerate(srt, 1):
        if p <= k * q / m:
            kmax = k
    return kmax


def fdr(level):
    hits = 0
    for c in range(CELLS):
        u = Fraction(2 * c + 1, 2 * CELLS)
        if bh_rejects(pair(u, Q), level) > 0:
            hits += 1
    return Fraction(hits, CELLS)


if __name__ == "__main__":
    grid = [Fraction(2 * c + 1, 2 * CELLS) for c in range(CELLS)]
    for j in (0, 1):
        same = sorted(pair(u, Q)[j] for u in grid) == grid
        print("check: p{} takes every grid value once (uniform): {}"
              .format(j + 1, same))
    h2 = 1 + Fraction(1, 2)
    print("all nulls true, so FDR = P(any rejection)")
    f = fdr(Q)
    print("BH at q = 0.05:        FDR = {} = {:.4f}".format(f, float(f)))
    print("bound q * H_2 = {:.4f}".format(float(Q * h2)))
    f = fdr(Q / h2)
    print("BY at q / H_2:         FDR = {} = {:.4f}".format(f, float(f)))
    print("H_m for m = 2, 10, 40, 100:")
    for m in (2, 10, 40, 100):
        hm = reduce(operator.add,
                    (Fraction(1, j) for j in range(1, m + 1)))
        print("  m = {:3d}  H_m = {:.4f}  BY level = {:.5f}".format(
            m, float(hm), float(Q / hm)))

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《多重比较与伪发现率控制、同时检验数十条文案规则的本杰明尼霍赫伯格阶梯母典》第 5 章「相关检验:共享对照、正回归相依与 BY 修正」(版本 1.0.0). 5D Library. DOI 待发布

DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-307 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026307,
  author    = {Fan, Yafu},
  title     = {Multiple Comparisons and False-Discovery-Rate Control: the Benjamini-Hochberg Step-Up for Testing Dozens of Copy Rules at Once},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

本书其他章节结论