关于「实证闭环:会员等级门槛效果评估、蒸馏小工具与预注册方案」,《会员门槛的断点回归》给出的定量结论是什么?
结论:第八章给出会员等级门槛效果评估的完整流程、蒸馏小工具「门槛断点效应估计器」与预注册检验方案。书中含 23 段可运行的 Python 程序。
数据口径:落笔前本书核对原文并作蓝图修正:1960 年的论文研究的是奖学金荣誉证书而非会员体系,2008 年的指南是方法论文,二者都没有给出任何会员权益的效应量,书中的高估倍数全部来自固定种子的示意数据;命题也必须带边界陈述:只识别门槛处的局部效应,客人能精确凑单时设计失效,估计对带宽敏感,不宜用全局高阶多项式。 书中参数为示意;全部计算由书中程序生成。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库
| pilot se at n = 20000: 0.2451 | ||
| effect m | customers needed | within h of the line |
| 0.5 | 37722 | 12992 |
| 1.0 | 9431 | 3249 |
| 1.5 | 4192 | 1444 |
| 2.5 | 1509 | 520 |
| simulated power at n = 9431 for m = 1: 0.78 |
查看完整验算程序
# Chapter 8. p81: how many customers a threshold study needs.
# The local linear RD standard error shrinks like 1 / sqrt(n). From one
# pilot sample of 20000 customers (seed 20261113, line c = 60, h = 8)
# we take se0 and compute the sample needed to detect a local effect of
# size m with a two-sided 5% test and 80% power:
# n(m) = 20000 * ((1.959964 + 0.841621) * se0 / m)^2.
# A Monte Carlo check (100 samples, seed 20261181) sets the benefit
# so that the local effect equals m = 1 and measures the power at n(1).
# Illustrative design; a real pilot must use the shop's own data.
import math
import random
C, H, N0 = 60.0, 8.0, 20000
ZA, ZB = 1.959964, 0.841621
def draw(rng, n, base=2.0, c=C):
rows = []
for _ in range(n):
u = rng.gauss(0.0, 1.0)
x = 50.0 + 12.0 * u + 8.0 * rng.gauss(0.0, 1.0)
d = 1 if x >= c else 0
g = 0.15 * (x - c) + 0.0003 * (x - c) ** 3
y = 20.0 + 6.0 * u + g + (base + u) * d
rows.append((x, y + rng.gauss(0.0, 3.0), u))
return rows
def wls(pts, c, h):
xs, ys, ws = [], [], []
for x, y in pts:
t = abs(x - c) / h
if t < 1.0:
xs.append(x - c)
ys.append(y)
ws.append(1.0 - t)
s0 = math.fsum(ws)
s1 = math.fsum(w * x for w, x in zip(ws, xs))
s2 = math.fsum(w * x * x for w, x in zip(ws, xs))
t0 = math.fsum(w * y for w, y in zip(ws, ys))
t1 = math.fsum(w * x * y for w, x, y in zip(ws, xs, ys))
det = s0 * s2 - s1 * s1
a = (s2 * t0 - s1 * t1) / det
b = (s0 * t1 - s1 * t0) / det
va = math.fsum((w * (s2 - s1 * x) / det * (y - a - b * x)) ** 2
for w, x, y in zip(ws, xs, ys))
return a, va
def rd(rows, c, h):
al, vl = wls([(r[0], r[1]) for r in rows if r[0] < c], c, h)
ar, vr = wls([(r[0], r[1]) for r in rows if r[0] >= c], c, h)
return ar - al, math.sqrt(vl + vr)
if __name__ == "__main__":
_, se0 = rd(draw(random.Random(20261113), N0), C, H)
print("pilot se at n = {}: {:.4f}".format(N0, se0))
print("effect m customers needed within h of the line")
share = 6888 / N0
need = {}
for m in (0.5, 1.0, 1.5, 2.5):
n = int(math.ceil(N0 * ((ZA + ZB) * se0 / m) ** 2))
need[m] = n
print("{:8.1f} {:16d} {:20d}".format(
m, n, int(math.ceil(n * share))))
rng = random.Random(20261181)
base = 1.0 - 12.0 / 208.0 * (C - 50.0)
hit = 0
for _ in range(100):
est, se = rd(draw(rng, need[1.0], base), C, H)
if abs(est / se) > ZA:
hit = hit + 1
print("simulated power at n = {} for m = 1: {:.2f}".format(
need[1.0], hit / 100))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《断点回归设计与会员等级门槛、消费满额升级线两侧的局部因果识别母典》第 8 章「实证闭环:会员等级门槛效果评估、蒸馏小工具与预注册方案」(版本 1.0.0). 5D Library. DOI 待发布
DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-303 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026303,
author = {Fan, Yafu},
title = {Regression-Discontinuity Designs at Membership-Tier Thresholds: Local Causal Identification on Either Side of a Spend-Based Upgrade Line},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}