Benford’s Law Score
Calculate how closely the first digits of a company’s reported numbers follow Benford’s law, a test of whether its financial statements look manipulated or in error.
In many sets of naturally occurring numbers, such as the items of financial statements, the first digit is far more often small than large: a 1 in 30.1% of the numbers and a 9 in only 4.6%, a share of log10(1 + 1/d) for digit d (Benford, 1938). Numbers that were made up, rounded to targets or misstated tend to be spread more evenly. Amiram, Bozanic and Rouen (2015) call the mean absolute deviation of the first digits of all of a company’s statement items in a year its Financial Statement Divergence (FSD) score, and find it higher before restatements and for companies with lower-quality earnings, and Nigrini (2012) gives the ranges of the deviation that conform to the law.
The formula is as follows:
\[\text{Expected Share}_{d} = \frac{\ln\left(1 + \frac{1}{d}\right)}{\ln\left(10\right)}\] \[\text{Mean Absolute Deviation} = \frac{\sum_{d=1}^{9} \left\lvert \text{Actual Share}_{d} - \text{Expected Share}_{d}\right\rvert}{9}\] \[\text{Kolmogorov Smirnov Statistic} = \max\left(\left\lvert \sum_{j=1}^{d} \text{Actual Share}_{j} - \sum_{j=1}^{d} \text{Expected Share}_{j}\right\rvert\right)\] \[\text{Critical Value} = \frac{1.36}{\sqrt{N}}\]The first digit d runs from 1 to 9, the maximum runs over d, the Mean Absolute Deviation is the FSD Score, and N is the number of items. The Critical Value is the Kolmogorov-Smirnov statistic above which the digits depart from Benford’s law at the 5% level.
Also known as: Benford’s law, first digit test, FSD score, financial statement divergence, digit analysis.
Example · AAPL, MSFT · 2021 to 2025
Install the Finance Toolkit with pip install financetoolkit -U, then call get_benford_score:
from financetoolkit import Toolkit
toolkit = Toolkit(
["AAPL", "MSFT"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2021-01-01",
end_date="2025-12-31",
)
toolkit.models.get_benford_score()
Or, with the Finance Toolkit MCP set up, ask an AI assistant such as Claude or ChatGPT:
Did the first digits of the numbers in the financial statements of Apple and Microsoft follow Benford's law from 2021 to 2025?
Which returns:
| Item | 2021 | 2022 | 2023 | 2024 | 2025 |
|---|---|---|---|---|---|
| ('AAPL', 'Items') | 97.0000 | 99.0000 | 97.0000 | 95.0000 | 95.0000 |
| ('AAPL', 'Mean Absolute Deviation') | 0.0313 | 0.0315 | 0.0361 | 0.0264 | 0.0320 |
| ('AAPL', 'Kolmogorov-Smirnov Statistic') | 0.1217 | 0.0828 | 0.0701 | 0.0806 | 0.0767 |
| ('AAPL', 'Critical Value') | 0.1381 | 0.1367 | 0.1381 | 0.1395 | 0.1395 |
| ('MSFT', 'Items') | 103.0000 | 103.0000 | 103.0000 | 104.0000 | 103.0000 |
| ('MSFT', 'Mean Absolute Deviation') | 0.0318 | 0.0279 | 0.0393 | 0.0280 | 0.0305 |
| ('MSFT', 'Kolmogorov-Smirnov Statistic') | 0.0888 | 0.0878 | 0.0684 | 0.0613 | 0.0403 |
| ('MSFT', 'Critical Value') | 0.1340 | 0.1340 | 0.1340 | 0.1334 | 0.1340 |
8 rows
Parameters
get_benford_score accepts the following parameters.
| Parameter | Type | Description | Example |
|---|---|---|---|
rounding | int | None | The number of decimals to round the results to. Defaults to None, which uses the Toolkit’s rounding. | 2 |
show_columns | str | list[str] | None | The columns to keep, a name or a list of names, matched on every column level, or the rows when no column has those names (such as the line items of a financial statement). Names that do not exist are logged, and when none exist the result is returned in full. Defaults to None, which keeps every column. | None, which keeps every column |
References
- Paper Benford, F. (1938). “The Law of Anomalous Numbers.” Proceedings of the American Philosophical Society, 78(4), 551-572.
- Paper Nigrini, M.J. (2012). Benford’s Law: Applications for Forensic Accounting, Auditing, and Fraud Detection. Wiley.
- Paper Amiram, D., Bozanic, Z. and Rouen, E. (2015). “Financial Statement Errors: Evidence from the Distributional Properties of Financial Statement Numbers.” Review of Accounting Studies, 20(4), 1540-1593.