What does Regression Discontinuity at Membership Tiers conclude, in numbers, about “Choosing the Bandwidth: Trading Bias for Variance, a Monte Carlo Optimum and Boundary Cross-Validation”?
Answer: At a bandwidth of 2 only 1801 customers are used; the estimate is 2.723 with standard error 0.479, and the interval from 1.784 to 3.662 is wide. From 4 to 16 the estimate moves between 2.676 and 2.954, every interval covers the truth, and the standard error falls from 0.345 to 0.180. At 24 the estimate drops to 2.217 and the upper end of the interval, 2.519, no longer reaches the truth; at 40 nearly all 19581 customers are used, the estimate is just 0.873 and the interval from 0.604 to 1.142 is far from the truth.
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: 0.180, 0.345, 0.479, 0.604, 0.873, 1.142
| h | estimate | se | n | 95% interval | |
| 2 | 2.723 | 0.479 | 1801 | [ 1.784, | 3.662] |
| 4 | 2.954 | 0.345 | 3533 | [ 2.279, | 3.630] |
| 6 | 2.830 | 0.281 | 5260 | [ 2.279, | 3.382] |
| 8 | 2.764 | 0.245 | 6888 | [ 2.284, | 3.244] |
| 12 | 2.805 | 0.203 | 9885 | [ 2.407, | 3.203] |
| 16 | 2.676 | 0.180 | 12549 | [ 2.324, | 3.028] |
| 24 | 2.217 | 0.154 | 16505 | [ 1.914, | 2.519] |
| 40 | 0.873 | 0.137 | 19581 | [ 0.604, | 1.142] |
| true local effect 2.5769 |
Show the full program
# Chapter 3. p31: one data set, many bandwidths.
# Data as in p11 (seed 20261113, 20000 customers, line c = 60, true
# local effect 2.5769). Local linear RD with a triangular kernel for
# bandwidths from 2 to 40 units; for each we print the estimate, the
# sandwich standard error, the customers used and the 95% interval.
# Narrow windows are noisy; wide windows lean on the curvature of
# E[y | x] (the cubic term) far from the line and drift.
import math
import random
C = 60.0
LOCAL = 2.0 + 12.0 / 208.0 * (C - 50.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, va, len(xs)
if __name__ == "__main__":
rows = draw(random.Random(20261113), 20000)
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]
print(" h estimate se n 95% interval")
for h in (2.0, 4.0, 6.0, 8.0, 12.0, 16.0, 24.0, 40.0):
al, vl, nl = wls_line(left, C, h)
ar, vr, nr = wls_line(right, C, h)
tau, se = ar - al, math.sqrt(vl + vr)
print("{:4.0f} {:8.3f} {:6.3f} {:6d} [{:6.3f}, {:6.3f}]".format(
h, tau, se, nl + nr, tau - 1.96 * se, tau + 1.96 * se))
print("true local effect {:.4f}".format(LOCAL))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 3: Choosing the Bandwidth: Trading Bias for Variance, a Monte Carlo Optimum and Boundary Cross-Validation. 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
- Chapter 1 · Either Side of the VIP Line: Selection Bias, the Naive Gap and a Local Comparison at the Threshold
- Chapter 2 · Local Linear Regression: Triangular-Kernel Weighted Least Squares, Boundary Bias and an Effect That Holds Only at the Threshold
- Chapter 4 · The McCrary Density Test: Local Lines on Either Side of a Histogram, Power and Blind Spots
- Chapter 5 · Topping Up to Upgrade: How Precisely Manipulable Spending Breaks the Design
- Chapter 6 · Three Robustness Checks: High-Order Polynomials, Placebo Thresholds and the Fuzzy Design
- Chapter 7 · Sources East and West: Rank for Count in the Book of Lord Shang and the Scholarship Discontinuity of 1960
- Chapter 8 · Closing the Loop: Evaluating a Membership-Tier Threshold, the Distilled Tool and a Pre-Registered Plan