关于「稳健性三件事:高阶多项式、安慰剂断点与模糊断点」,《会员门槛的断点回归》给出的定量结论是什么?
结论:如果权益真的在 60 这条线上起作用,那么在其他没有任何规则变化的位置,例如 48 或 72,明年消费不应当出现跳跃。程序 p62 在线下方的 36、42、48、54 与线上方的 66、72、78 设置假的断点,各自只用同一侧的客人(线下的假断点只用非 VIP,线上的只用 VIP),以免真实的跳跃渗进来;带宽取 6。然后在另外 20 份新样本上重复这七个检验,统计误报的频率。
数据口径:落笔前本书核对原文并作蓝图修正:1960 年的论文研究的是奖学金荣誉证书而非会员体系,2008 年的指南是方法论文,二者都没有给出任何会员权益的效应量,书中的高估倍数全部来自固定种子的示意数据;命题也必须带边界陈述:只识别门槛处的局部效应,客人能精确凑单时设计失效,估计对带宽敏感,不宜用全局高阶多项式。 书中参数为示意;全部计算由书中程序生成。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 20, 36, 42, 48, 54, 60
| line | sample | estimate | se | z |
|---|---|---|---|---|
| 36 | non-VIP | 0.090 | 0.305 | 0.29 |
| 42 | non-VIP | -0.106 | 0.265 | -0.40 |
| 48 | non-VIP | 0.924 | 0.247 | 3.74 |
| 54 | non-VIP | 0.145 | 0.249 | 0.58 |
| 60 | all | 2.830 | 0.281 | 10.06 |
| 66 | VIP | -0.119 | 0.369 | -0.32 |
| 72 | VIP | 0.274 | 0.472 | 0.58 |
| 78 | VIP | -0.775 | 0.698 | -1.11 |
| placebo lines with |z| > 1.96: 1 of 7 | ||||
| 20 more samples: 4 of 140 placebo tests with |z| > 1.96 | ||||
| largest placebo |z| in those samples: 2.77 |
查看完整验算程序
# Chapter 6. p62: placebo lines where nothing happens.
# Data as in p11 (seed 20261113, 20000 customers, real line c = 60).
# At fake lines we run the same local linear RD (triangular kernel,
# h = 6), using only customers on one side of the real line so that the
# real jump cannot leak in: fake lines below 60 use non-VIPs only, fake
# lines above 60 use VIPs only. A sound design shows |z| < 1.96 at most
# placebo lines and a clear jump only at the real one. A second part
# repeats the seven placebo tests on 20 fresh samples (seeds 20261200
# to 20261219) to show the false alarm rate. Illustrative.
import math
import random
C, H = 60.0, 6.0
def draw(rng, n, sel=1.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 * sel * u + g + (2.0 + 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 jump(pts, c, h):
al, vl = wls([p for p in pts if p[0] < c], c, h)
ar, vr = wls([p for p in pts if p[0] >= c], c, h)
return ar - al, math.sqrt(vl + vr)
if __name__ == "__main__":
rows = draw(random.Random(20261113), 20000)
below = [(r[0], r[1]) for r in rows if r[0] < C]
above = [(r[0], r[1]) for r in rows if r[0] >= C]
allp = below + above
print("line sample estimate se z")
hits = 0
for c in (36.0, 42.0, 48.0, 54.0, 60.0, 66.0, 72.0, 78.0):
pts = allp if c == C else (below if c < C else above)
name = "all" if c == C else ("non-VIP" if c < C else "VIP")
est, se = jump(pts, c, H)
if c != C and abs(est / se) > 1.96:
hits = hits + 1
print("{:4.0f} {:8s} {:9.3f} {:7.3f} {:6.2f}".format(
c, name, est, se, est / se))
print("placebo lines with |z| > 1.96: {} of 7".format(hits))
alarms, zmax = 0, 0.0
for k in range(20):
rows = draw(random.Random(20261200 + k), 20000)
below = [(r[0], r[1]) for r in rows if r[0] < C]
above = [(r[0], r[1]) for r in rows if r[0] >= C]
for c in (36.0, 42.0, 48.0, 54.0, 66.0, 72.0, 78.0):
est, se = jump(below if c < C else above, c, H)
z = abs(est / se)
zmax = max(zmax, z)
if z > 1.96:
alarms = alarms + 1
print("20 more samples: {} of 140 placebo tests with |z| > 1.96".format(
alarms))
print("largest placebo |z| in those samples: {:.2f}".format(zmax))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《断点回归设计与会员等级门槛、消费满额升级线两侧的局部因果识别母典》第 6 章「稳健性三件事:高阶多项式、安慰剂断点与模糊断点」(版本 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}
}