What does Bunching at Turnover Thresholds conclude, in numbers, about “Is the Spike Noise? Bootstrap Intervals, the Excluded Window and Power”?

Answer: The point estimate is still a b of 3.123 bins and an elasticity of 0.1378. The standard deviation of the two hundred bootstrap re-estimates is 0.205 and the t statistic is 15.21, so the spike is far from noise. The 95 % interval for b runs from 2.534 to 3.279, and for the elasticity from 0.1121 to 0.1446.

Scope of the numbers: Parameters are illustrative and the threshold is always written T; all calculations are generated by the book's programs. The book does statistical analysis and compliance checking only, teaches no way of staying under a threshold, and is general analysis, not individualised tax, legal or financial advice.

中文版

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.1121, 0.1378, 0.1446, 0.205, 15.21, 2.534

point estimate b3.123 bins, e_hat = 0.1378
bootstrap reps 200 mean b 2.943 se(b) 0.205
t statistic b / se(b)15.21
95% interval for b2.534 to 3.279
95% interval for e_hat0.1121 to 0.1446
structural e0.25 lies outside the interval
Show the full program
# Chapter 4. p41: a residual bootstrap for b and e_hat.
# Following Chetty et al. (2011): fit the counterfactual once,
# keep the residuals of the bins outside the window, build REPS new
# histograms by adding residuals drawn with replacement to the
# fitted values (observed counts inside the window), re-estimate,
# and read the standard error and the 2.5 and 97.5 percentiles.
# Data of p11, degree 7, window [T - 4, T + 4). Fixed seeds.
import math
import random

SEED, N = 20261113, 40000
T, T0, T1, E, RESP, NOISE = 100.0, 0.0, 0.2, 0.25, 0.7, 1.0
LO, HI = 60, 140


def draw(rng, n=N, resp=RESP):
    r = (1 - T1) / (1 - T0)
    zs, nb = [], 0
    for _ in range(n):
        a = rng.lognormvariate(math.log(80.0), 0.5)
        if rng.random() >= resp or a <= T:
            zs.append(a)
        elif a * r ** E >= T:
            zs.append(a * r ** E)
        else:
            zs.append(T + rng.gauss(0.0, NOISE))
            nb = nb + 1
    return zs, nb


def counts(zs, w):
    c = [0] * int(round((HI - LO) / w))
    for z in zs:
        k = int(math.floor((z - LO) / w))
        if 0 <= k < len(c):
            c[k] = c[k] + 1
    return c


def solve(a, b):
    n = len(b)
    m = [list(a[i]) + [b[i]] for i in range(n)]
    for c in range(n):
        p = max(range(c, n), key=lambda r: abs(m[r][c]))
        m[c], m[p] = m[p], m[c]
        for r in range(c + 1, n):
            f = m[r][c] / m[c][c]
            m[r] = [m[r][k] - f * m[c][k] for k in range(n + 1)]
    x = [0.0] * n
    for r in range(n - 1, -1, -1):
        s = math.fsum(m[r][k] * x[k] for k in range(r + 1, n))
        x[r] = (m[r][n] - s) / m[r][r]
    return x


def bunching(c, w, zs, xl, xu, order, constrain=True, skip=None):
    """Excess mass B, normalised b (bins) and fitted counterfactual."""
    k_all = range(len(c))
    mids = [LO + (k + 0.5) * w for k in k_all]
    xs = [(m - zs) / (HI - LO) * 2 for m in mids]
    win = [zs - xl <= m < zs + xu for m in mids]
    above = [m >= zs + xu for m in mids]
    out = [k for k in k_all if not win[k] and not (skip and skip[k])]
    q = order + 1
    pw = [[xs[k] ** i for i in range(2 * q)] for k in k_all]
    a = [[math.fsum(pw[k][i + j] for k in out) for j in range(q)]
         for i in range(q)]
    s_above = math.fsum(c[k] for k in k_all if above[k])
    big_b, fit = 0.0, []
    for _ in range(200):
        g = 1 + big_b / s_above if constrain else 1.0
        y = [c[k] * g if above[k] else c[k] for k in k_all]
        rhs = [math.fsum(y[k] * pw[k][i] for k in out) for i in range(q)]
        beta = solve(a, rhs)
        fit = [math.fsum(beta[i] * pw[k][i] for i in range(q))
               for k in k_all]
        new_b = math.fsum(c[k] - fit[k] for k in k_all if win[k])
        done = abs(new_b - big_b) < 1e-7
        big_b = new_b
        if done:
            break
    h = math.fsum(fit[k] for k in k_all if win[k]) / ((xl + xu) / w)
    return big_b, big_b / h, fit


def elasticity(dz, zs, t0, t1):
    return math.log(1 + dz / zs) / math.log((1 - t0) / (1 - t1))


REPS = 200


def pct(xs, p):
    s = sorted(xs)
    i = p * (len(s) - 1)
    j = int(math.floor(i))
    k = min(j + 1, len(s) - 1)
    return s[j] + (s[k] - s[j]) * (i - j)


if __name__ == "__main__":
    zs, nb = draw(random.Random(20261113))
    c = counts(zs, 1.0)
    big_b, b, fit = bunching(c, 1.0, T, 4, 4, 7)
    mids = [LO + k + 0.5 for k in range(len(c))]
    win = [T - 4 <= m < T + 4 for m in mids]
    res = [c[k] - fit[k] for k in range(len(c)) if not win[k]]
    base = [c[k] if win[k] else fit[k] for k in range(len(c))]
    rng = random.Random(20261113 + 1)
    bs, es = [], []
    for _ in range(REPS):
        cb = [base[k] + (0.0 if win[k] else rng.choice(res))
              for k in range(len(c))]
        _, b_r, _ = bunching(cb, 1.0, T, 4, 4, 7)
        bs.append(b_r)
        es.append(elasticity(b_r, T, T0, T1))
    mb = math.fsum(bs) / REPS
    se = math.sqrt(math.fsum((x - mb) ** 2 for x in bs) / (REPS - 1))
    print("point estimate b = {:.3f} bins, e_hat = {:.4f}".format(
        b, elasticity(b, T, T0, T1)))
    print("bootstrap reps {}  mean b {:.3f}  se(b) {:.3f}".format(
        REPS, mb, se))
    print("t statistic b / se(b)         {:8.2f}".format(b / se))
    print("95% interval for b            {:.3f} to {:.3f}".format(
        pct(bs, 0.025), pct(bs, 0.975)))
    print("95% interval for e_hat        {:.4f} to {:.4f}".format(
        pct(es, 0.025), pct(es, 0.975)))
    print("structural e = {} lies {} the interval".format(
        E, "inside" if pct(es, 0.025) <= E <= pct(es, 0.975)
        else "outside"))

Single source and citation

Fan, Y. (2026). Bunching at Tax Thresholds and the Distribution of Turnover: Behavioural Elasticities Revealed by Piling-Up below the Line (Version 1.0.0), Chapter 4: Is the Spike Noise? Bootstrap Intervals, the Excluded Window and Power. 5D Library. DOI pending

DOI pending · monograph page goes live after publication · 5DL-B-319 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026319,
  author    = {Fan, Yafu},
  title     = {Bunching at Tax Thresholds and the Distribution of Turnover: Behavioural Elasticities Revealed by Piling-Up below the Line},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

Other chapter answers in this book