I was going through Statistics Hacks and came across Benford’s Law, which states that in naturally occurring numerical data, the distribution of the first, non-zero significant digit follows a logarithmic probability distribution described as:
P(D1 = d) = log10 (1 + 1/d)
In other words, first number is much more likely going to be a 1 than it is a 9. The pretty graph to the right shows the likely occurrence of the first digit. It’s counter-intuitive, as one would assume the digits would be uniformly distributed. However, it’s been observed in a variety of areas like multiples of numbers, blackbody radiation, physical constants, area of rivers, population and New York Times front pages.
Bassam Hasan notes data must meet the following criteria:
- The data must be numeric.
- There must be an underlying cause for the numbers to occur. For example, business invoice numbers would not work because the numbers are merely labels. (See the lottery question below.)
- The numbers are not restricted by maximum or minimum values. For example, human heights fall within a limited range that would skew the leading digits.
- The numbers must occur naturally, and they are not invented or assigned, such as telephone numbers (based on a phone switch), postal codes (a postal facility) or social security numbers (state your card was issued in).
- There must be a large sample size.
And no, lottery numbers would not be a good candidate. As Dr. Nigrini explains:
“[Lottery] balls are not really numbers; they are labeled with numbers, but they could just as easily be labeled with the names of animals. The numbers they represent are uniformly distributed, every number has an equal chance”
As an experiment, I did an analysis of the size of my multimedia files (mp3, wmv, mov) on another hard drive. I expected this to fail one or two tests above. Here’s the distribution:
There are three major categories of multimedia files– songs, podcasts and lectures — whose file sizes are clustered. Songs tend to be 2 – 6 minutes (Freebird, notwithstanding) since I delete stuff that’s shorter. At an average encoding of 128kb/s, this results in a lot of 4Mb – 6Mb sized fies. An informal sample of my favorite podcasts(“Wait Wait, Don’t Tell Me!“, “This American Life“, and “Talking Robots“), suggests it’s common these span 10 minutes up to an hour. At the top end of the size graph are lectures. (I admire Kiri’s stamina in going the full four(!) hours.)
Next, I looked at the set of files on my computer’s primary (OS) hard disk. With a sample size of 119,708 files, this is how the first digit was distributed:
The curve is “pretty close!”
Because I had already collected the data, here’s the distribution of file sizes:
At the far right, there are two 2Gb files used by the system (pagefile.sys, hiberfile.sys). Zero-length files were ignored, obviously.
Since Benford’s law applies to the first few digits in each place, we can use it to look further at the file sizes. Here’s a table of the percentages of occurrences of the digit in each place:
[I will send ten dollars to the first person who can tell me why the hell WordPress arbitrarily deletes rows and columns in tables — and what I can do to prevent this, short of “don’t use wordpress”.]
Let’s apply this to the first two digits of the file sizes on my computer. The red lines are the distribution of files. The blue line is are the factors multiplied, and the green line is a logarithmic trend line of the Benford numbers, because I may have done something wrong just multiplying out.
Still, we see an interesting result:
There are a lot of files whose size is 8192 bytes! [Edit: over 1,800 of these are regxxxxx files related to Internet Explorer 7 or Patch installs.]
Benford’s law has had a lot of traction in accounting[1,3,4,7,8,10], where it’s used as a technique to detect fraud. For example, the Department of Justice has been using this in counter-terrorism operations, identifying shell corporations used to funnel money. From their “Fiscal Forensics I” article, they note:
A classic example is the organization that has a disproportionate number of transactions in the eight and nine thousand dollar range since they may be structuring transactions (designed to fall below SAR and CTR levels). This fact would likely be revealed during a Benford’s Law analysis as the amount of numbers beginning with the digits 8 or 9 would exceed their expected probability of occurrence.
Georgia Tech Professor Ted Hill proved Benford’s law applies to numbers in other bases. An amusing trick he applies to his classes is asking his students to either (1) flip a coin 200 times, recording the pattern of heads or tails, or (2) make the data up. The next day, he points out most of the made-up data.  He notes that a sequence of 200 flips will have a high likelihood of six of the same side in a row. People faking their data rarely apply this.
Benford’s law does have some limitations. For example, on tax forms rounding occurs. Also, it’s a very common, annoying, and effective marketing strategy to price things ending in “95” or “99.” Finally, sales people have tendency to shave expenses. As Dr. Mark J. Nigrini explains:
”People who travel on business often have to submit receipts for any meal costing $25 or more, so they put in lots of claims for $24.90, just under the limit. That’s why we see so many 24’s.”
-  “Statistics Hacks,” Bruce Frey
-  “Looking Out For Number One,” Jon Walthoe, Robert Hunt and Mike Pearson.
-  Significant Figure Generator, William Fawcett
-  Bassam Hasan, Ph.D., “Assessing Data Authenticity with Benford’s Law.”
-  Malcolm Browne, “Following Benford’s Law, Or Looking out for No. 1,” New York Times, August 4, 1998.
-  Mark J. Nigrini, Ph.D.
-  Steven W. Smith, Ph.D. “Chapter 34: Explaining Bedford’s Law,” The Scientist and Engineer’s Guide to Digital Signal Processing
-  “Financial Forensics” Part 1, 2; US Attorney’s Bulletin, Volume 53, Number 2 (March 2005), Number 3 (May 2005)
-  Charlie Kyd, “Use Benford’s Law with Excel to Improve Business Planning“
-  Benford’s Law, Wolfram.
-  Durtschi, Hillison and Pacini, “Effective Use of Benford’s Law to Assist in Detecting Fraud in Accounting Data,” Journal of Forensic Accounting, 2004.
-  “Sorry, Wrong Number,” Georgia Tech Research Horizons, September 2000.