关于「尖峰是不是噪声:自助法区间、排除窗宽与检验力」,《门槛聚束与营业额弹性》给出的定量结论是什么?
结论:点估计仍是 b 为 3.123 格、弹性 0.1378。两百次自助法重估的标准差是 0.205,t 值为 15.21,尖峰远非噪声。b 的 95 % 区间从 2.534 到 3.279,弹性的区间从 0.1121 到 0.1446。
数据口径:书中参数为示意,门槛一律记作 T;全部计算由书中程序生成。 第一章在一份固定种子的示意分布上估出超额质量 942.0 家、观察弹性 0.1378,结构弹性为 0.25,差距来自摩擦与反事实近似。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.1121, 0.1378, 0.1446, 0.205, 15.21, 2.534
| point estimate b | 3.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 b | 2.534 to 3.279 |
| 95% interval for e_hat | 0.1121 to 0.1446 |
| structural e | 0.25 lies outside the interval |
查看完整验算程序
# 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"))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《起征点聚束估计与营业额分布、门槛下方堆积揭示的行为弹性母典》第 4 章「尖峰是不是噪声:自助法区间、排除窗宽与检验力」(版本 1.0.0). 5D Library. DOI 待发布
DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 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}
}