What does Regression Discontinuity at Membership Tiers conclude, in numbers, about “Either Side of the VIP Line: Selection Bias, the Naive Gap and a Local Comparison at the Threshold”?

Answer: Chapter 1 finds a naive gap of 19.005 on illustrative membership data against a true effect at the line of 2.5769, an overstatement of 7.37 times, while the local linear estimate with a bandwidth of 8 is 2.764.

Scope of the numbers: Parameters are illustrative; all calculations are generated by the book's programs. This is general analysis, not individualised business advice, and the book neither recommends nor supplies misleading threshold copy designed to provoke top-ups.

中文版

Data table

The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 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
Show the full program
# 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))

Single source and citation

Fan, Y. (2026). Regression-Discontinuity Designs at Membership-Tier Thresholds: Local Causal Identification on Either Side of a Spend-Based Upgrade Line (Version 1.0.0), Chapter 1: Either Side of the VIP Line: Selection Bias, the Naive Gap and a Local Comparison at the Threshold. 5D Library. DOI pending

DOI pending · monograph page goes live after publication · 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}
}

Other chapter answers in this book