关于「Wald 的两条直线:边界、OC 函数与平均样本量」,《规则的一生》给出的定量结论是什么?

结论:Wald 的序贯检验把证据写成逐个访客的累加,两条边界在计数平面上是斜率 0.03291、间距 22.97 个转化的两条平行直线,任何人都能拿周报里的累计访客与转化数对照它们。p22 的公式显示,「约一半」的节省在基线处成立,0.460;在目标处只到 0.616;介于两者之间的平庸规则,平均样本量升到固定样本的 0.728。这些都是忽略越界量的近似。那么,按逐个访客精确计算,真实的错误率与平均样本量是多少?样本量的分布有多长的尾巴,一条流水线又该在什么时候喊停?第三章用精确递推回答。

数据口径:书中的转化率、流量与每周计数均为示意;全部计算由书中程序生成;本书属非个人化经营方法,不构成经营、法律或投资建议,规则的转正、降级与退役须由主事者人工放行,紧迫感只能来自真实库存与真实截止。 书中以标注框区分已发表的证据、可运行的 Python 计算(20 段程序)、原典与作者的假说。

English version

对照数据表

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

fixed-sample n (one-sided, alpha 0.05, power 0.80): 5314
zero-drift point p* = 0.03291
true pP(KEEP)Wald ASNASN / fixed n
0.024000.00019270.174
0.027000.002813870.261
0.030000.050024440.460
0.032000.220835010.659
0.032910.359838190.719
0.034000.543138700.728
0.036000.800032750.616
0.039000.950222280.419
0.042000.987315860.298
saving at p0: 0.540saving at p1: 0.384
查看完整验算程序
# Chapter 2. p22: Wald's OC and ASN formulas against the fixed sample
# Model: same SPRT as p21 (p0 0.03, p1 0.036, alpha 0.05, beta 0.20).
# Wald (1945, 1947) neglects the overshoot over the boundaries and gets
# OC L(p) = (e^{hA} - 1) / (e^{hA} - e^{hB}), where h != 0 solves
# p (p1/p0)^h + q (q1/q0)^h = 1, and ASN E[N] = (L B + (1 - L) A) / E z
# with E z the mean step. At the zero-drift point E[N] = -A B / E z^2.
# The fixed-sample size is the one-sided normal-approximation n for the
# same alpha and power. Illustrative parameters; no randomness.
import math
from statistics import NormalDist

P0, P1 = 0.03, 0.036
ALPHA, BETA = 0.05, 0.20
A = math.log((1 - BETA) / ALPHA)
B = math.log(BETA / (1 - ALPHA))
LA = math.log(P1 / P0)
LB = math.log((1 - P1) / (1 - P0))


def p_of_h(h):
    u, v = (P1 / P0) ** h, ((1 - P1) / (1 - P0)) ** h
    return (1 - v) / (u - v)


def h_of_p(p):
    lo, hi = -6.0, 6.0          # p_of_h falls as h rises
    for _ in range(200):
        mid = (lo + hi) / 2
        if abs(mid) < 1e-12:
            mid = 1e-9
        if p_of_h(mid) > p:
            lo = mid
        else:
            hi = mid
    return (lo + hi) / 2


def oc_asn(p):
    ez = math.fsum([p * LA, (1 - p) * LB])
    if abs(ez) < 1e-12:
        ez2 = math.fsum([p * LA * LA, (1 - p) * LB * LB])
        return A / (A - B), -A * B / ez2
    h = h_of_p(p)
    ea, eb = math.exp(h * A), math.exp(h * B)
    oc = (ea - 1) / (ea - eb)
    return oc, math.fsum([oc * B, (1 - oc) * A]) / ez


nd = NormalDist()
za, zb = nd.inv_cdf(1 - ALPHA), nd.inv_cdf(1 - BETA)
root = math.fsum([za * math.sqrt(P0 * (1 - P0)),
                  zb * math.sqrt(P1 * (1 - P1))])
n_fix = math.ceil((root / (P1 - P0)) ** 2)
p_star = -LB / (LA - LB)
print("fixed-sample n (one-sided, alpha 0.05, power 0.80): %d" % n_fix)
print("zero-drift point p* = %.5f" % p_star)
print("true p   P(KEEP)   Wald ASN   ASN / fixed n")
for p in (0.024, 0.027, 0.030, 0.032, p_star, 0.034, 0.036, 0.039,
          0.042):
    oc, asn = oc_asn(p)
    print("%.5f  %7.4f  %9.0f  %13.3f" % (p, 1 - oc, asn, asn / n_fix))
o0, n0 = oc_asn(P0)
o1, n1 = oc_asn(P1)
print("saving at p0: %.3f   saving at p1: %.3f"
      % (1 - n0 / n_fix, 1 - n1 / n_fix))

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《线上规则实证淘汰、序贯概率比检验接入真实转化流与新文案规则转正降级母典》第 2 章「Wald 的两条直线:边界、OC 函数与平均样本量」(版本 1.0.0). 5D Library. DOI 待发布

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

BibTeX
@book{fan2026263,
  author    = {Fan, Yafu},
  title     = {Empirical Retirement of Live Rules: Wiring the Sequential Probability Ratio Test into Real Conversion Streams to Promote, Demote and Retire Copy Rules},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

本书其他章节结论