Testing random

classic Classic list List threaded Threaded
82 messages Options
12345
Reply | Threaded
Open this post in threaded view
|

Testing random

Thomas 'PointedEars' Lahn
Jussi Piitulainen wrote:

> Thomas 'PointedEars' Lahn writes:
>> Jussi Piitulainen wrote:
>>> Thomas 'PointedEars' Lahn writes:
>>>>   8 3 6 3 1 2 6 8 2 1 6.
>>>
>>> There are more than four hundred thousand ways to get those numbers
>>> in some order.
>>>
>>> (11! / 2! / 2! / 2! / 3! / 2! = 415800)
>>
>> Fallacy.  Order is irrelevant here.
>
> You need to consider every sequence that leads to the observed counts.

No, you need _not_, because ? I repeat ? the probability of getting a
sequence of length n from a set of 9 numbers whereas the probability of
picking a number is evenly distributed, is (1?9)? [(1/9)^n, or 1/9 to the
nth, for those who do to see it because of lack of Unicode support at their
system].  *Always.*  *No matter* which numbers are in it.  *No matter* in
which order they are.  AISB, order is *irrelevant* here.  *Completely.*

This is _not_ a lottery box; you put the ball with the number on it *back
into the box* after you have drawn it and before you draw a new one.

> One of those sequences occurred. You don't know which.

You do not have to.

> When tossing herrings [?]

Herrings are the key word here, indeed, and they are deep dark red.

> Code follows. Incidentally, I'm not feeling smart here.

Good.  Because you should not feel smart in any way after ignoring all my
explanations.

> [nonsense]

--
PointedEars

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

Reply | Threaded
Open this post in threaded view
|

Testing random

sohcahtoa82@gmail.com
On Wednesday, June 10, 2015 at 10:06:49 AM UTC-7, Thomas 'PointedEars' Lahn wrote:

> Jussi Piitulainen wrote:
>
> > Thomas 'PointedEars' Lahn writes:
> >> Jussi Piitulainen wrote:
> >>> Thomas 'PointedEars' Lahn writes:
> >>>>   8 3 6 3 1 2 6 8 2 1 6.
> >>>
> >>> There are more than four hundred thousand ways to get those numbers
> >>> in some order.
> >>>
> >>> (11! / 2! / 2! / 2! / 3! / 2! = 415800)
> >>
> >> Fallacy.  Order is irrelevant here.
> >
> > You need to consider every sequence that leads to the observed counts.
>
> No, you need _not_, because ? I repeat ? the probability of getting a
> sequence of length n from a set of 9 numbers whereas the probability of
> picking a number is evenly distributed, is (1?9)? [(1/9)^n, or 1/9 to the
> nth, for those who do to see it because of lack of Unicode support at their
> system].  *Always.*  *No matter* which numbers are in it.  *No matter* in
> which order they are.  AISB, order is *irrelevant* here.  *Completely.*
>
> This is _not_ a lottery box; you put the ball with the number on it *back
> into the box* after you have drawn it and before you draw a new one.
>
> > One of those sequences occurred. You don't know which.
>
> You do not have to.
>
> > When tossing herrings [?]
>
> Herrings are the key word here, indeed, and they are deep dark red.
>
> > Code follows. Incidentally, I'm not feeling smart here.
>
> Good.  Because you should not feel smart in any way after ignoring all my
> explanations.
>
> > [nonsense]
>
> --
> PointedEars
>
> Twitter: @PointedEars2
> Please do not cc me. / Bitte keine Kopien per E-Mail.

To put it another way, let's simplify the problem.  You're rolling a pair of dice.  What are the chances that you'll see a pair of 3s?

Look at the list of possible roll combinations:

1 1     1 2     1 3     1 4     1 5     1 6
2 1     2 2     2 3     2 4     2 5     2 6
3 1     3 2     3 3     3 4     3 5     3 6
4 1     4 2     4 3     4 4     4 5     4 6
5 1     5 2     5 3     5 4     5 5     5 6
6 1     6 2     6 3     6 4     6 5     6 6

36 possible combinations.  Only one of them has a pair of 3s.  The answer is 1/36.

