Testing random

sohcahtoa82 at gmail.com sohcahtoa82 at gmail.com
Tue Jun 16 18:30:29 EDT 2015


On Tuesday, June 16, 2015 at 3:01:06 PM UTC-7, Thomas 'PointedEars' Lahn wrote:
> Ned Batchelder wrote:
> 
> > [...]
> >     This is done empirically, by producing `nseq` sequences of
> >     `nrolls` rolls of the die.  Each sequence is examined to
> >     see if it has a zero.  The total number of no-zero
> >     sequences divided `nseq` is the probability.
> 
> No, it is not.  It is the relative frequency for *this* number of trials and 
> *this* run of the experiment.
> 
> >     """
> >     no_zeros = 0
> >     for _ in xrange(nseq):
> >         seq = die_rolls(nrolls)
> >         if not any_zeros(seq):
> >             no_zeros += 1
> >     return float(no_zeros)/nseq
> > 
> > for n in range(10, 101, 10):
> >     # Calculate the probability of getting no zeros by trying
> >     # it a million times.
> >     prob = probability_of_no_zero(n, 1000000)
> >     print "n = {:3d}, P(no zero) = {:.8f}".format(n, prob)
> > 
> > 
> > 
> > Running this gives:
> > 
> > $ pypy testrandom.py
> > n =  10, P(no zero) = 0.34867300
> > n =  20, P(no zero) = 0.12121900
> > n =  30, P(no zero) = 0.04267000
> > n =  40, P(no zero) = 0.01476600
> > n =  50, P(no zero) = 0.00519900
> > n =  60, P(no zero) = 0.00174100
> > n =  70, P(no zero) = 0.00061600
> > n =  80, P(no zero) = 0.00020600
> > n =  90, P(no zero) = 0.00006300
> > n = 100, P(no zero) = 0.00002400
> > 
> > 
> > As n increases, the probability of having no zeros goes down.
> 
> Your programmatic "proof", as all the other intuitive-empirical "proofs", 
> and all the other counter-arguments posted before in this thread, is flawed.  
> As others have pointed out at the beginning of this thread, you *cannot* 
> measure or calculate probability or determine randomness programmatically 
> (at least not with this program).  I repeat: Probability is what relative 
> frequency (which you can measure) *approaches* for *large* numbers.  100 is 
> anything but large, to begin with.  What is "large" depends on the 
> experiment, not on the experimentator.  And with independent events, the 
> probability for getting zero does not increase because you have been getting 
> non-zeros before.  It simply does not work this way.

Nobody is arguing that.  You're arguing against something that nobody is suggesting.


> 
> If you had read the article I referred you to, you would have known that 
> this approach, this program, is bogus.  I see no logic to continue here as 
> long as you do not realize and recognize the Gambler's fallacy on which all 
> arguments presented so far, including yours, are based.  I would only be 
> wasting more precious free time by repeating myself in one way or another.


If the odds of getting a 0 is 1 out of 10, then the odds of NOT getting a zero is 9/10.  Which means the odds of picking 10 numbers and not getting ANY zeroes is (9/10)^10, which is approximately 0.35.  This has NOTHING to do with the Gambler's Fallacy.



> 
> This should give you pause: In real mathematics, events with zero 
> probability can occur.

Nobody will disagree with that.  The probability of me winning the lottery is zero if I don't buy a ticket.

> 
> -- 
> PointedEars
> 
> Twitter: @PointedEars2
> Please do not cc me. / Bitte keine Kopien per E-Mail.



More information about the Python-list mailing list