Re: Re: bimodal ditribution form counting signs of Pi digits differences

*To*: mathgroup at smc.vnet.net*Subject*: [mg51838] Re: [mg51805] Re: bimodal ditribution form counting signs of Pi digits differences*From*: DrBob <drbob at bigfoot.com>*Date*: Wed, 3 Nov 2004 01:24:56 -0500 (EST)*References*: <200411020706.CAA21722@smc.vnet.net>*Reply-to*: drbob at bigfoot.com*Sender*: owner-wri-mathgroup at wolfram.com

Why isn't the KS table built into Mathematica, I wonder? Or is it, somewhere? Bobby On Tue, 2 Nov 2004 02:06:16 -0500 (EST), Bill Rowe <readnewsciv at earthlink.net> wrote: > On 11/1/04 at 2:53 AM, tftn at earthlink.net (Roger Bagula) wrote: > >> I did it to the maximum my version/ machine lets me using the >> method I understood best. The two lists of digits are not the same( >> Pi digits seem to vary more than the Random[Integer,{0.9}] do at >> this level). I'm sure somebody with a later version 5.0 and a >> faster machine can do better, but it still appears that Pi is a >> better pseudorandom than the built in, I think ot at least >> "different" in kind. > > <sigh> What you showed was the output from your manipulation of the output from Random[Integer, {0,9}] is decidedly not equivalent to a uniform distribution. But there is no reason to expect this to be uniform. And this in no way supports your comment "Pi is a better pseudorandom than the built in". > > One way (not the best way) to test whether the digits of Pi are random would be to compare these digits to the output of pseudorandom number generator. And while this method was apparently what you intended to do based on your comments, that is not what your code did. Your code considered the distribution of cummulative sums of Sign[u1-u2] where u1, u2 were randomly chosen from 0-9. If you want to compare the distribution of the digits of Pi to the output of Random[Integer, {0,9}] a reasonably test would be a two sample Kolmogorov-Smirnov test. This test is specifically designed to test whether two samples come from the same distribution or not. > > There are several reasons why comparing the digits of Pi to the output of a given psuedorandom number generator is not the best approach to determining whether the digits of Pi are random or not. The most important is not knowing how closely the output of the pseudorandom number generator matches a uniform distribution. > > Since the uniform distribution is well known and has easily computed properties, the better approach would be to test the digits of Pi to see if they have properties in common with what should be expected. > > Knuth in ACP Vol 2 discusses several different empirical and theoretical tests that can be used to compare the output of any given pseudorandom number generator to a uniform distribution. The same test could be used to test the hypothesis the digits of Pi are random. > > For example, looking at the first 1000 digits of Pi and using a one sample KS test, the relevant test statistic is: > > d = ({First[#1], Length[#1]} & ) /@ > Split[Sort[First[RealDigits[N[Pi, 1000]]]]]; >N[Sqrt[1000]*Max[Abs[Rest[FoldList[ > Plus, 0, Last /@ d/1000]] - Range[10]/10]]] > > 0.4743416490252569 > > And from a table of the KS statistic 90% of the test statistic will be less than 1.068 > > So, the conclusion has to be the first 1000 digits of Pi show no evidence of not being from a uniform distribution. > > Do note, the KS test is one of many that could be used and is not the most efficient. > -- > To reply via email subtract one hundred and four > > > > -- DrBob at bigfoot.com www.eclecticdreams.net

**References**:**Re: bimodal ditribution form counting signs of Pi digits differences***From:*Bill Rowe <readnewsciv@earthlink.net>