关于「名义五分与实际误报:偏态小样本上 t 检验的第一类错误率」,《门店小实验的重抽样推断》给出的定量结论是什么?
结论:第一章测得,指数总体十个观测的单样本 t 检验两侧实际误报率为 0.1013,对数正态五个观测为 0.1840;两组同形等量时则降到 0.0289 一类的保守水平。
数据口径:书中参数为示意;全部计算由书中程序生成;本书属于非个人化经营建议。 书中以标注框区分已发表的证据、可运行的 Python 计算(20 段程序)、原典与作者的假说。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.1013, 0.1840
| one-sample t, nominal two-sided 0.050 (0.025 per tail) | ||||
| population | n | low tail | high tail | two-sided |
| exp(1) | 5 | 0.1145 | 0.0040 | 0.1185 |
| exp(1) | 10 | 0.0974 | 0.0040 | 0.1013 |
| exp(1) | 20 | 0.0774 | 0.0060 | 0.0834 |
| exp(1) | 40 | 0.0604 | 0.0086 | 0.0689 |
| logn(0,1) | 5 | 0.1825 | 0.0015 | 0.1840 |
| logn(0,1) | 10 | 0.1612 | 0.0011 | 0.1623 |
| logn(0,1) | 20 | 0.1336 | 0.0017 | 0.1353 |
| logn(0,1) | 40 | 0.1092 | 0.0024 | 0.1116 |
查看完整验算程序
# Chapter 1. p12: actual type I error of the one-sample t test, skewed.
# Model: n draws from a skewed population whose true mean is known;
# test H0: mean = true mean with the two-sided t test at nominal 0.05
# (each tail nominal 0.025). Populations: exponential(1), mean 1, and
# lognormal(0, 1), mean exp(0.5). Critical values come from the
# hand-written t distribution of p11 (continued fraction, bisection).
# 20000 seeded replicates per cell; Monte Carlo standard error of a
# rate near 0.05 is about 0.0015. Sample sizes are illustrative.
import math
import random
def betacf(a, b, x):
tiny = 1e-300
qab, qap, qam = a + b, a + 1.0, a - 1.0
c = 1.0
d = 1.0 - qab * x / qap
d = 1.0 / (d if abs(d) > tiny else tiny)
h = d
for m in range(1, 300):
m2 = 2 * m
aa = m * (b - m) * x / ((qam + m2) * (a + m2))
d = 1.0 + aa * d
d = 1.0 / (d if abs(d) > tiny else tiny)
c = 1.0 + aa / c
c = c if abs(c) > tiny else tiny
h *= d * c
aa = -(a + m) * (qab + m) * x / ((a + m2) * (qap + m2))
d = 1.0 + aa * d
d = 1.0 / (d if abs(d) > tiny else tiny)
c = 1.0 + aa / c
c = c if abs(c) > tiny else tiny
de = d * c
h *= de
if abs(de - 1.0) < 1e-15:
break
return h
def betai(a, b, x):
if x <= 0.0:
return 0.0
if x >= 1.0:
return 1.0
lb = (math.lgamma(a + b) - math.lgamma(a) - math.lgamma(b)
+ a * math.log(x) + b * math.log(1.0 - x))
bt = math.exp(lb)
if x < (a + 1.0) / (a + b + 2.0):
return bt * betacf(a, b, x) / a
return 1.0 - bt * betacf(b, a, 1.0 - x) / b
def t_two_tail(t, v):
return betai(v / 2.0, 0.5, v / (v + t * t))
def t_cdf(t, v):
half = 0.5 * t_two_tail(t, v)
return 1.0 - half if t > 0 else half
def t_crit(alpha, v):
lo, hi = 0.0, 1000.0
for _ in range(200):
mid = 0.5 * (lo + hi)
if t_two_tail(mid, v) > alpha:
lo = mid
else:
hi = mid
return 0.5 * (lo + hi)
def t_stat(x, mu):
n = len(x)
m = math.fsum(x) / n
s2 = math.fsum((v - m) ** 2 for v in x) / (n - 1)
return (m - mu) / math.sqrt(s2 / n)
def run(draw, mu, n, reps, rng, crit):
lo = hi = 0
for _ in range(reps):
t = t_stat([draw(rng) for _ in range(n)], mu)
lo += t < -crit
hi += t > crit
return lo / reps, hi / reps
if __name__ == "__main__":
rng = random.Random(20261113)
reps = 20000
pops = (("exp(1)", lambda r: r.expovariate(1.0), 1.0),
("logn(0,1)", lambda r: r.lognormvariate(0.0, 1.0),
math.exp(0.5)))
print("one-sample t, nominal two-sided 0.050 (0.025 per tail)")
print(" population n low tail high tail two-sided")
for name, draw, mu in pops:
for n in (5, 10, 20, 40):
crit = t_crit(0.05, n - 1)
lo, hi = run(draw, mu, n, reps, rng, crit)
print(" {:10s} {:3d} {:.4f} {:.4f} {:.4f}".format(
name, n, lo, hi, lo + hi))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《自助法与置换检验、小样本门店实验不靠正态假设的重抽样推断母典》第 1 章「名义五分与实际误报:偏态小样本上 t 检验的第一类错误率」(版本 1.0.0). 5D Library. DOI 待发布
DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-308 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026308,
author = {Fan, Yafu},
title = {The Bootstrap and Permutation Tests: Resampling Inference for Small Shop Experiments without Normality Assumptions},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}