What about the chances of seeing 2 1?

Here's where I think you two are having such a huge disagreement.  Does order matter?  It depends what you're pulling random numbers out for.

The odds of seeing 2 1 are also only 1/36.  But if order doesn't matter in your application, then 1 2 is equivalent.  The odds of getting 2 1 OR 1 2 is 2/36, or 1/18.

But whether order matters or not, the chances of getting a pair of threes in two rolls is ALWAYS 1/36.

If this gets expanded to grabbing 10 random numbers between 1 and 9, then the chances of getting a sequence of 10 ones is still only (1/9)^10, *regardless of whether or not order matters*.  There are 9^10 possible sequences, but only *one* of these is all ones.

If order matters, then 7385941745 also has a (1/9)^10 chance of occurring.  Just because it isn't a memorable sequence doesn't give it a higher chance of happening.

If order DOESN'T matter, then 1344557789 would be equivalent, and the odds are higher.

Reply | Threaded
Open this post in threaded view
|

Testing random

Ian Kelly-2
In reply to this post by Thomas 'PointedEars' Lahn
On Wed, Jun 10, 2015 at 11:03 AM, Thomas 'PointedEars' Lahn
<PointedEars at web.de> wrote:

> Jussi Piitulainen wrote:
>
>> Thomas 'PointedEars' Lahn writes:
>>> Jussi Piitulainen wrote:
>>>> Thomas 'PointedEars' Lahn writes:
>>>>>   8 3 6 3 1 2 6 8 2 1 6.
>>>>
>>>> There are more than four hundred thousand ways to get those numbers
>>>> in some order.
>>>>
>>>> (11! / 2! / 2! / 2! / 3! / 2! = 415800)
>>>
>>> Fallacy.  Order is irrelevant here.
>>
>> You need to consider every sequence that leads to the observed counts.
>
> No, you need _not_, because ? I repeat ? the probability of getting a
> sequence of length n from a set of 9 numbers whereas the probability of
> picking a number is evenly distributed, is (1?9)? [(1/9)^n, or 1/9 to the
> nth, for those who do to see it because of lack of Unicode support at their
> system].  *Always.*  *No matter* which numbers are in it.  *No matter* in
> which order they are.  AISB, order is *irrelevant* here.  *Completely.*

Order is relevant because, for instance, there are n differently
ordered sequences that contain n-1 1s and one 2, while there is only
one sequence that contains n 1s. While each of those individual
sequences are indeed equiprobable, the overall probability of getting
a sequence that contains n-1 1s and one 2 is n times the probability
of getting a sequence that contains n 1s.

The context of this whole thread is about the probability of getting a
sequence where every number occurs at least once. The order that they
occur in doesn't matter, but the number of possible permutations does,
because every one of those permutations is a distinct sequence
contributing an equal amount to the total overall probability.

The probability of 123456789 and 111111111 are equal. The probability
of a sequence containing all nine numbers and a sequence containing
only 1s are *not* equal.

Reply | Threaded
Open this post in threaded view
|

Testing random

random832@fastmail.us
In reply to this post by Thomas 'PointedEars' Lahn
On Wed, Jun 10, 2015, at 13:03, Thomas 'PointedEars' Lahn wrote:
> This is _not_ a lottery box; you put the ball with the number on it *back
> into the box* after you have drawn it and before you draw a new one.

Yes, but getting a 2, putting it back, and getting a 1 is just as good
as getting a 1, putting it back, and getting a 2, so you have to add the
probability of those cases together to get the probability of getting at
least one 1 and at least one 2.

Reply | Threaded
Open this post in threaded view
|

Testing random

Jussi Piitulainen
In reply to this post by sohcahtoa82@gmail.com
sohcahtoa82 at gmail.com writes:

[...]

> Here's where I think you two are having such a huge disagreement.
> Does order matter?  It depends what you're pulling random numbers out
> for.
>
> The odds of seeing 2 1 are also only 1/36.  But if order doesn't
> matter in your application, then 1 2 is equivalent.  The odds of
> getting 2 1 OR 1 2 is 2/36, or 1/18.

[...]

