关于「反常识命题:编的数太「干净」,而定律会冤枉诚实的固定价店铺」,《本福特定律与流水报销审计》给出的定量结论是什么?
结论:第二章正面陈述反常识命题:朴素编造者的首位数 MAD 是诚实账本的三倍多(0.0415 对 0.0133),而固定价、有上限与窄区间的诚实账本被卡方判为偏离的比例都是 1.000,宽分布的诚实小账本被 MAD 标准误判的比例也有 0.583。
数据口径:书中参数为示意;全部计算由书中程序生成;本书不是法律意见,也不是个人化经营建议,检验结果只是复核信号。 书中以标注框区分已发表的证据、可运行的 Python 计算(20 段程序)、原典与作者的假说。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.0133, 0.0415
| mean per ledger of 300 entries, 400 ledgers each | |
| signal honest naive savvy | |
| first-digit MAD | 0.0133 0.0415 0.0169 |
| chi-square df 8 | 7.8647 62.3204 11.2375 |
| repeat share | 0.1635 0.0000 0.0000 |
| 0/5 tail share | 0.1986 0.1029 0.1033 |
| doubled digits | 0.1063 0.0562 0.0567 |
| standardized gap d = (fake - honest) / pooled sd | |
| first-digit MAD | 6.40 0.90 |
| chi-square df 8 | 5.13 0.74 |
| repeat share | -11.50 -11.50 |
| 0/5 tail share | -4.84 -4.91 |
| doubled digits | -4.62 -4.46 |
查看完整验算程序
# Chapter 2. p21: invented amounts versus recorded amounts, four signals.
# Honest ledger: integer yuan, lognormal, median 260, log-sd 1.2.
# Naive inventor: first digit 0.6 uniform + 0.4 Benford (between the two,
# as in human guessing studies); 2 to 4 digits; a digit equal to the one
# before it is drawn at half weight; a last digit 0 or 5 at 0.4 weight;
# never writes the same amount twice. Savvy inventor: same habits but
# first digits drawn exactly from Benford. All weights are illustrative.
# 300 entries per ledger, 400 ledgers per type, fixed seed.
import math
import random
P1 = [math.log10(1 + 1 / d) for d in range(1, 10)]
N, REPS = 300, 400
rng = random.Random(20261112)
def honest(n):
return [max(1, round(math.exp(rng.gauss(math.log(260), 1.2))))
for _ in range(n)]
def invent(n, w_benford):
probs = [(1 - w_benford) / 9 + w_benford * p for p in P1]
cum = [math.fsum(probs[:i + 1]) for i in range(9)]
seen, out = set(), []
while len(out) < n:
digits = [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[digits[-1]] *= 0.5
if i == size - 1:
w[0] *= 0.4
w[5] *= 0.4
digits.append(rng.choices(range(10), weights=w)[0])
v = int("".join(str(d) for d in digits))
if v not in seen:
seen.add(v)
out.append(v)
return out
def signals(xs):
n = len(xs)
cnt = [0] * 10
for x in xs:
cnt[int(str(x)[0])] += 1
mad = math.fsum(abs(cnt[d] / n - P1[d - 1]) for d in range(1, 10)) / 9
chi = math.fsum((cnt[d] - n * P1[d - 1]) ** 2 / (n * P1[d - 1])
for d in range(1, 10))
dup = (n - len(set(xs))) / n
tail = len([x for x in xs if x >= 10 and x % 5 == 0]) / n
pairs = same = 0
for x in xs:
s = str(x)
for a, b in zip(s, s[1:]):
pairs += 1
same += a == b
return mad, chi, dup, tail, same / pairs
def summary(make):
rows = [signals(make()) for _ in range(REPS)]
cols = list(zip(*rows))
means = [math.fsum(c) / REPS for c in cols]
sds = [math.sqrt(math.fsum((v - m) ** 2 for v in c) / (REPS - 1))
for c, m in zip(cols, means)]
return means, sds
res = {"honest": summary(lambda: honest(N)),
"naive": summary(lambda: invent(N, 0.4)),
"savvy": summary(lambda: invent(N, 1.0))}
names = ("first-digit MAD", "chi-square df 8", "repeat share",
"0/5 tail share", "doubled digits")
print("mean per ledger of %d entries, %d ledgers each" % (N, REPS))
print("%-16s %8s %8s %8s" % ("signal", "honest", "naive", "savvy"))
for i, nm in enumerate(names):
print("%-16s %8.4f %8.4f %8.4f" % (
nm, res["honest"][0][i], res["naive"][0][i], res["savvy"][0][i]))
print("standardized gap d = (fake - honest) / pooled sd")
for i, nm in enumerate(names):
ds = []
for k in ("naive", "savvy"):
sp = math.sqrt((res["honest"][1][i] ** 2 + res[k][1][i] ** 2) / 2)
ds.append((res[k][0][i] - res["honest"][0][i]) / sp)
print("%-16s %8s %8.2f %8.2f" % (nm, "", ds[0], ds[1]))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《本福特首位数定律、账目舞弊检测与代购流水报销卡方审计母典》第 2 章「反常识命题:编的数太「干净」,而定律会冤枉诚实的固定价店铺」(版本 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}
}