关于「平均绝对偏差:噪声底线、尼格里尼区间与前两位数检验」,《本福特定律与流水报销审计》给出的定量结论是什么?
结论:第四章给出 MAD 的噪声底线 0.2348 除以笔数的平方根,并用前两位数检验抓住审批限额下的堆积,检出率 0.794。
数据口径:书中参数为示意;全部计算由书中程序生成;本书不是法律意见,也不是个人化经营建议,检验结果只是复核信号。 书中以标注框区分已发表的证据、可运行的 Python 计算(20 段程序)、原典与作者的假说。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.2348, 0.794
| 2000 claims per ledger, 500 ledgers per arm | |
| arm MAD1 flag1 MAD12 flag12 z(49) | |
| honest | 0.0053 0.000 0.00177 0.004 0.70 |
| bunch | 0.0132 0.144 0.00232 0.794 4.15 |
| floor 0.2348/sqrt(N) | 0.0053; excess MAD1 honest +0.0001, bunch +0.0079 |
| one bunched ledger, z by first-two-digit bin: | |
| 45 | 5.15 46: 3.45 47: 3.81 48: 3.94 49: 2.15 |
| cells above z | 1.96: 5 of 5 |
| expected share of claims moved under the limit | 0.0452 |
查看完整验算程序
# Chapter 4. p42: a fraud the first digit barely sees and two digits catch.
# Honest expense claims: 2000 per ledger, yuan with fen, lognormal with
# median 180 and log-sd 1.3. Approval limit 500 yuan: with probability
# 0.5 a claim in [500, 800) is split or trimmed into [450, 500).
# Tests: first-digit MAD (cut 0.015), first-two-digit MAD (Nigrini cuts
# 0.0012 / 0.0018 / 0.0022), and the z statistic of the busiest
# first-two-digit bins, with continuity correction. 500 ledgers per
# arm, fixed seed. Every parameter is illustrative.
import math
import random
P1 = [math.log10(1 + 1 / d) for d in range(1, 10)]
P12 = {n: math.log10(1 + 1 / n) for n in range(10, 100)}
N, REPS = 2000, 500
rng = random.Random(20261112)
def claim(fraud):
x = round(math.exp(rng.gauss(math.log(180), 1.3)), 2)
if fraud and 500 <= x < 800 and rng.random() < 0.5:
x = round(rng.uniform(450, 499.99), 2)
return max(x, 0.01)
def digits(x):
s = "%.6e" % x
return int(s[0]), int(s[0] + s[2])
def stats(xs):
n = len(xs)
c1, c12 = [0] * 10, [0] * 100
for x in xs:
a, b = digits(x)
c1[a] += 1
c12[b] += 1
m1 = math.fsum(abs(c1[d] / n - P1[d - 1]) for d in range(1, 10)) / 9
m12 = math.fsum(abs(c12[k] / n - P12[k]) for k in range(10, 100)) / 90
zs = {}
for k in (45, 46, 47, 48, 49):
p = P12[k]
zs[k] = (abs(c12[k] / n - p) - 1 / (2 * n)) / math.sqrt(
p * (1 - p) / n)
return m1, m12, zs
FLOOR = 0.2348 / math.sqrt(N)
means = {}
print("2000 claims per ledger, %d ledgers per arm" % REPS)
print("%-6s %8s %8s %8s %8s %8s" % (
"arm", "MAD1", "flag1", "MAD12", "flag12", "z(49)"))
for name, fraud in (("honest", False), ("bunch", True)):
m1s, m12s, f1, f12, z49 = [], [], 0, 0, []
for _ in range(REPS):
m1, m12, zs = stats([claim(fraud) for _ in range(N)])
m1s.append(m1)
m12s.append(m12)
f1 += m1 > 0.015
f12 += m12 > 0.0022
z49.append(zs[49])
means[name] = math.fsum(m1s) / REPS
print("%-6s %8.4f %8.3f %8.5f %8.3f %8.2f" % (
name, means[name], f1 / REPS, math.fsum(m12s) / REPS,
f12 / REPS, math.fsum(z49) / REPS))
print("floor 0.2348/sqrt(N) = %.4f; excess MAD1 honest %+.4f,"
" bunch %+.4f" % (FLOOR, means["honest"] - FLOOR,
means["bunch"] - FLOOR))
xs = [claim(True) for _ in range(N)]
m1, m12, zs = stats(xs)
print("one bunched ledger, z by first-two-digit bin:")
print(" " + " ".join("%d: %.2f" % (k, zs[k]) for k in sorted(zs)))
print(" cells above z = 1.96: %d of 5"
% len([k for k in zs if zs[k] > 1.96]))
def phi(z):
return 0.5 * (1 + math.erf(z / math.sqrt(2)))
mu, sd = math.log(180), 1.3
moved = 0.5 * (phi((math.log(800) - mu) / sd)
- phi((math.log(500) - mu) / sd))
print("expected share of claims moved under the limit: %.4f" % moved)唯一数据源与引用
范雅福(Fan, Y.). (2026). 《本福特首位数定律、账目舞弊检测与代购流水报销卡方审计母典》第 4 章「平均绝对偏差:噪声底线、尼格里尼区间与前两位数检验」(版本 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}
}