I'm not sure what Thomas 'PointedEars' Lahn is talking about. It seems
to be something else than what others have been discussing.

Others have been discussing a record of the number of times that each
possible outcome came up in a sequence of random numbers. There is no
other record of the sequence. The number of drawings is much larger than
the number of possible outcomes. The subject line refers to testing
whether the record of counts is compatible with the drawings being
random in the usual sense: independent, with uniform distribution.

Someone pointed out that some numbers may not have occurred at all - I
think a piece of code needed modification - and so people have commented
on the probability of this happening ... and whether it depends on the
number of drawings.

Reply | Threaded
Open this post in threaded view
|

Testing random

Thomas 'PointedEars' Lahn
In reply to this post by Thomas 'PointedEars' Lahn
Ian Kelly wrote:

> The probability of 123456789 and 111111111 are equal. The probability
> of a sequence containing all nine numbers and a sequence containing
> only 1s are *not* equal.

There is a contradiction in that statement.  Can you find it?

--
PointedEars

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

Reply | Threaded
Open this post in threaded view
|

Testing random

alister
On Fri, 12 Jun 2015 23:32:31 +0200, Thomas 'PointedEars' Lahn wrote:

> Ian Kelly wrote:
>
>> The probability of 123456789 and 111111111 are equal. The probability
>> of a sequence containing all nine numbers and a sequence containing
>> only 1s are *not* equal.
>
> There is a contradiction in that statement.  Can you find it?

i am afraid ther is not

there is only one probibility that will give 111111111 there are a huge
number of combinations that contain all 9 digits

123456789 & 987654321 to name but 2

there are vastly more combinations that contain all 9 digits (9!) even
though the chances of any one sequence is still the same as 111111111  


--
When in a hole, stop diging


Reply | Threaded
Open this post in threaded view
|

Testing random

random832@fastmail.us
In reply to this post by Thomas 'PointedEars' Lahn
On Fri, Jun 12, 2015, at 17:32, Thomas 'PointedEars' Lahn wrote:
> Ian Kelly wrote:
>
> > The probability of 123456789 and 111111111 are equal. The probability
> > of a sequence containing all nine numbers and a sequence containing
> > only 1s are *not* equal.
>
> There is a contradiction in that statement.  Can you find it?

There is not.

The probability of 111111111 is ~0.000000002581, given each digit is
chosen from 1 to 9.

The probability of 123456789 is ~0.000000002581.
The probability of 123456798 is ~0.000000002581.
The probability of 123456879 is ~0.000000002581.
The probability of 123456897 is ~0.000000002581.
The probability of 123456978 is ~0.000000002581.
The probability of 123456987 is ~0.000000002581.
The probability of 123456897 is ~0.000000002581.
The probability of 123457689 is ~0.000000002581.
The probability of 123457698 is ~0.000000002581.
And so on, for a total of 362,880 combinations.

The probability of getting one of these combinations is ~0.000936656708

~0.000936656708 is not equal to ~0.000000002581. QED.

Your problem is that you _continually insist_ on interpreting
"probability of a member of this set" as meaning "probability of one
particular member of this set" rather than "probability of any member of
this set".

It's like claiming the probability of getting a digit from 1 to 3 when
you roll a six-sided die is ~0.1667 instead of 0.5, and playing stupid
when people point out why you're wrong. And it's not even defensible as
an honest misunderstanding because the linguistic ambiguity doesn't
exist in the original claim about the limit probability of full
coverage.

Reply | Threaded
Open this post in threaded view
|

Testing random

Ian Kelly-2
In reply to this post by Thomas 'PointedEars' Lahn
On Fri, Jun 12, 2015 at 3:32 PM, Thomas 'PointedEars' Lahn
<PointedEars at web.de> wrote:
> Ian Kelly wrote:
>
>> The probability of 123456789 and 111111111 are equal. The probability
>> of a sequence containing all nine numbers and a sequence containing
>> only 1s are *not* equal.
>
> There is a contradiction in that statement.  Can you find it?

Yes. I phrased my statement as if I were addressing a rational
individual, in clear contradiction of the current evidence.

