关于「实证闭环:收缩排名的年度评估、去因果夸大的文案与预注册方案」,《均值回归与封面诅咒》给出的定量结论是什么?

结论:第八章给出收缩排名的年度评估(示例中排名第一的门店进入前三的概率只有 0.634)、文案审计、预注册方案与蒸馏小工具「收缩排名计算器」。书中以标注框区分已发表的证据、可运行的 Python 计算(22 段程序)、原典与作者的假说。

数据口径:书中门店、达人、顾客与报告的参数均为示意;全部计算由书中程序生成;本书是非个人化的经营分析,不构成经营、法律或理财建议,涉及运程报告与原典之处只分析结构与概率,不作任何个人占断。 书中以标注框区分已发表的证据、可运行的 Python 计算(22 段程序)、原典与作者的假说。

English version

对照数据表

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

pooled rate 0.4461, between-store sd tau 0.0683
storenrawBshrunk80% intervalrank raw>newP(top3)
S11450.5780.4590.5070.442 to 0.5711 >10.634
S071200.5170.6940.4950.447 to 0.5433 >20.555
S103000.5000.8500.4920.458 to 0.5265 >30.525
S01400.5500.4300.4910.425 to 0.5572 >40.507
S02600.5000.5310.4750.415 to 0.5354 >50.361
S042500.4800.8250.4740.437 to 0.5116 >60.285
S127000.4600.9300.4590.436 to 0.4827 >70.071
S039000.4500.9440.4500.429 to 0.4708 >80.023
S065000.4300.9040.4320.404 to 0.4599 >90.007
S0815000.4200.9660.4210.405 to 0.43710 > 100.000
S09800.3750.6010.4030.348 to 0.45911 > 110.021
S05350.2570.3980.3710.303 to 0.43912 > 120.011
查看完整验算程序
# Chapter 8. p81: An annual review by shrinkage ranking, end to end.
# Twelve stores, each with n customers this year and k of them buying
# again (illustrative counts). Raw rate k / n. Empirical Bayes:
#   pooled rate m = sum k / sum n,  se_i^2 = m (1 - m) / n_i,
#   tau^2 = max(var(raw) - mean(se^2), small floor),
#   B_i = tau^2 / (tau^2 + se_i^2),  shrunk_i = m + B_i (raw_i - m),
#   80 % interval: shrunk_i +- 1.2816 sqrt(B_i se_i^2).
# P(top 3) by 20,000 draws from the posteriors (fixed seed). The same
# functions are in distill/tool.py.
# 年度评估:十二家门店的复购率,按收缩估计排名并给出前三名概率。
import math
import random

STORES = [("S01", 40, 22), ("S02", 60, 30), ("S03", 900, 405),
          ("S04", 250, 120), ("S05", 35, 9), ("S06", 500, 215),
          ("S07", 120, 62), ("S08", 1500, 630), ("S09", 80, 30),
          ("S10", 300, 150), ("S11", 45, 26), ("S12", 700, 322)]


def shrink(rows):
    m = math.fsum(k for _, _, k in rows) / math.fsum(n for _, n, _ in rows)
    raw = [k / n for _, n, k in rows]
    se2 = [m * (1 - m) / n for _, n, _ in rows]
    mr = math.fsum(raw) / len(raw)
    var = math.fsum((v - mr) ** 2 for v in raw) / (len(raw) - 1)
    tau2 = max(var - math.fsum(se2) / len(se2), 1e-6)
    out = []
    for (name, n, k), r, s2 in zip(rows, raw, se2):
        b = tau2 / (tau2 + s2)
        out.append((name, n, r, b, m + b * (r - m), math.sqrt(b * s2)))
    return m, math.sqrt(tau2), out


def top_prob(out, top=3, draws=20000, seed=None):
    rng = random.Random(20261112 if seed is None else seed)
    hits = [0] * len(out)
    for _ in range(draws):
        x = [rng.gauss(o[4], o[5]) for o in out]
        for i in sorted(range(len(x)), key=lambda j: -x[j])[:top]:
            hits[i] += 1
    return [h / draws for h in hits]


if __name__ == "__main__":
    m, tau, out = shrink(STORES)
    raw_rank = sorted(range(len(out)), key=lambda i: (-out[i][2], i))
    new_rank = sorted(range(len(out)), key=lambda i: (-out[i][4], i))
    pt = top_prob(out)
    print("pooled rate {:.4f}, between-store sd tau {:.4f}".format(m, tau))
    print("store     n    raw    B      shrunk  80% interval    rank"
          " raw>new  P(top3)")
    for i in new_rank:
        name, n, r, b, z, sd = out[i]
        print("{:<4} {:>5}  {:.3f}  {:.3f}  {:.3f}   {:.3f} to {:.3f}"
              "    {:>2} > {:>2}   {:.3f}".format(
                  name, n, r, b, z, z - 1.2816 * sd, z + 1.2816 * sd,
                  raw_rank.index(i) + 1, new_rank.index(i) + 1, pt[i]))

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《均值回归与封面诅咒、运程报告后验校准与塞翁失马序列独立性母典》第 8 章「实证闭环:收缩排名的年度评估、去因果夸大的文案与预注册方案」(版本 1.0.0). 5D Library. DOI 待发布

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

BibTeX
@book{fan2026202,
  author    = {Fan, Yafu},
  title     = {Regression to the Mean and the Cover Jinx: Posterior Calibration of Fortune Reports and Serial Independence in the Tale of the Lost Horse},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

本书其他章节结论