关于「VIP 线两侧:选择偏差、朴素差距与断点处的局部比较」,《会员门槛的断点回归》给出的定量结论是什么?

结论:第一章在示意会员数据上算出朴素差距 19.005,而线上真值为 2.5769,前者是后者的 7.37 倍;带宽为 8 的局部线性估计为 2.764。

数据口径:落笔前本书核对原文并作蓝图修正:1960 年的论文研究的是奖学金荣誉证书而非会员体系,2008 年的指南是方法论文,二者都没有给出任何会员权益的效应量,书中的高估倍数全部来自固定种子的示意数据;命题也必须带边界陈述:只识别门槛处的局部效应,客人能精确凑单时设计失效,估计对带宽敏感,不宜用全局高阶多项式。 书中参数为示意;全部计算由书中程序生成。

English version

对照数据表

下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 19.005, 2.5769, 2.764, 7.37

estimator estimate vs truth
(a) naive VIP gap19.005 7.37 x
(b) OLS on D and spend, all data-3.500 -1.36 x
(c) local linear RD, h8 2.764 1.07 x
true benefit at the line2.5769
RD standard error0.245
RD 95% interval [2.284, 3.244]
customers used by RD: left 4002, right 2886
查看完整验算程序
# Chapter 1. p12: naive gap, regression adjustment, local linear RD.
# Same illustrative data as p11 (seed 20261113, line c = 60). Three
# estimators of the VIP benefit: (a) raw VIP minus non-VIP mean;
# (b) pooled OLS of y on D and (x - c) over all customers, the usual
# "control for spend" fix; (c) sharp RD by local linear regression on
# each side, triangular kernel, bandwidth h = 8 units, hand-written
# weighted least squares with a sandwich (HC0) standard error.
import math
import random

N, C, H = 20000, 60.0, 8.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_line(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, b, va, len(xs)


def rd(rows, c, h):
    left = [(r[0], r[1]) for r in rows if r[0] < c]
    right = [(r[0], r[1]) for r in rows if r[0] >= c]
    al, _, vl, nl = wls_line(left, c, h)
    ar, _, vr, nr = wls_line(right, c, h)
    return ar - al, math.sqrt(vl + vr), nl, nr


def ols_adjusted(rows, c):
    # y = a + tau D + b (x - c): solve 3 x 3 normal equations
    z = [(1.0, 1.0 if r[0] >= c else 0.0, r[0] - c) for r in rows]
    y = [r[1] for r in rows]
    m = [[math.fsum(p[i] * p[j] for p in z) for j in range(3)]
         + [math.fsum(p[i] * v for p, v in zip(z, y))] for i in range(3)]
    for k in range(3):
        for r in range(k + 1, 3):
            f = m[r][k] / m[k][k]
            m[r] = [m[r][j] - f * m[k][j] for j in range(4)]
    beta = [0.0, 0.0, 0.0]
    for r in range(2, -1, -1):
        s = math.fsum(m[r][j] * beta[j] for j in range(r + 1, 3))
        beta[r] = (m[r][3] - s) / m[r][r]
    return beta[1]


def mean(v):
    return math.fsum(v) / len(v)


if __name__ == "__main__":
    rows = draw(random.Random(20261113), N)
    naive = mean([r[1] for r in rows if r[0] >= C]) - mean(
        [r[1] for r in rows if r[0] < C])
    adj = ols_adjusted(rows, C)
    tau, se, nl, nr = rd(rows, C, H)
    local = 2.0 + 12.0 / 208.0 * (C - 50.0)
    print("estimator                         estimate   vs truth")
    print("(a) naive VIP gap                 {:8.3f}  {:7.2f} x".format(
        naive, naive / local))
    print("(b) OLS on D and spend, all data  {:8.3f}  {:7.2f} x".format(
        adj, adj / local))
    print("(c) local linear RD, h = {:<4.0f}     {:8.3f}  {:7.2f} x".format(
        H, tau, tau / local))
    print("true benefit at the line          {:8.4f}".format(local))
    print("RD standard error                 {:8.3f}".format(se))
    print("RD 95% interval            [{:.3f}, {:.3f}]".format(
        tau - 1.96 * se, tau + 1.96 * se))
    print("customers used by RD: left {}, right {}".format(nl, nr))

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《断点回归设计与会员等级门槛、消费满额升级线两侧的局部因果识别母典》第 1 章「VIP 线两侧:选择偏差、朴素差距与断点处的局部比较」(版本 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}
}

本书其他章节结论