Seriously, if you reject even the statement I made above, in spite of
all the arguments that have been advanced in this thread, in spite of
the fact that this is very easy to demonstrate empirically, then I
don't think there's any fertile ground for discussion here.

Reply | Threaded
Open this post in threaded view
|

Testing random

Thomas 'PointedEars' Lahn
In reply to this post by Thomas 'PointedEars' Lahn
Ian Kelly wrote:

> [?] Thomas 'PointedEars' Lahn [?] wrote:
>> Ian Kelly wrote:
>>> The probability of 123456789 and 111111111 are equal. The probability
>>> of a sequence containing all nine numbers and a sequence containing
>>> only 1s are *not* equal.d
>> There is a contradiction in that statement.  Can you find it?
>
> Yes. I phrased my statement as if I were addressing a rational
> individual, in clear contradiction of the current evidence.
>
> Seriously, if you reject even the statement I made above, in spite of
> all the arguments that have been advanced in this thread, in spite of
> the fact that this is very easy to demonstrate empirically, then I
> don't think there's any fertile ground for discussion here.

/Ad hominem/ when out of arguments.  How typical.

Do you deny that ?123456789? *is* ?a sequence containing all nine numbers?
(digits, really), and that ?111111111? *is* ?a sequence containing only 1s??

Do you deny that therefore your second sentence contradicts the first one?

--
PointedEars

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

Reply | Threaded
Open this post in threaded view
|

Testing random

Ian Kelly-2
On Jun 12, 2015 4:16 PM, "Thomas 'PointedEars' Lahn" <PointedEars at web.de>
wrote:

>
> Ian Kelly wrote:
>
> > [?] Thomas 'PointedEars' Lahn [?] wrote:
> >> Ian Kelly wrote:
> >>> The probability of 123456789 and 111111111 are equal. The probability
> >>> of a sequence containing all nine numbers and a sequence containing
> >>> only 1s are *not* equal.d
> >> There is a contradiction in that statement.  Can you find it?
> >
> > Yes. I phrased my statement as if I were addressing a rational
> > individual, in clear contradiction of the current evidence.
> >
> > Seriously, if you reject even the statement I made above, in spite of
> > all the arguments that have been advanced in this thread, in spite of
> > the fact that this is very easy to demonstrate empirically, then I
> > don't think there's any fertile ground for discussion here.
>
> /Ad hominem/ when out of arguments.  How typical.

No, it's ad hominem on top of the other arguments, all of which you have
failed to refute.

> Do you deny that ?123456789? *is* ?a sequence containing all nine numbers?
> (digits, really), and that ?111111111? *is* ?a sequence containing only
1s??

No.

> Do you deny that therefore your second sentence contradicts the first one?

Yes. There are 9! - 1 *other* sequences that all contribute to "the
probability of a sequence containing all nine numbers".

I also think your explanation betrays that you understood my meaning
perfectly well and rather than engaging in honest discussion chose to
deliberately and obtusely misconstrue it in order to pick it apart in some
puerile form of one-upmanship.

I have no interest in wasting my time engaging with dishonest people.
Welcome to my kill file.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150612/704d70d3/attachment.html>

Reply | Threaded
Open this post in threaded view
|

Testing random

sohcahtoa82@gmail.com
In reply to this post by Thomas 'PointedEars' Lahn
On Friday, June 12, 2015 at 3:12:26 PM UTC-7, Thomas 'PointedEars' Lahn wrote:

> Ian Kelly wrote:
>
> > [...] Thomas 'PointedEars' Lahn [...] wrote:
> >> Ian Kelly wrote:
> >>> The probability of 123456789 and 111111111 are equal. The probability
> >>> of a sequence containing all nine numbers and a sequence containing
> >>> only 1s are *not* equal.d
> >> There is a contradiction in that statement.  Can you find it?
> >
> > Yes. I phrased my statement as if I were addressing a rational
> > individual, in clear contradiction of the current evidence.
> >
> > Seriously, if you reject even the statement I made above, in spite of
> > all the arguments that have been advanced in this thread, in spite of
> > the fact that this is very easy to demonstrate empirically, then I
> > don't think there's any fertile ground for discussion here.
>
> /Ad hominem/ when out of arguments.  How typical.
>
> Do you deny that "123456789" *is* "a sequence containing all nine numbers"
> (digits, really), and that "111111111" *is* "a sequence containing only 1s"?
>
> Do you deny that therefore your second sentence contradicts the first one?
>
> --
> PointedEars
>
> Twitter: @PointedEars2
> Please do not cc me. / Bitte keine Kopien per E-Mail.

