thumb|alt=A sequence of decreasing blue bars against a light gray grid background|The distribution of first digits, according to Benford's law. Each bar represents a digit, and the height of the bar is the percentage of numbers that start with that digit.

thumb|Frequency of first significant digit of physical constants plotted against Benford's law

Benford's law, also known as the Newcomb–Benford law, the law of anomalous numbers, or the first-digit law, is an observation that in many real-life sets of numerical data, the leading digit is likely to be small.

In sets that obey the law, the number 1 appears as the leading significant digit about 30% of the time, while 9 appears as the leading significant digit less than 5% of the time. Uniformly distributed digits would each occur about 11.1% of the time. Benford's law also makes predictions about the distribution of second digits, third digits, digit combinations, and so on.

Benford's law may be derived by assuming the dataset values are uniformly distributed on a logarithmic scale. The graph to the right shows Benford's law for base 10. Although a decimal base is most common, the result generalizes to any integer base greater than 2. Further generalizations published in 1995 included analogous statements for both the nth leading digit and the joint distribution of the leading n digits, the latter of which leads to a corollary wherein the significant digits are shown to be a statistically dependent quantity.

It has been shown that this result applies to a wide variety of data sets, including electricity bills, street addresses, stock prices, house prices, population numbers, death rates, lengths of rivers, and physical and mathematical constants. Like other general principles about natural data—for example, the fact that many data sets are well approximated by a normal distribution—there are illustrative examples and explanations that cover many of the cases where Benford's law applies, though there are many other cases where Benford's law applies that resist simple explanations. Benford's law tends to be most accurate when values are distributed across multiple orders of magnitude, especially if the process generating the numbers is described by a power law (which is common in nature).

The law is named after physicist Frank Benford, who stated it in 1938 in an article titled "The Law of Anomalous Numbers", although it had been previously stated by Simon Newcomb in 1881. The dotted line shows P(d) were the distribution uniform. (In the SVG image, hover over a graph to show the value for each point.)]]

An extension of Benford's law predicts the distribution of first digits in other bases besides decimal; in fact, any base . The general form is

: <math>P(d) = \log_b(d + 1) - \log_b(d) = \log_b\left(1 + \frac{1}{d}\right).</math>

For (the binary and unary) number systems, Benford's law is true but trivial: All binary and unary numbers (except for 0 or the empty set) start with the digit 1. (On the other hand, the generalization of Benford's law to second and later digits is not trivial, even for binary numbers.)

Examples

