关于「实证闭环:代购流水与报销自检、红灯复核与预注册方案」,《本福特定律与流水报销审计》给出的定量结论是什么?
结论:第八章给出月度自检流程、三色灯复核、蒸馏小工具「流水首位数审计器」与预注册方案:闸门把诚实店铺的误报率从 0.4280 降到 0.0280,编造占百分之五时阳性预测值从 0.110 升到 0.653。书中以标注框区分已发表的证据、可运行的 Python 计算(20 段程序)、原典与作者的假说。
数据口径:书中参数为示意;全部计算由书中程序生成;本书不是法律意见,也不是个人化经营建议,检验结果只是复核信号。 书中以标注框区分已发表的证据、可运行的 Python 计算(20 段程序)、原典与作者的假说。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.0280, 0.110, 0.4280, 0.653
| flag rates: broad 0.047, fixed 1.000, capped 1.000, invented 1.000 | |
| honest false-alarm rate: no gate 0.4280, with gate 0.0280 | |
| pi PPV no gate PPV gate honest per hit | |
| 0.01 | 0.023 0.265 42.37 |
| 0.05 | 0.110 0.653 8.13 |
| 0.10 | 0.206 0.799 3.85 |
| 0.20 | 0.369 0.899 1.71 |
| honest per hit = honest shops flagged per invented one, no gate |
查看完整验算程序
# Chapter 8. p83: how many red flags point at an honest shop, by base rate.
# Population of ledgers (300 rows each): a share pi is invented by the
# naive inventor of p21; the honest rest is 60 percent broad ledgers
# (lognormal, median 260, log-sd 1.2) and 40 percent fixed-price or
# capped ledgers (half each, as in p22). The digit test is chi-square
# > 15.507. Rates are estimated on 600 simulated ledgers per type
# (fixed seed). With the gate of p81 the digit test is not run on the
# fixed-price and capped ledgers. PPV = share of flagged ledgers that
# are really invented. All shares are illustrative.
import math
import random
P1 = [math.log10(1 + 1 / d) for d in range(1, 10)]
CUM = [math.fsum(0.6 / 9 + 0.4 * p for p in P1[:i + 1]) for i in range(9)]
N, REPS = 300, 600
rng = random.Random(20261112)
def broad():
return max(1, round(math.exp(rng.gauss(math.log(260), 1.2))))
def fixed():
u = rng.random()
if u < 0.8:
return 990 * rng.choices((1, 2, 3), weights=(6, 3, 1))[0]
return 39 if u < 0.9 else 199
def capped():
return min(200, max(1, round(math.exp(rng.gauss(math.log(120), 0.3)))))
def invented_ledger():
seen, out = set(), []
while len(out) < N:
ds = [rng.choices(range(1, 10), cum_weights=CUM)[0]]
size = rng.choices((2, 3, 4), weights=(3, 5, 2))[0]
for i in range(1, size):
w = [1.0] * 10
w[ds[-1]] *= 0.5
if i == size - 1:
w[0] *= 0.4
w[5] *= 0.4
ds.append(rng.choices(range(10), weights=w)[0])
v = int("".join(str(d) for d in ds))
if v not in seen:
seen.add(v)
out.append(v)
return out
def flagged(xs):
cnt = [0] * 10
for x in xs:
cnt[int(str(x)[0])] += 1
return math.fsum((cnt[d] - N * P1[d - 1]) ** 2 / (N * P1[d - 1])
for d in range(1, 10)) > 15.507
rate = {}
for name, gen in (("broad", broad), ("fixed", fixed), ("capped", capped)):
hits = 0
for _ in range(REPS):
hits += flagged([gen() for _ in range(N)])
rate[name] = hits / REPS
hits = 0
for _ in range(REPS):
hits += flagged(invented_ledger())
rate["invented"] = hits / REPS
print("flag rates: " + ", ".join("%s %.3f" % (k, rate[k]) for k in
("broad", "fixed", "capped", "invented")))
fp_nogate = 0.6 * rate["broad"] + 0.2 * rate["fixed"] + 0.2 * rate["capped"]
fp_gate = 0.6 * rate["broad"]
print("honest false-alarm rate: no gate %.4f, with gate %.4f"
% (fp_nogate, fp_gate))
print("%8s %12s %12s %14s" % ("pi", "PPV no gate", "PPV gate",
"honest per hit"))
for pi in (0.01, 0.05, 0.10, 0.20):
tp = pi * rate["invented"]
a = tp / (tp + (1 - pi) * fp_nogate)
b = tp / (tp + (1 - pi) * fp_gate)
print("%8.2f %12.3f %12.3f %14.2f" % (pi, a, b, (1 - a) / a))
print("honest per hit = honest shops flagged per invented one, no gate")唯一数据源与引用
范雅福(Fan, Y.). (2026). 《本福特首位数定律、账目舞弊检测与代购流水报销卡方审计母典》第 8 章「实证闭环:代购流水与报销自检、红灯复核与预注册方案」(版本 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}
}