I'm struggling to see the contradiction here.

Yes, 123456789 is a sequence containing all nine numbers.  And as someone else said, 123456798 is also a sequence containing all numbers.  987654321 contains all numbers.  There are 9*8*7*6*5*4*3*2*1 (Usually expressed as "9!", and equal to 362,880) distinct ways to order nine numbers.

However, there is only ONE way to order a series of all 1s.

There's no contradiction here.

Reply | Threaded
Open this post in threaded view
|

Testing random

random832@fastmail.us
In reply to this post by Thomas 'PointedEars' Lahn
On Fri, Jun 12, 2015, at 18:09, Thomas 'PointedEars' Lahn wrote:
> Do you deny that ?123456789? *is* ?a sequence containing all nine
> numbers?

Do you deny that "123456798" *is* "a sequence containing all nine
numbers"?

Does this mean that "123456789" *is* "123456798" by the transitive
property? NO.

There are multiple different meanings of the word "is" here, and the
particular one that applies here does not mean it can be substituted for
the more general description in a sentence about the probability of
getting a member of the set of such sequences.

Reply | Threaded
Open this post in threaded view
|

Testing random

Mark Lawrence
In reply to this post by Ian Kelly-2
On 12/06/2015 23:00, Ian Kelly wrote:

> On Fri, Jun 12, 2015 at 3:32 PM, Thomas 'PointedEars' Lahn
> <PointedEars at web.de> wrote:
>> Ian Kelly wrote:
>>
>>> The probability of 123456789 and 111111111 are equal. The probability
>>> of a sequence containing all nine numbers and a sequence containing
>>> only 1s are *not* equal.
>>
>> There is a contradiction in that statement.  Can you find it?
>
> Yes. I phrased my statement as if I were addressing a rational
> individual, in clear contradiction of the current evidence.

Beautifully put, hence +1 QOTW.

>
> Seriously, if you reject even the statement I made above, in spite of
> all the arguments that have been advanced in this thread, in spite of
> the fact that this is very easy to demonstrate empirically, then I
> don't think there's any fertile ground for discussion here.
>

Congratulations Thomas 'PointedEars' Lahn, you've been promoted to my
dream team.

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence


Reply | Threaded
Open this post in threaded view
|

Testing random

Thomas 'PointedEars' Lahn
In reply to this post by Ned Batchelder
Ned Batchelder wrote:

> You aren't agreeing because you are arguing about different things.
> Thomas is talking about the relative probability of sequences of digits.

There is no such thing as ?relative probability?, except perhaps in popular-
scientific material and bad translations.  You might mean relative
_frequency_, but I was not talking about that specifically.

> Chris is talking about the probability of a single digit never appearing
> in the output.

I do not think that what I am talking about and what you think Chris is
talking about are different things.

> Thomas: let's say I generate streams of N digits drawn randomly from 0-9.
> I then consider the probability of a zero *never appearing once* in my
> stream.  Let's call that P(N)
 
In probability theory, it is called the probability P(E) of the event E that
in n trials the probability variable X never assumes the value 0, which can
be defined as

  P(E), E = {e_i | n ? ? \ {0}, i = 1, ?, n} \ {X ? 0}, ? = {1, 2, ?, 9}

where the e_i are the singular events, or outcomes, of the probabilistic
experiment, and ? is the sample space of the e_i.

> Do you agree that as N increases, P(N) decreases?

I do not agree that P(E), as defined above, decreases as n increases.

See also: <http://rationalwiki.org/wiki/Gambler%27s_fallacy>

--
PointedEars

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

Reply | Threaded
Open this post in threaded view
|

Testing random

