Benford's Law — 2D Digit-Frequency Chart

Canvas2D companion

About this 2D companion

This is the flat, textbook-standard view of Benford's Law: a 9-bar chart comparing the empirical leading-digit frequency of a real dataset against the theoretical prediction P(d) = log10(1 + 1/d). It reuses the same digit-extraction and chi-squared logic as the 3D version, rendered with plain Canvas2D instead of a WebGL scene.

P(d) = log₁₀(1 + 1/d)    for d ∈ {1, 2, 3, …, 9}

Powers of 2, powers of 3, Fibonacci numbers and factorials all grow geometrically and obey Benford's Law closely. Uniform random integers in a fixed range do not — that option is included as a deliberate counterexample so the deviation is visible on the chart and in the chi-squared verdict.

Frequently Asked Questions

Why does digit 1 dominate?

On a log scale the interval from 1 to 2 spans log10(2) − log10(1) = 0.301 of a decade, while 9 to 10 spans only 0.046. Scale-invariant data is uniform on a log scale, so smaller leading digits get wider intervals and appear more often.

What does the chi-squared verdict mean?

Chi-squared = sum of (Observed − Expected)^2 / Expected across the 9 digit bins, tested against 8 degrees of freedom. A p-value below 0.05 flags a statistically significant deviation from Benford's prediction — the same test forensic accountants use.

Why is uniform random data a counterexample?

Uniform random integers in a bounded range are not scale-invariant, so their leading digits cluster close to equal probability (~11% each) instead of following the logarithmic curve. Selecting it in the dataset menu produces a large chi-squared value and a "deviates" verdict.