Benford's Law Visualization

Explore the First Digit Law P(d)=log10(1+1/d), verify leading digit distribution in natural data, and perform chi-squared goodness-of-fit test

Supports positive numbers separated by commas, spaces, or newlines

Examples:

Dataset Info

Total Numbers -
Valid Numbers -
Invalid Numbers -

Chi-Squared Test

Statistic -
Critical Value (alpha=0.05) 15.507
P-Value -
Conclusion -

Formula

P(d) = log10(1 + 1/d)

P(d) = log10(1 + 1/d), d = 1, 2, ..., 9

Theoretical vs Observed Distribution

Digit Theoretical Observed Count Difference

What is Benford's Law?

Benford's Law, also known as the First Digit Law, states that in many naturally occurring collections of numbers, the leading digit is likely to be small. The probability of 1 as the leading digit is about 30.1%, while 9 appears only 4.6% of the time.

Why Does Benford's Law Occur?

This happens because numbers are uniformly distributed on a logarithmic scale. When counting from 1 to 9, we span most of the range between 1 and 2 on the logarithmic scale, while 8 to 9 covers only a small portion. Thus, smaller leading digits appear more frequently.

Practical Applications

Key Insights

  • Larger datasets converge closer to the theoretical prediction (Law of Large Numbers)
  • Uniform random numbers do not follow Benford's Law because uniform distribution is not uniform on a logarithmic scale
  • Data spanning multiple orders of magnitude (e.g., population, GDP) is more likely to follow Benford's Law
  • Chi-squared test quantitatively evaluates how well data fits Benford's Law
  • Prime numbers approximately follow Benford's Law, but converge more slowly

The chi-squared statistic measures the deviation between observed and expected frequencies. When the statistic is below the critical value, data conforms to Benford's Law at the 95% confidence level.