random832@fastmail.us
On Tue, Jun 16, 2015, at 15:18, Thomas 'PointedEars' Lahn wrote:
> There is no such thing as ?relative probability?, except perhaps in
> popular-
> scientific material and bad translations.  You might mean relative
> _frequency_, but I was not talking about that specifically.

The probability of one event (getting a red on a roulette wheel) can be
larger than the probability of another event (getting a 17).

This is the plain english sense of the word "relative".


You have not answered my last question:


On Fri, Jun 12, 2015, at 18:57, random832 at fastmail.us wrote:
> On Fri, Jun 12, 2015, at 18:09, Thomas 'PointedEars' Lahn wrote:
> > Do you deny that ?123456789? *is* ?a sequence containing all nine
> > numbers?
>
> Do you deny that "123456798" *is* "a sequence containing all nine
> numbers"?
>
> Does this mean that "123456789" *is* "123456798" by the transitive
> property? NO.

The temperature today is hot. The temperature tomorrow is also hot. This
is true even if the temperature today is (for example) 37 and the
temperature tomorrow is 35.

Reply | Threaded
Open this post in threaded view
|

Testing random

Ned Batchelder
In reply to this post by Thomas 'PointedEars' Lahn
On Tuesday, June 16, 2015 at 3:21:46 PM UTC-4, Thomas 'PointedEars' Lahn wrote:

> Ned Batchelder wrote:
>
> > You aren't agreeing because you are arguing about different things.
> > Thomas is talking about the relative probability of sequences of digits.
>
> There is no such thing as ?relative probability?, except perhaps in popular-
> scientific material and bad translations.  You might mean relative
> _frequency_, but I was not talking about that specifically.
>
> > Chris is talking about the probability of a single digit never appearing
> > in the output.
>
> I do not think that what I am talking about and what you think Chris is
> talking about are different things.
>
> > Thomas: let's say I generate streams of N digits drawn randomly from 0-9.
> > I then consider the probability of a zero *never appearing once* in my
> > stream.  Let's call that P(N)
>  
> In probability theory, it is called the probability P(E) of the event E that
> in n trials the probability variable X never assumes the value 0, which can
> be defined as
>
>   P(E), E = {e_i | n ? ? \ {0}, i = 1, ?, n} \ {X ? 0}, ? = {1, 2, ?, 9}
>
> where the e_i are the singular events, or outcomes, of the probabilistic
> experiment, and ? is the sample space of the e_i.
>
> > Do you agree that as N increases, P(N) decreases?
>
> I do not agree that P(E), as defined above, decreases as n increases.
>
> See also: <http://rationalwiki.org/wiki/Gambler%27s_fallacy>

I apologize, I'm sure I've been using the mathematical terms imprecisely.
We are all intelligent people, so I still believe we disagree because we
are talking about different things.

To put us all on a footing where (I hope) we have a shared understanding,
this Python program demonstrates what I was talking about:



import random

def die_roll():
    """Roll the die once, produce a number 0-9."""
    return random.randint(0, 9)

def die_rolls(n):
    """Roll the die n times, produce a list of numbers from 0-9."""
    return [die_roll() for _ in xrange(n)]

def any_zeros(seq):
    """Is there any zero in `seq`?"""
    return any(x == 0 for x in seq)

def probability_of_no_zero(nrolls, nseq):
    """Determine the chance of no zero in a sequence of rolls.

    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_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.

--Ned.

Reply | Threaded
Open this post in threaded view
|

Testing random

Thomas 'PointedEars' Lahn
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.

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.

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

--
PointedEars

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

Reply | Threaded
Open this post in threaded view
|

Testing random

sohcahtoa82@gmail.com
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.

Reply | Threaded
Open this post in threaded view
|

Testing random

Ian Kelly-2
On Tue, Jun 16, 2015 at 4:30 PM,  <sohcahtoa82 at gmail.com> wrote:
> On Tuesday, June 16, 2015 at 3:01:06 PM UTC-7, Thomas 'PointedEars' Lahn wrote:
>> 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.

I believe he's actually referring to this:

https://en.wikipedia.org/wiki/Almost_surely

Not that this has anything to do with the probabilities under
discussion in this thread.

12345