关于「实证闭环:周度配额会议表、业务线配额指数器与预注册检验」,《业务线周度配额》给出的定量结论是什么?
结论:第八章给出周度配额会议表、小工具「业务线配额指数器」与预注册方案(每组 250 个单元,按磨合期调整后 162 个)。书中以标注框区分已发表的证据、可运行的 Python 计算(19 段程序)、原典与作者的假说。
数据口径:核对吉廷斯 1979 年的论文与后续文献以后,本书修正了立项蓝图:吉廷斯指数的最优性只在单线经营、闲置线不变、换线无成本、几何贴现时成立,周度拆分预算、换线成本与会变的市场都在定理之外;锁死是一个概率说法,两条示意线上按累计回报全押有 0.2133 的重复在下半年完全押错,但在每单位贴现 0.9 的短视界里贪心相对指数只损失 0.0050 到 0.0166。 书中参数为示意,毛利与成本用记账点数而非价格;全部计算由书中程序生成。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 162, 250
| paired pilot, 600 cells: d = 9.687, its s.e. 0.781 | ||||||
| run-in slope t = 5.522 (26-week wins per run-in win) | ||||||
| outcome | lastweek | quota | d | s | n/arm | power |
| raw y | 89.697 | 99.383 | 9.687 | 38.618 | 250 | 0.810 |
| y - t x | 32.079 | 41.766 | 9.687 | 31.034 | 162 | 0.790 |
查看完整验算程序
# Chapter 8. p82: how many cells a pre-registered quota trial needs.
# Design: independent cells (cities, shops or product groups), each with
# 3 lines whose unit rates are drawn from Beta(2, 6) (illustrative);
# 10 units a week for 26 weeks; cells randomised to the last-week rule
# or to the index-quota rule of p81 (equal margins, zero unit cost).
# A 4-week run-in splits units 4/3/3 in every cell; its wins x are a
# baseline. Outcome y = wins in the 26 trial weeks. Pilot: 600 cells,
# each simulated under both rules with the same rates and random stream
# (paired, so d is sharp); s = spread of y across cells, also for the
# adjusted outcome y - t x (t = pooled regression slope, as in ANCOVA);
# n per arm = 2 (z_0.975 + z_0.80)^2 s^2 / d^2,
# and the power of that n is checked by resampling the pilot cells.
import functools
import math
import random
import statistics
N, K, W = 3, 10, 26
@functools.lru_cache(maxsize=None)
def gittins(a, b, beta, depth=20, tol=1e-6):
lo, hi = a / (a + b), 1.0
while hi - lo > tol:
lam = 0.5 * (lo + hi)
r = lam / (1.0 - beta)
n = a + b + depth
v = [max(r, (a + k) / n / (1.0 - beta)) for k in range(depth + 1)]
for d in range(depth - 1, -1, -1):
n = a + b + d
nv = []
for k in range(d + 1):
p = (a + k) / n
c = math.fsum((p * (1.0 + beta * v[k + 1]),
(1.0 - p) * beta * v[k]))
nv.append(c if c > r else r)
v = nv
if v[0] > r + 1e-12:
lo = lam
else:
hi = lam
return 0.5 * (lo + hi)
def cell(rule, p, rng):
s, f, last = [0] * N, [0] * N, [0.0] * N
total, base = 0, 0
for w in range(W + 4):
q = [4, 3, 3]
if w >= 4 and rule == "lastweek":
q = [0] * N
q[max(range(N), key=lambda j: (last[j], -j))] = K
elif w >= 4:
nu = [gittins(1 + s[i], 1 + f[i], 0.9) for i in range(N)]
mu = [(1 + s[i]) / (2 + s[i] + f[i]) for i in range(N)]
lead = max(range(N), key=lambda j: (nu[j], -j))
q = [1 if i != lead and nu[i] > mu[lead] else 0
for i in range(N)]
q[lead] = K - (q[0] + q[1] + q[2])
for i in range(N):
k = 0
for _ in range(q[i]):
if rng.random() < p[i]:
k += 1
s[i] += k
f[i] += q[i] - k
if q[i]:
last[i] = k / q[i]
if w < 4:
base += k
else:
total += k
return total, base
def plan(ys):
m = {r: statistics.fmean(v) for r, v in ys.items()}
sd = math.sqrt((statistics.variance(ys["lastweek"])
+ statistics.variance(ys["quota"])) / 2)
d = m["quota"] - m["lastweek"]
z = statistics.NormalDist()
n = math.ceil(2 * (z.inv_cdf(0.975) + z.inv_cdf(0.80)) ** 2
* sd ** 2 / d ** 2)
hits = 0
for _ in range(1000):
a = [rng.choice(ys["lastweek"]) for _ in range(n)]
b = [rng.choice(ys["quota"]) for _ in range(n)]
se = math.sqrt((statistics.variance(a)
+ statistics.variance(b)) / n)
if (statistics.fmean(b) - statistics.fmean(a)) / se > 1.959964:
hits += 1
return m, d, sd, n, hits / 1000
rng = random.Random(20261113)
pilot = {"lastweek": [], "quota": []}
for _ in range(600):
p = [rng.betavariate(2, 6) for _ in range(N)]
seed = rng.randrange(10 ** 9)
for r in pilot:
pilot[r].append(cell(r, p, random.Random(seed)))
diff = [q[0] - l[0] for q, l in zip(pilot["quota"], pilot["lastweek"])]
print("paired pilot, 600 cells: d = %.3f, its s.e. %.3f" % (
statistics.fmean(diff), statistics.stdev(diff) / math.sqrt(600)))
xs = [x for r in pilot for _, x in pilot[r]]
yv = [y for r in pilot for y, _ in pilot[r]]
t = statistics.covariance(xs, yv) / statistics.variance(xs)
print("run-in slope t = %.3f (26-week wins per run-in win)" % t)
print("%-9s %9s %9s %8s %8s %7s %7s" % ("outcome", "lastweek", "quota",
"d", "s", "n/arm", "power"))
for label, adj in (("raw y", 0.0), ("y - t x", t)):
ys = {r: [y - adj * x for y, x in pilot[r]] for r in pilot}
m, d, sd, n, pw = plan(ys)
print("%-9s %9.3f %9.3f %8.3f %8.3f %7d %7.3f" % (
label, m["lastweek"], m["quota"], d, sd, n, pw))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《多业务线算力与预算动态裁决、吉廷斯指数探索与收费站代购出版线周度配额母典》第 8 章「实证闭环:周度配额会议表、业务线配额指数器与预注册检验」(版本 1.0.0). 5D Library. DOI 待发布
DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-264 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026264,
author = {Fan, Yafu},
title = {Dynamic Allocation of Compute and Budget across Business Lines: Gittins-Index Exploration and Weekly Quotas for Tollbooth, Buying and Publishing Lines},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}