INTERACTIVE COMPANION · DIGIT BENCH · METHODS
The Digit Bench
Two instruments sit below, both running the same test statistics the article uses:
Pearson's chi-squared on nine digit bins at 8 degrees of freedom, and Nigrini's mean
absolute deviation against fixed bands. Nothing here calls a server. The eight datasets
in the bench are the exact digit counts analysis/benford-real-data.py
printed from the cached files under analysis/data/, typed in once and
never touched again, and the simulations use a small seeded generator so a reload gives
the same digit histograms every time.
Model 1. The digit bench
Pick a dataset. The bars are the digits it actually produced; the dashed step is what Benford's law expects at this sample size. The statistics update live and are computed the same way the article computes them, so you can check any of the eight rows in §3 against what appears here.
Model 2. Spread and the false-accusation counter
The left slider builds a log-uniform window S decades wide, starting at zero, and shows its exact first-digit law, no random sampling involved, the same closed-form calculation behind Figure 2 of the article. Watch the MAD readout touch zero at every whole decade and rise in between. The right side is a genuine Monte Carlo: it draws honest datasets, exactly Benford or a chosen lognormal spread, of a size you pick, and tallies how often the standard test convicts them anyway. Every one of those datasets is innocent by construction.
Three numbers here are worth checking by hand against the article, and the defaults are chosen so a fresh page load already shows them. D1 on the bench opens at χ² = 7.608, p = 0.4726 and MAD = 0.01521, the exact three numbers §4 derives by hand from the same nine counts. The spread model opens at S = 1.00, where the closed-form MAD is exactly 0, the mechanism §5 rests on. The counter, left running at its default n=100 with the MAD rule, will settle near the article's measured 91.8% false-accusation rate within a few hundred draws.