关于「适用前提:跨越几个数量级、固定定价与价格点的混合」,《本福特定律与流水报销审计》给出的定量结论是什么?

结论:第五章把适用前提写成可测量的闸门:最坏情况 MAD 低于 0.015 需要跨越 1.57 个数量级,单一金额不能占到一成。

数据口径:书中参数为示意;全部计算由书中程序生成;本书不是法律意见,也不是个人化经营建议,检验结果只是复核信号。 书中以标注框区分已发表的证据、可运行的 Python 计算(20 段程序)、原典与作者的假说。

English version

对照数据表

下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.015, 1.57

honest shapespanMADworst
lognormal s=0.30.610.09610.1056
lognormal s=0.51.010.04600.0559
lognormal s=0.71.410.01870.0228
lognormal s=0.91.820.00570.0069
lognormal s=1.02.020.00280.0034
lognormal s=1.22.420.00050.0007
lognormal s=1.53.030.00000.0000
uniform 15 to 800.710.0763-
uniform 100 to 10000.960.0597-
uniform 1 to 100001.990.0597-
meals, cap 2000.520.1142-
worst-case MAD below 0.015 needs s >= 0.776, span 1.57 decades
worst-case MAD below 0.006 needs s >= 0.921, span 1.86 decades
查看完整验算程序
# Chapter 5. p51: the precondition, measured as spread over decades.
# Exact first-digit shares (no sampling) for honest data of known shape:
# lognormal with log-sd s (median 260; worst case over the median also
# shown), uniform ranges, and a capped lognormal.  Span = log10(P99/P1),
# the number of decades holding the central 98 percent of amounts.
# MAD here is the population value: what an infinitely long honest
# ledger of that shape would show.  Shapes are illustrative.
import math

P1 = [math.log10(1 + 1 / d) for d in range(1, 10)]
Z99 = 2.3263478740


def phi(z):
    return 0.5 * (1 + math.erf(z / math.sqrt(2)))


def lognormal_cdf(x, mu, s):
    return phi((math.log(x) - mu) / s) if x > 0 else 0.0


def digits_from_cdf(cdf):
    return [math.fsum(cdf((d + 1) * 10 ** k) - cdf(d * 10 ** k)
                      for k in range(-6, 12)) for d in range(1, 10)]


def mad(q):
    return math.fsum(abs(a - b) for a, b in zip(q, P1)) / 9


def worst_mad(s):
    return max(mad(digits_from_cdf(
        lambda x, m=math.log(100) + i * math.log(10) / 50:
        lognormal_cdf(x, m, s))) for i in range(50))


print("%-22s %7s %8s %8s" % ("honest shape", "span", "MAD", "worst"))
for s in (0.3, 0.5, 0.7, 0.9, 1.0, 1.2, 1.5):
    q = digits_from_cdf(lambda x: lognormal_cdf(x, math.log(260), s))
    span = 2 * Z99 * s / math.log(10)
    print("%-22s %7.2f %8.4f %8.4f" % (
        "lognormal s=%.1f" % s, span, mad(q), worst_mad(s)))
for lo, hi in ((15, 80), (100, 1000), (1, 10000)):
    q = digits_from_cdf(lambda x: min(max((x - lo) / (hi - lo), 0.0), 1.0))
    span = math.log10((lo + 0.99 * (hi - lo)) / (lo + 0.01 * (hi - lo)))
    print("%-22s %7.2f %8.4f %8s" % (
        "uniform %d to %d" % (lo, hi), span, mad(q), "-"))
mu, s, cap = math.log(120), 0.3, 200.0
q = digits_from_cdf(
    lambda x: 1.0 if x >= cap else lognormal_cdf(x, mu, s))
p01 = math.exp(mu - Z99 * s)
p99 = min(cap, math.exp(mu + Z99 * s))
print("%-22s %7.2f %8.4f %8s" % (
    "meals, cap 200", math.log10(p99 / p01), mad(q), "-"))
for target in (0.015, 0.006):
    lo, hi = 0.3, 2.0
    for _ in range(60):
        mid = (lo + hi) / 2
        if worst_mad(mid) > target:
            lo = mid
        else:
            hi = mid
    print("worst-case MAD below %.3f needs s >= %.3f, span %.2f decades"
          % (target, hi, 2 * Z99 * hi / math.log(10)))

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《本福特首位数定律、账目舞弊检测与代购流水报销卡方审计母典》第 5 章「适用前提:跨越几个数量级、固定定价与价格点的混合」(版本 1.0.0). 5D Library. DOI 待发布

DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-216 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026216,
  author    = {Fan, Yafu},
  title     = {Benford's First-Digit Law, Ledger Fraud Detection and Chi-Square Audits of Buying-Agent Cash Flows and Expense Claims},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

本书其他章节结论