Distribution of first digits (in %, red bars) in the [[List of countries by population|population of the 237 countries of the world as of July 2010. Black dots indicate the distribution predicted by Benford's law.|thumb|right]]

Examining a list of the heights of the 58 tallest structures in the world by category shows that 1 is by far the most common leading digit, irrespective of the unit of measurement (see "scale invariance" below):

{| class="wikitable" style="text-align:right"

!rowspan="2"| Leading<br/> digit

!colspan=2| m

!colspan=2| ft

!rowspan="2"| Per<br/> Benford's law

|-

! Count

! Share

! Count

! Share

|-

| 1

| 23

| 39.7 %

| 15

| 25.9 %

| 30.1 %

|-

| 2

| 12

| 20.7 %

| 8

| 13.8 %

| 17.6 %

|-

| 3

| 6

| 10.3 %

| 5

| 8.6 %

| 12.5 %

|-

| 4

| 5

| 8.6 %

| 7

| 12.1 %

| 9.7 %

|-

| 5

| 2

| 3.4 %

| 9

| 15.5 %

| 7.9 %

|-

| 6

| 5

| 8.6 %

| 4

| 6.9 %

| 6.7 %

|-

| 7

| 1

| 1.7 %

| 3

| 5.2 %

| 5.8 %

|-

| 8

| 4

| 6.9 %

| 6

| 10.3 %

| 5.1 %

|-

| 9

| 0

| 0 %

| 1

| 1.7 %

| 4.6 %

|}

Another example is the leading digit of . The sequence of the first 96 leading digits (1, 2, 4, 8, 1, 3, 6, 1, 2, 5, 1, 2, 4, 8, 1, 3, 6, 1,&nbsp;... ) exhibits closer adherence to Benford's law than is expected for random sequences of the same length, because it is derived from a geometric sequence. Newcomb's published result is the first known instance of this observation and includes a distribution on the second digit as well. Newcomb proposed a law that the probability of a single number N being the first digit of a number was equal to log(N&nbsp;+&nbsp;1)&nbsp;−&nbsp;log(N).

The phenomenon was again noted in 1938 by the physicist Frank Benford,

Explanations

Benford's law tends to apply most accurately to data that span several orders of magnitude. As a rule of thumb, the more orders of magnitude that the data evenly covers, the more accurately Benford's law applies. For instance, one can expect that Benford's law would apply to a list of numbers representing the populations of United Kingdom settlements. But if a "settlement" is defined as a village with population between 300 and 999, then Benford's law will not apply.

Consider the probability distributions shown below, referenced to a log scale. In each case, the total area in red is the relative probability that the first digit is 1, and the total area in blue is the relative probability that the first digit is&nbsp;8. For the first distribution, the size of the areas of red and blue are approximately proportional to the widths of each red and blue bar. Therefore, the numbers drawn from this distribution will approximately follow Benford's law. On the other hand, for the second distribution, the ratio of the areas of red and blue is very different from the ratio of the widths of each red and blue bar. Rather, the relative areas of red and blue are determined more by the heights of the bars than the widths. Accordingly, the first digits in this distribution do not satisfy Benford's law at all.)

One possible explanation comes from the structure of positional notation used to write numbers.

Krieger–Kafri entropy explanation

In 1970 Wolfgang Krieger proved what is now called the Krieger generator theorem. The Krieger generator theorem might be viewed as a justification for the assumption in the Kafri ball-and-box model that, in a given base <math>B</math> with a fixed number of digits 0, 1,&nbsp;..., n,&nbsp;..., <math>B - 1</math>, digit n is equivalent to a Kafri box containing n non-interacting balls. Other scientists and statisticians have suggested entropy-related explanations for Benford's law.

Multiplicative fluctuations

Many real-world examples of Benford's law arise from multiplicative fluctuations. For example, if a stock price starts at $100, and then each day it gets multiplied by a randomly chosen factor between 0.99 and 1.01, then over an extended period the probability distribution of its price satisfies Benford's law with higher and higher accuracy.

The reason is that the logarithm of the stock price is undergoing a random walk, so over time its probability distribution will get more and more broad and smooth (see above). For numbers drawn from certain distributions (IQ scores, human heights) the Benford's law fails to hold because these variates obey a normal distribution, which is known not to satisfy Benford's law, since normal distributions can't span several orders of magnitude and the Significand of their logarithms will not be (even approximately) uniformly distributed. However, if one "mixes" numbers from those distributions, for example, by taking numbers from newspaper articles, Benford's law reappears. This can also be proven mathematically: if one repeatedly "randomly" chooses a probability distribution (from an uncorrelated set) and then randomly chooses a number according to that distribution, the resulting list of numbers will obey Benford's law. A similar probabilistic explanation for the appearance of Benford's law in everyday-life numbers has been advanced by showing that it arises naturally when one considers mixtures of uniform distributions.

Invariance

In a list of lengths, the distribution of first digits of numbers in the list may be generally similar regardless of whether all the lengths are expressed in metres, yards, feet, inches, etc. The same applies to monetary units.

This is not always the case. For example, the height of adult humans almost always starts with a 1 or 2 when measured in metres and almost always starts with 4, 5, 6, or 7 when measured in feet. But in a list of lengths spread evenly over many orders of magnitude—for example, a list of 1000 lengths mentioned in scientific papers that includes the measurements of molecules, bacteria, plants, and galaxies—it is reasonable to expect the distribution of first digits to be the same no matter whether the lengths are written in metres or in feet.

When the distribution of the first digits of a data set is scale-invariant (independent of the units that the data are expressed in), it is always given by Benford's law.

For example, the first (non-zero) digit on the aforementioned list of lengths should have the same distribution whether the unit of measurement is feet or yards. But there are three feet in a yard, so the probability that the first digit of a length in yards is 1 must be the same as the probability that the first digit of a length in feet is 3, 4, or&nbsp;5; similarly, the probability that the first digit of a length in yards is 2 must be the same as the probability that the first digit of a length in feet is 6, 7, or&nbsp;8. Applying this to all possible measurement scales gives the logarithmic distribution of Benford's law.

Benford's law for first digits is base invariant for number systems. There are conditions and proofs of sum invariance, inverse invariance, and addition and subtraction invariance.

Applications

Accounting fraud detection

In 1972, Hal Varian suggested that the law could be used to detect possible fraud in lists of socio-economic data submitted in support of public planning decisions. Based on the plausible assumption that people who fabricate figures tend to distribute their digits fairly uniformly, a simple comparison of first-digit frequency distribution from the data with the expected distribution according to Benford's law ought to show up any anomalous results.

Use in criminal trials

In the United States, evidence based on Benford's law has been admitted in criminal cases at the federal, state, and local levels.

Election data

Walter Mebane, a political scientist and statistician at the University of Michigan, was the first to apply the second-digit Benford's law-test (2BL-test) in election forensics. Such analysis is considered a simple, though not foolproof, method of identifying irregularities in election results. Scientific consensus to support the applicability of Benford's law to elections has not been reached in the literature. A 2011 study by the political scientists Joseph Deckert, Mikhail Myagkov, and Peter C. Ordeshook argued that Benford's law is problematic and misleading as a statistical indicator of election fraud. Their method was criticized by Mebane in a response, though he agreed that there are many caveats to the application of Benford's law to election data.

Benford's law has been used as evidence of fraud in the 2009 Iranian elections. An analysis by Mebane found that the second digits in vote counts for President Mahmoud Ahmadinejad, the winner of the election, tended to differ significantly from the expectations of Benford's law, and that the ballot boxes with very few invalid ballots had a greater influence on the results, suggesting widespread ballot stuffing. Another study used bootstrap simulations to find that the candidate Mehdi Karroubi received almost twice as many vote counts beginning with the digit 7 as would be expected according to Benford's law, while an analysis from Columbia University concluded that the probability that a fair election would produce both too few non-adjacent digits and the suspicious deviations in last-digit frequencies as found in the 2009 Iranian presidential election is less than 0.5 percent. Benford's law has also been applied for forensic auditing and fraud detection on data from the 2003 California gubernatorial election, the 2000 and 2004 United States presidential elections, and the 2009 German federal election. The Benford's Law Test was found to be "worth taking seriously as a statistical test for fraud," although "the test is not sensitive to distortions we know significantly affected many votes. In particular, the test does not indicate problems for Florida in 2000."

Macroeconomic data

Similarly, the macroeconomic data the Greek government reported to the European Union before entering the eurozone was shown to be probably fraudulent using Benford's law, albeit years after the country joined.

Price digit analysis

Researchers have used Benford's law to detect psychological pricing patterns, in a Europe-wide study in consumer product prices before and after euro was introduced in 2002. The idea was that, without psychological pricing, the first two or three digits of price of items should follow Benford's law. Consequently, if the distribution of digits deviates from Benford's law (such as having a lot of 9's), it means merchants may have used psychological pricing.

