关于「实证闭环:收缩排名的年度评估、去因果夸大的文案与预注册方案」,《均值回归与封面诅咒》给出的定量结论是什么?
结论:第八章给出收缩排名的年度评估(示例中排名第一的门店进入前三的概率只有 0.634)、文案审计、预注册方案与蒸馏小工具「收缩排名计算器」。书中以标注框区分已发表的证据、可运行的 Python 计算(22 段程序)、原典与作者的假说。
数据口径:书中门店、达人、顾客与报告的参数均为示意;全部计算由书中程序生成;本书是非个人化的经营分析,不构成经营、法律或理财建议,涉及运程报告与原典之处只分析结构与概率,不作任何个人占断。 书中以标注框区分已发表的证据、可运行的 Python 计算(22 段程序)、原典与作者的假说。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.634
| pooled rate 0.4461, between-store sd tau 0.0683 | ||||||||
| store | n | raw | B | shrunk | 80% interval | rank raw>new | P(top3) | |
| S11 | 45 | 0.578 | 0.459 | 0.507 | 0.442 to 0.571 | 1 > | 1 | 0.634 |
| S07 | 120 | 0.517 | 0.694 | 0.495 | 0.447 to 0.543 | 3 > | 2 | 0.555 |
| S10 | 300 | 0.500 | 0.850 | 0.492 | 0.458 to 0.526 | 5 > | 3 | 0.525 |
| S01 | 40 | 0.550 | 0.430 | 0.491 | 0.425 to 0.557 | 2 > | 4 | 0.507 |
| S02 | 60 | 0.500 | 0.531 | 0.475 | 0.415 to 0.535 | 4 > | 5 | 0.361 |
| S04 | 250 | 0.480 | 0.825 | 0.474 | 0.437 to 0.511 | 6 > | 6 | 0.285 |
| S12 | 700 | 0.460 | 0.930 | 0.459 | 0.436 to 0.482 | 7 > | 7 | 0.071 |
| S03 | 900 | 0.450 | 0.944 | 0.450 | 0.429 to 0.470 | 8 > | 8 | 0.023 |
| S06 | 500 | 0.430 | 0.904 | 0.432 | 0.404 to 0.459 | 9 > | 9 | 0.007 |
| S08 | 1500 | 0.420 | 0.966 | 0.421 | 0.405 to 0.437 | 10 > 10 | 0.000 | |
| S09 | 80 | 0.375 | 0.601 | 0.403 | 0.348 to 0.459 | 11 > 11 | 0.021 | |
| S05 | 35 | 0.257 | 0.398 | 0.371 | 0.303 to 0.439 | 12 > 12 | 0.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}
}