Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Joshua Thjissen:
Benford’s law in frameworks
Dec 10, 2015 @ 17:10:50

Joshua Thijssen has an interesting post to his site talking about Benford's Law, related to digits and how frequently they would appear in results based on significance.

In a new talk I’m currently presenting at conferences and meetups, I talk – amongst other things – about Benford’s law. This law states that in natural occurring numbers, the first digit of those numbers will most often start with a 1 (around 30% of the time), and logarithmically drops down to the number 9, which occurs only 5% of the time.

[...] Even though there is no guarantee that something will actually follow Benford’s law, a lot of things do, and in fact, it can be used for things like fraud detection: in your taxes, in elections, but basically anything concerning numbers. [...] But anyway, I wanted to see Benford’s law in action for myself, so I’ve come up with a simple test: Take a (PHP) framework, and count the line-numbers for each PHP file in the framework.

He shares the script (well, command) he uses to get these counts and how he did the sorting to help make some sense out of the results. He includes some of the results and graphs showing them to help visualize the Benford’s "curve" the results take. Interestingly enough, most of them follow the trend very closely with only slight variances for Zend Framework v2 and only them because it fluctuates more, nothing to do with the quality of the framework.

tagged: benfordslaw trend line count framework graph results

Link: https://www.adayinthelifeof.nl/2015/12/09/benfords-law-in-frameworks/

Ian Barber's Blog:
Benford's Law
Apr 05, 2011 @ 14:12:46

In a recent post to his blog Ian Barber looks at applying Benford's Law in PHP to determine if the dataset you're working with is "real" or not.

Benfords Law is not an exciting new John Nettles based detective show, but an interesting observation about the distribution of the first digit in sets of numbers originating from various processes. It says, roughly, that in a big collection of data you should expect to see a number starting with 1 about 30% of the time, but starting with 9 only about 5% of the time.

He pulls data from the data.uk.gov site to illustrate and includes a simple PHP script to run through the data looking scoring it with a "Benford" rating. He plots these on a graph along side the data to show the (almost exact) match between the data and the Benford numbers. You can find more details on the law on Wikipedia.

tagged: benfordslaw real fake data evaluate

Link:


Trending Topics: