[racket] a small programming exercise

From: Jos Koot (jos.koot at telefonica.net)
Date: Fri Oct 15 11:40:00 EDT 2010

 


  _____  

From: Phil Bewig [mailto:pbewig at gmail.com] 
Sent: 15 October 2010 15:06
To: Jos Koot
Cc: Chris Stephenson; users at racket-lang.org
Subject: Re: [racket] a small programming exercise


Not quite. 

Random numbers are uniformly distributed, so the first digits of a set of
random numbers should all appear equally. 

This is exactly the samer mistake I made.
 
No, take a uniform distribution of pseudo random numbers between 1 and 200.
Like Chris Stephenson wrote, with base 10 about half of them to start with
1. I checked this.
 
Take a uniform distribution between 1 and 400. With base 10 I expect and
find about one quarter of the numbers to start with 1 and with base 20 I
expect and find every digit from 1 to 19 to occur with about the same
frequency.
Jos
 
 
 
 

 

Benford's Law most often applies to sets of naturally-occurring numbers that
are scale-invariant.  Consider the lengths of rivers, as Benford did.  It
doesn't matter whether the rivers are measured in miles or kilometers
(scale-invariant).  The first digits of the lengths of the rivers will
conform to Benford's Law, as long as the set has enough elements.

Auditors use Benford's Law to find anomalous records.  Apply Benford's Law
to a list of the amounts of all checks written by a company in the last
year.  If you see too many checks that start with the digits 7, 8, or 9,
there is a clear indication of fraud.  The embezzler wrote checks that were
slightly less than $1000, on the theory that small checks would more likely
be ignored.  But instead of writing checks for $263 or $347 or $519, he
wrote checks for $838 or $922 to maximize his payout.

There was an external audit of the voting results in last year's Iranian
elections.  The audit clearly showed fraud, as there were far too many
precinct tallies that started with the digits 8 or 9.


There is some considerable theory behind Benford's Law.  Google is your
friend.  Or Shriram is lecturing on Benford's Law today -- perhaps he will
share a reference or three.

On Fri, Oct 15, 2010 at 6:33 AM, Jos Koot <jos.koot at telefonica.net> wrote:




> -----Original Message-----
> From: users-bounces at racket-lang.org
> [mailto:users-bounces at racket-lang.org] On Behalf Of Chris Stephenson
> Sent: 15 October 2010 11:13
> To: users at racket-lang.org
> Subject: Re: [racket] a small programming exercise
>

snip
>
> Think about the decimal numbers in the range 1-200. How many
> start with
> 1?- More than half. The range 1-1000 is an exception. But


The exceptions are flat distributions of natural numbers in a range from 1
to a power of the base, right?
For example:
(test 1000000 (expt 5 5) 5) -> (250490 249654 249630 250226)
distribution of 1000000 natural numbers in the range 1 to (expt 5 5) and
base 5.
1000000/4=250000


> natural distributions are not uniform over a fixed range.
> They are bell curves of one sort or another. If you have a
> natural random distribution there will always be a skew
> toward the smaller digits. It is quantified as Benford's law.
>
> --
> Chris Stephenson
> cs at cs.bilgi.edu.tr
> _________________________________________________
>   For list-related administrative tasks:
>   http://lists.racket-lang.org/listinfo/users


_________________________________________________
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20101015/9b69bc0d/attachment.html>

Posted on the users mailing list.