When the euro replaced local currencies in 2002, for a brief period of time, the price of goods in euro was simply converted from the price of goods in local currencies before the replacement. As it is essentially impossible to use psychological pricing simultaneously on both price-in-euro and price-in-local-currency, during the transition period, psychological pricing would be disrupted even if it used to be present. It can only be re-established once consumers have gotten used to prices in a single currency again, this time in euro.

As the researchers expected, the distribution of first price digit followed Benford's law, but the distribution of the second and third digits deviated significantly from Benford's law before the introduction, then deviated less during the introduction, then deviated more again after the introduction.

Genome data

The number of open reading frames and their relationship to genome size differs between eukaryotes and prokaryotes with the former showing a log-linear relationship and the latter a linear relationship. Benford's law has been used to test this observation with an excellent fit to the data in both cases.

Scientific fraud detection

A test of regression coefficients in published papers showed agreement with Benford's law. As a comparison group subjects were asked to fabricate statistical estimates. The fabricated results conformed to Benford's law on first digits, but failed to obey Benford's law on second digits.

Academic publishing networks

Testing the number of published scientific papers of all registered researchers in Slovenia's national database was shown to strongly conform to Benford's law. Moreover, the authors were grouped by scientific field, and tests indicate natural sciences exhibit greater conformity than social sciences.

Statistical tests

Although the chi-squared test has been used to test for compliance with Benford's law it has low statistical power when used with small samples.

The Kolmogorov–Smirnov test and the Kuiper test are more powerful when the sample size is small, particularly when Stephens's corrective factor is used. These tests may be unduly conservative when applied to discrete distributions. Values for the Benford test have been generated by Morrow. The critical values of the test statistics are shown below:

:{| class="wikitable" style="text-align:center;"

!

! 0.10

! 0.05

! 0.01

|-

| Kuiper

| 1.191

| 1.321

| 1.579

|-

| Kolmogorov–Smirnov

| 1.012

| 1.148

| 1.420

|}

These critical values provide the minimum test statistic values required to reject the hypothesis of compliance with Benford's law at the given significance levels.

Two alternative tests specific to this law have been published: First, the max () statistic is given by

: <math>m = \sqrt{N} \cdot \max_{k=1}^9 \left\{\left|\Pr\left(X \text{ has FSD} = k\right) - \log_{10}\left(1 + \frac{1}{k}\right)\right|\right\}.</math>

The leading factor <math>\sqrt{N}</math> does not appear in the original formula by Leemis; is given by

: <math>d = \sqrt{N \cdot \sum_{l=1}^9 \left[\Pr\left(X \text{ has FSD} = l\right) - \log_{10}\left(1 + \frac{1}{l}\right)\right]^2},</math>

where FSD is the first significant digit and is the sample size. Morrow has determined the critical values for both these statistics, which are shown below:

If the goal is to conclude agreement with the Benford's law rather than disagreement, then the goodness-of-fit tests mentioned above are inappropriate. In this case the specific tests for equivalence should be applied. An empirical distribution is called equivalent to the Benford's law if a distance (for example total variation distance or the usual Euclidean distance) between the probability mass functions is sufficiently small. This method of testing with application to Benford's law is described in Ostrovski.

Range of applicability

Distributions known to obey Benford's law

Some well-known infinite integer sequences satisfy Benford's law exactly (in the asymptotic limit as more and more terms of the sequence are included). Among these are the Fibonacci numbers, the factorials, the powers of&nbsp;2, and the powers of almost any other number.

Likewise, some continuous processes satisfy Benford's law exactly (in the asymptotic limit as the process continues through time). One is an exponential growth or decay process: If a quantity is exponentially increasing or decreasing in time, then the percentage of time that it has each first digit satisfies Benford's law asymptotically (i.e. increasing accuracy as the process continues through time).

Distributions known to disobey Benford's law

The square roots and reciprocals of successive natural numbers do not obey this law. Prime numbers in a finite range follow a Generalized Benford's law, that approaches uniformity as the size of the range approaches infinity. Lists of local telephone numbers violate Benford's law. Benford's law is violated by the populations of all places with a population of at least 2500 individuals from five US states according to the 1960 and 1970 censuses, where only 19 % began with digit 1 but 20 % began with digit 2, because truncation at 2500 introduces statistical bias.

Distributions that do not span several orders of magnitude will not follow Benford's law. Examples include height, weight, and IQ scores.

Criteria for distributions expected and not expected to obey Benford's law

A number of criteria, applicable particularly to accounting data, have been suggested where Benford's law can be expected to apply.

;Distributions that can be expected to obey Benford's law

  • When the mean is greater than the median and the skew is positive
  • Numbers that result from mathematical combination of numbers: e.g. quantity × price
  • Transaction level data: e.g. disbursements, sales

;Distributions that would not be expected to obey Benford's law

  • Where numbers are assigned sequentially: e.g. check numbers, invoice numbers
  • Where numbers are influenced by human thought: e.g. prices set by psychological thresholds ($9.99)
  • Accounts with a large number of firm-specific numbers: e.g. accounts set up to record $100 refunds
  • Accounts with a built-in minimum or maximum
  • Distributions that do not span an order of magnitude of numbers.

Benford's law compliance theorem

Mathematically, Benford's law applies if the distribution being tested fits the "Benford's law compliance theorem". The Gumbel distribution – a density increases with increasing value of the random variable – does not show agreement with this law. In particular, for any given number of digits, the probability of encountering a number starting with the string of digits n of that length discarding leading zeros is given by

: <math>\log_{10}(n + 1) - \log_{10}(n) = \log_{10}\left(1 + \frac{1}{n}\right).</math>

Thus, the probability that a number starts with the digits 3,&nbsp;1,&nbsp;4 (some examples are 3.14, 3.142, , 314280.7, and 0.00314005) is , as in the box with the log-log graph on the right. &nbsp;

This result can be used to find the probability that a particular digit occurs at a given position within a number. For instance, the probability that a "2" is encountered as the second digit is

  • mean 3.440
  • variance 6.057
  • skewness 0.796
  • kurtosis −0.548

For the two-digit distribution according to Benford's law these values are also known:

  • mean 38.590
  • variance 621.832
  • skewness 0.772
  • kurtosis −0.547

A table of the exact probabilities for the joint occurrence of the first two digits according to Benford's law is available,