What does Benford's Law and Ledger Audits conclude, in numbers, about “The Mean Absolute Deviation: the Noise Floor, Nigrini's Bands and the First-Two-Digit Test”?

Answer: Chapter 4 gives the noise floor of the MAD, 0.2348 divided by the square root of the row count, and catches piling below an approval limit with the first-two-digit test at a detection rate of 0.794.

Scope of the numbers: Its parameters are illustrative; all calculations are generated by its programs; the book is not legal advice and not personalised business advice, and test results are only signals for review. Marked boxes separate published evidence, runnable Python calculations (20 programs), classical sources and the author's hypotheses.

中文版

Data table

The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 0.2348, 0.794

2000 claims per ledger, 500 ledgers per arm
arm MAD1 flag1 MAD12 flag12 z(49)
honest0.0053 0.000 0.00177 0.004 0.70
bunch0.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:
455.15 46: 3.45 47: 3.81 48: 3.94 49: 2.15
cells above z1.96: 5 of 5
expected share of claims moved under the limit0.0452
Show the full program
# 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)

Single source and citation

Fan, Y. (2026). Benford's First-Digit Law, Ledger Fraud Detection and Chi-Square Audits of Buying-Agent Cash Flows and Expense Claims (Version 1.0.0), Chapter 4: The Mean Absolute Deviation: the Noise Floor, Nigrini's Bands and the First-Two-Digit Test. 5D Library. DOI pending

DOI pending · monograph page goes live after publication · 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}
}

Other chapter answers in this book