关于「实践与预注册试验」,《布雷斯悖论与无秩序代价》给出的定量结论是什么?
结论:所以样本量按保守得多的假设计算:对照组陷入 60%,A 组 30%,双侧 \(\alpha = 0.05\),把握度 90%:每组需要 56 个可分析的小组;考虑约 10% 的小组因有人中途退出而不完整,每组招募 63 个小组,即每组 378 人,共 756 人;模拟检验的把握度为 0.89。若真实差距只有 25 个百分点(60% 对 35%),每组需要 82 个小组。这些参数都是假设值,正式实施前应当用预试验的数据核对。
数据口径:书中关于流量池与推荐算法的模型都是示意,不描述任何真实平台;本书不是投资、经营或营销建议。 书中以标注框区分已发表的证据、可运行的 Python 计算(16 段程序,全部核对)、原典与作者的假说。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.89, 10, 378, 56, 63, 756
| bots, route times only | : trapped 77%; bridge share in rounds 31-40 87% |
| bots, plus externality points | : trapped 0%; bridge share in rounds 31-40 21% |
| bots, points, half the bots ignore them: trapped 4%; bridge share in rounds 31-40 50% | |
| assumed share trapped: control -> treatment | analysable GROUPS per arm (90 % power) |
| 0.60 -> 0.30 | 56 |
| 0.60 -> 0.35 | 82 |
| 0.70 -> 0.40 | 56 |
| 0.50 -> 0.25 | 77 |
| chosen 0.60 -> 0.30: 56 groups per arm; allowing 10 % incomplete groups, recruit | |
| 63 groups per arm = 378 participants per arm, 756 in all | |
| simulation check of power with 56 groups per arm: 0.89 |
查看完整验算程序
# Chapter 8 trial. Part 1: the 6-player Braess game of Chapter 3 (links s->v and w->t
# cost 10 per user, v->t and s->w cost 70, bridge v->w 0) played for 40 rounds by simple
# learning BOTS: a MODEL of the hypothesis, not data about people. Control bots see
# every route's time and minimise time; treatment bots also pay congestion points equal
# to the delay they add to others, (n_e - 1) x 10 on each congested link. Primary
# outcome per group: TRAPPED = in at least 8 of rounds 31-40, five or six players took
# the bridge route. Part 2: sample size.
import math, random
from statistics import NormalDist
rng = random.Random(15)
ROUTES = {"U": ("sv", "vt"), "L": ("sw", "wt"), "Z": ("sv", "vw", "wt")}
COST = {"sv": lambda n: 10 * n, "vt": lambda n: 70, "sw": lambda n: 70,
"wt": lambda n: 10 * n, "vw": lambda n: 0}
def route_cost(others, r, points):
"""Cost of route r for a player when the other five chose 'others'."""
n = {e: sum(e in ROUTES[o] for o in others) + (e in ROUTES[r]) for e in COST}
t = sum(COST[e](n[e]) for e in ROUTES[r])
if points: t += sum((n[e] - 1) * 10 for e in ROUTES[r] if e in ("sv", "wt"))
return t
def group(points, heed=1.0, rounds=40, beta=0.2, phi=0.7):
att = [{r: -100.0 + rng.gauss(0, 10) for r in ROUTES} for _ in range(6)]
uses = [points and rng.random() < heed for _ in range(6)] # bots counting points
trap, late = 0, 0
for t in range(rounds):
ch = []
for a in att:
w = {r: math.exp(beta * (a[r] - max(a.values()))) for r in ROUTES}
u, acc = rng.random() * sum(w.values()), 0.0
for r in ROUTES:
acc += w[r]
if u <= acc: ch.append(r); break
for i, a in enumerate(att): # learn from all routes' costs this round
others = ch[:i] + ch[i + 1:]
for r in ROUTES:
a[r] = phi * a[r] - (1 - phi) * route_cost(others, r, uses[i])
if t >= rounds - 10:
trap += ch.count("Z") >= 5; late += ch.count("Z")
return trap >= 8, late / 60
for pts, heed, lab in ((False, 1, "route times only"),
(True, 1, "plus externality points"),
(True, 0.5, "points, half the bots ignore them")):
res = [group(pts, heed) for _ in range(1000)]
print(f"bots, {lab:33s}: trapped {sum(r[0] for r in res) / 1000:.0%};"
f" bridge share in rounds 31-40 {sum(r[1] for r in res) / 1000:.0%}")
def n_per_arm(p1, p2, alpha=0.05, power=0.90):
z = NormalDist().inv_cdf; pb = (p1 + p2) / 2
num = (z(1 - alpha / 2) * math.sqrt(2 * pb * (1 - pb))
+ z(power) * math.sqrt(p1 * (1 - p1) + p2 * (1 - p2)))
return math.ceil(num ** 2 / (p1 - p2) ** 2)
print("assumed share trapped: control -> treatment"
" analysable GROUPS per arm (90 % power)")
for p1, p2 in ((0.60, 0.30), (0.60, 0.35), (0.70, 0.40), (0.50, 0.25)):
print(f" {p1:.2f} -> {p2:.2f} {n_per_arm(p1, p2)}")
n = n_per_arm(0.60, 0.30); rec = math.ceil(n / 0.9)
print(f"chosen 0.60 -> 0.30: {n} groups per arm; allowing 10 % incomplete groups,"
" recruit")
print(f" {rec} groups per arm = {6 * rec} participants per arm, {12 * rec} in all")
hits = 0
for _ in range(4000):
a = sum(rng.random() < 0.60 for _ in range(n))
b = sum(rng.random() < 0.30 for _ in range(n))
pa, pb = a / n, b / n; pp = (a + b) / (2 * n)
hits += abs(pa - pb) / math.sqrt(pp * (1 - pp) * 2 / n) > 1.96
print(f"simulation check of power with {n} groups per arm: {hits / 4000:.2f}")唯一数据源与引用
范雅福(Fan, Y.). (2026). 《算法博弈论、布雷斯悖论与流量分配的无秩序代价》第 8 章「实践与预注册试验」(版本 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.23782094
DOI: 10.5281/zenodo.23782094 · 阅读本章所在专著 · 5DL-B-032 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026032,
author = {Fan, Yafu},
title = {Algorithmic Game Theory, Braess's Paradox and the Price of Anarchy in Traffic and Attention Networks},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
doi = {10.5281/zenodo.23782094},
url = {https://doi.org/10.5281/zenodo.23782094}
}