关于「正态区间的覆盖缺口:重尾订单把失误全部推向右尾」,《共形预测与订单区间》给出的定量结论是什么?
结论:帕累托分布的几行讲的是同一件事。尾指数为 2.1 时,方差勉强存在,双侧覆盖率 0.9429,右尾漏网率 0.0571,单侧漏网 0.0690。值得注意的是最后一列:在八千组历史中,真实覆盖率不到 0.90 的历史所占比例,对数正态一的一行为 0.1378,正态一行只有 0.0770。重尾数据的样本标准差极不稳定,碰上一段恰好没有大单的历史,标准差被低估,区间就窄得离谱;店主看不到这一点,因为她手里只有一段历史。
数据口径:书中参数为示意;全部计算由书中程序生成;本书属于非个人化经营建议。 本书作蓝图修正:正态区间的缺口是本书程序的模拟结果,集中在右尾与单侧上界;东方原典句出自《元史·郭守敬传》。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.0571, 0.0690, 0.0770, 0.1378, 0.90, 0.9429
| normal-theory 95% PI, n = 30, 8000 training sets | |||||
| shape | param | two-sided | upper miss | 1-sided miss | P(<0.90) |
| normal | 0.0 | 0.9494 | 0.0252 | 0.0502 | 0.0770 |
| lognorm | 0.5 | 0.9467 | 0.0529 | 0.0738 | 0.0929 |
| lognorm | 1.0 | 0.9415 | 0.0585 | 0.0731 | 0.1378 |
| lognorm | 1.5 | 0.9431 | 0.0569 | 0.0673 | 0.1449 |
| pareto | 3.0 | 0.9416 | 0.0584 | 0.0724 | 0.1374 |
| pareto | 2.5 | 0.9422 | 0.0578 | 0.0708 | 0.1375 |
| pareto | 2.1 | 0.9429 | 0.0571 | 0.0690 | 0.1368 |
| nominal: two-sided 0.95, upper miss 0.025, 1-sided miss 0.05 |
查看完整验算程序
# Chapter 1. p11: real coverage of the normal 95% interval on heavy tails.
# Model: a shop has n = 30 past values (daily orders or order values)
# and states "mean +/- t * sd * sqrt(1 + 1/n)" as a 95% prediction
# interval (t = 2.0452, the 0.975 point of Student t with 29 df, from
# standard tables); the one-sided 95% upper bound uses t = 1.6991.
# Coverage of the next value is exact from the true CDF, per training
# set; we average over 8,000 training sets.
# Distributions are illustrative shapes, not data from any shop.
import math
import random
import statistics
ND = statistics.NormalDist()
def make(kind, a):
if kind == "normal":
return (lambda r: r.gauss(0.0, 1.0)), (lambda x: ND.cdf(x))
if kind == "lognorm":
def cdf(x):
return 0.0 if x <= 0 else ND.cdf(math.log(x) / a)
return (lambda r: math.exp(r.gauss(0.0, a))), cdf
def cdf(x):
return 0.0 if x <= 1.0 else 1.0 - x ** (-a)
return (lambda r: (1.0 - r.random()) ** (-1.0 / a)), cdf
def normal_pi(xs):
m = statistics.fmean(xs)
s = statistics.stdev(xs)
f = s * math.sqrt(1.0 + 1.0 / len(xs))
return m - 2.0452 * f, m + 2.0452 * f, m + 1.6991 * f
def run(kind, a, n=30, reps=8000):
rng = random.Random(20261113)
draw, cdf = make(kind, a)
cov, up, one = [], [], []
for _ in range(reps):
lo, hi, ub = normal_pi([draw(rng) for _ in range(n)])
fl, fh = cdf(lo), cdf(hi)
cov.append(fh - fl)
up.append(1.0 - fh)
one.append(1.0 - cdf(ub))
bad = len([c for c in cov if c < 0.90])
return (math.fsum(cov) / reps, math.fsum(up) / reps,
math.fsum(one) / reps, bad / reps)
if __name__ == "__main__":
cases = [("normal", 0.0), ("lognorm", 0.5), ("lognorm", 1.0),
("lognorm", 1.5), ("pareto", 3.0), ("pareto", 2.5),
("pareto", 2.1)]
print("normal-theory 95% PI, n = 30, 8000 training sets")
print("shape param two-sided upper miss 1-sided miss P(<0.90)")
for kind, a in cases:
c, up, one, bad = run(kind, a)
print("{:<9s} {:4.1f} {:.4f} {:.4f} {:.4f} {:.4f}"
.format(kind, a, c, up, one, bad))
print("nominal: two-sided 0.95, upper miss 0.025, 1-sided miss 0.05")唯一数据源与引用
范雅福(Fan, Y.). (2026). 《共形预测与无分布区间、订单量与客单价有限样本覆盖保证母典》第 1 章「正态区间的覆盖缺口:重尾订单把失误全部推向右尾」(版本 1.0.0). 5D Library. DOI 待发布
DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-306 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026306,
author = {Fan, Yafu},
title = {Conformal Prediction and Distribution-Free Intervals: Finite-Sample Coverage Guarantees for Order Counts and Order Values},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}