Benford's Law Digit Analysis (fraud / anomaly screen)
First-digit conformity to the Benford law with chi-square and Nigrini MAD bands - a triage screen, not proof.
See it run - a worked example, 100% in this browser tab
The problem
Forensic accountants and fraud examiners need a fast, defensible first pass over invoices, disbursements, or journal entries to flag datasets worth deeper review. Ad hoc digit checks lack cited thresholds and misfire on data Benford was never meant for.
The local-first solution
Paste or upload a column of numbers and this plugin computes the observed leading-digit distribution against the Benford expectation P(d) = log10(1 + 1/d) by exact arithmetic, reporting chi-square and the Nigrini MAD bands entirely in your browser with nothing uploaded.
What it does
First-digit test: observed count and proportion per digit 1-9 vs the Benford expectation P(d) = log10(1 + 1/d)
Chi-square statistic against the df=8, alpha=0.05 critical value 15.51
Mean Absolute Deviation with Nigrini (2012) first-digit conformity bands (close / acceptable / marginal / nonconformity)
Optional second-digit test with its own Benford expectation and Nigrini MAD bands
Small-sample warnings below the conventional 1000-record floor (and unreliable under ~100)
Exact integer counting so the observed distribution is reproducible
Honest scope
Benford nonconformity is a red flag for further review, not proof of fraud, and a conforming result is not a clean bill of health: every hit must be investigated by an examiner. Benford applies only to data spanning several orders of magnitude from multiplicative processes and does not apply to assigned/structured numbers or bounded ranges; small samples are unreliable, and the MAD cutoffs are Nigrini's published heuristic bands to confirm against the 2012 text, not a legal standard.
Authorities cited
Benford, F. (1938). "The Law of Anomalous Numbers." Proceedings of the American Philosophical Society 78(4):551-572 - the first-digit law P(d) = log10(1 + 1/d).
Newcomb, S. (1881). "Note on the Frequency of Use of the Different Digits in Natural Numbers." American Journal of Mathematics 4(1):39-40 - the original observation.
Nigrini, M. J. (2012). Benford's Law: Applications for Forensic Accounting, Auditing, and Fraud Detection. Wiley - the Mean Absolute Deviation (MAD) conformity bands (first digit: <=0.006 close, <=0.012 acceptable, <=0.015 marginal, >0.015 nonconformity; second digit: <=0.008 / <=0.010 / <=0.012 / >0.012) and the small-sample guidance.
Pearson chi-square goodness-of-fit: X^2 = sum (observed - expected)^2 / expected; critical value at df=8, alpha=0.05 is 15.507 (first digit); df=9 is 16.919 (second digit). Standard chi-square distribution tables.
Screen a dataset
Run the analysis in your browser and route the flagged digits and statistics into a Sandbox workspace, a Worklog case file, or a Gate client portal. Nothing is uploaded to anyone's cloud.