What does Bunching at Turnover Thresholds conclude, in numbers, about “The Spike at a Kink: Excess Mass, Polynomial Counterfactuals and the Elasticity”?

Answer: Chapter 1 estimates an excess mass of 942.0 firms and an observed elasticity of 0.1378 on an illustrative distribution from a fixed seed, against a structural elasticity of 0.25, the gap coming from frictions and the approximate counterfactual.

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.1378, 942.0

order 7 window [T-4, T+4) bin width 1.0
excess mass B (firms)942.0
true bunchers1062
normalised b (bins)3.123
implied dz (units)3.123
observed elasticity e_hat0.1378
structural elasticity0.2500
structural dz*5.737
e_hat if responding share known0.1956
ratio e_hat / structural0.551
Show the full program
# Chapter 1. p12: polynomial counterfactual, excess mass b, elasticity.
# Method of Chetty et al. (2011): fit a degree-p polynomial to bin
# counts outside an excluded window around the kink, read excess
# mass B = sum of (count - fit) inside the window, impose the
# integration constraint by scaling counts above the window by
# (1 + B / S_above) and refitting until B is stable. Normalised
# b = B / (mean fitted count per bin in the window); dz = b * w;
# e = ln(1 + dz / T) / ln((1 - t0) / (1 - t1)). Hand-written least
# squares (normal equations, partial pivoting); data as in p11.
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, W, ORDER, XL, XU = 60, 140, 1.0, 7, 4, 4


def draw(rng):
    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((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 polyfit(xs, ys, order):
    q = order + 1
    a = [[math.fsum(x ** (i + j) for x in xs) for j in range(q)]
         for i in range(q)]
    b = [math.fsum(y * x ** i for x, y in zip(xs, ys)) for i in range(q)]
    return solve(a, b)


def peval(beta, x):
    return math.fsum(c * x ** i for i, c in enumerate(beta))


def bunching(c, w, zs, xl, xu, order, constrain=True):
    mids = [LO + (k + 0.5) * w for k in range(len(c))]
    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]
    s_above = math.fsum(c[k] for k in range(len(c)) if above[k])
    big_b = 0.0
    for _ in range(500):
        y = [c[k] * (1 + big_b / s_above) if (constrain and above[k])
             else c[k] for k in range(len(c))]
        out = [k for k in range(len(c)) if not win[k]]
        beta = polyfit([xs[k] for k in out], [y[k] for k in out], order)
        fit = [peval(beta, x) for x in xs]
        new_b = math.fsum(c[k] - fit[k] for k in range(len(c)) if win[k])
        if abs(new_b - big_b) < 1e-9:
            break
        big_b = new_b
    h = math.fsum(fit[k] for k in range(len(c)) 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))


if __name__ == "__main__":
    zs, nb = draw(random.Random(20261113))
    c = counts(zs, W)
    big_b, b, fit = bunching(c, W, T, XL, XU, ORDER)
    dz = b * W
    e_hat = elasticity(dz, T, T0, T1)
    dz_true = T * (((1 - T0) / (1 - T1)) ** E - 1)
    print("order {}  window [T-{}, T+{})  bin width {}".format(
        ORDER, XL, XU, W))
    print("excess mass B (firms)          {:9.1f}".format(big_b))
    print("true bunchers                  {:9d}".format(nb))
    print("normalised b (bins)            {:9.3f}".format(b))
    print("implied dz (units)             {:9.3f}".format(dz))
    print("observed elasticity e_hat      {:9.4f}".format(e_hat))
    print("structural elasticity          {:9.4f}".format(E))
    print("structural dz*                 {:9.3f}".format(dz_true))
    adj = elasticity(dz / RESP, T, T0, T1)
    print("e_hat if responding share known {:8.4f}".format(adj))
    print("ratio e_hat / structural       {:9.3f}".format(e_hat / E))

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 1: The Spike at a Kink: Excess Mass, Polynomial Counterfactuals and the Elasticity. 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