Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Equivalent of binomial probability on a continuous scale?

6 views
Skip to first unread message

scrivener

unread,
Jan 25, 2012, 12:24:34 AM1/25/12
to

If each trial with a binomial result has a probability of success of
50%, the probability of succeeding 3 or more times in 5 trials is 50%
... 6 or more times in 10 trials is .377 ... 30 or more times in 50
trials is .101, etc. So my binomial calculator tells me.

How does one compute analogous probability for success on a scale?

E.g., suppose in a random trial one picks a number in the top 33% of a
population (about a half standard deviation or more above average).
The probability of that is 33%.

But how does one figure the probability of in, say, five independent
trials picking numbers that on average have a value in the top 33%?
(Not all being in the top 33%, that would be 0.33^5, but which average
being in the top 33%.) Or of in 10, 15, trials picking numbers that
have an average value in the top 33%?

I've looked around for the answer and as this seems a rather basic
question have been surprised not to find it. Or maybe I'm just too
innumerate to recognize it when I see it.

Thanks in advance to anyone who straightens me out on this.

Also thanks to anyone who can point me to a good web site that
discusses this particular issue and related ones on a basic level.

Ray Koopman

unread,
Jan 25, 2012, 1:59:00 AM1/25/12
to
On Jan 24, 9:24 pm, scrivener <scrive...@mindspring.com> wrote:
> If each trial with a binomial result has a probability of success of
> 50%, the probability of succeeding 3 or more times in 5 trials is 50%
> ... 6 or more times in 10 trials is .377 ... 30 or more times in 50
> trials is .101, etc. So my binomial calculator tells me.
>
> How does one compute analogous probability for success on a scale?
>
> E.g., suppose in a random trial one picks a number in the top 33% of
> a population (about a half standard deviation or more above average).
> The probability of that is 33%.
>
> But how does one figure the probability of in, say, five independent
> trials picking numbers that on average have a value in the top 33%?
> (Not all being in the top 33%, that would be 0.33^5, but which average
> being in the top 33%.) Or of in 10, 15, trials picking numbers that
> have an average value in the top 33%?

That's still ambiguous. You have several independent sample values
from the same distribution. For each one you calculate its upper-tail
p-value; that is, the probability of getting a value that big or
bigger. Are you asking for the probability that the average of those
p-values is < .33 ? Or are are you asking for the probability that
the p-value of the average of the original sample values is < .33 ?

Peter Webb

unread,
Jan 25, 2012, 9:07:27 PM1/25/12
to

"scrivener" <scri...@mindspring.com> wrote in message
news:e94vh7de46384mv4p...@4ax.com...
The chances of (say) the average of 10 trials being greater than x is the
same as the sum of 10 trials being greater than 10x. Your question about
averages is really a question about sums.

The following will answer your question (hopefully):

http://en.wikipedia.org/wiki/Binomial_distribution

This page tells you how to approximate a Binomial distribution with a
"normal" (Gaussian) distribution. It is generally a very close
approximation.

http://en.wikipedia.org/wiki/Sum_of_normally_distributed_random_variables

This page tells you how to calculate the sum of normally distributed
variables.

(Both of these websites are quite technical, I am sure there are many, many
simpler sites - they key concept is to convert to a normal distribution and
then calculate the sum of normally distributed variables - both very easy to
do, but not obvious unless you know the "trick").




scrivener

unread,
Jan 26, 2012, 5:53:25 AM1/26/12
to
On Tue, 24 Jan 2012 22:59:00 -0800 (PST), Ray Koopman <koo...@sfu.ca>
wrote:

>On Jan 24, 9:24 pm, scrivener <scrive...@mindspring.com> wrote:
>> If each trial with a binomial result has a probability of success of
>> 50%, the probability of succeeding 3 or more times in 5 trials is 50%
>> ... 6 or more times in 10 trials is .377 ... 30 or more times in 50
>> trials is .101, etc. So my binomial calculator tells me.
>>
>> How does one compute analogous probability for success on a scale?
>>
>> E.g., suppose in a random trial one picks a number in the top 33% of
>> a population (about a half standard deviation or more above average).
>> The probability of that is 33%.
>>
>> But how does one figure the probability of in, say, five independent
>> trials picking numbers that on average have a value in the top 33%?
>> (Not all being in the top 33%, that would be 0.33^5, but which average
>> being in the top 33%.) Or of in 10, 15, trials picking numbers that
>> have an average value in the top 33%?
>
>That's still ambiguous. You have several independent sample values
>from the same distribution. For each one you calculate its upper-tail
>p-value; that is, the probability of getting a value that big or
>bigger. Are you asking for the probability that the average of those
>p-values is < .33 ? Or are are you asking for the probability that
>the p-value of the average of the original sample values is < .33 ?

Thanks for the response.

Let me simplify to the example that actually got the discussion of
this going with a friend:

A random number generator produces numbers from 1 to 10. In five runs
it produces numbers in the range from 1 to 2, 1 to 3, 1 to 4, 1 to 5,
and 1 to 6. What is the probability of this happening?

Well, in sequence, the probability is .2 x .3 x .4 x .5 x .6 =0.0072.

But if the numbers can be produced in any sequence, what is the
probability? That is, what is the probability that in the next five
runs the generator will produce five numbers no larger than
2, 3, 4, 5, and 6 but in any sequence?

Way back in the last century I got top marks in a graduate school
statistics class. But in the couple decades since I haven't needed it
at all for work, and I am now a living cautionary example of how a
once functioning part of the brain, left unused long enough, can turn
to concrete. Be warned.

Thanks for your consideration.

scrivener

unread,
Jan 26, 2012, 6:05:27 AM1/26/12
to
Thanks for the response, but that's not the problem I'm dealing with.

I do have to get all this stuff back in my brain though, so I'll be
going through that.

Jussi Piitulainen

unread,
Jan 26, 2012, 7:39:11 AM1/26/12
to
scrivener writes:

> Let me simplify to the example that actually got the discussion of
> this going with a friend:
>
> A random number generator produces numbers from 1 to 10. In five
> runs it produces numbers in the range from 1 to 2, 1 to 3, 1 to 4, 1
> to 5, and 1 to 6. What is the probability of this happening?
>
> Well, in sequence, the probability is .2 x .3 x .4 x .5 x .6 =0.0072.
>
> But if the numbers can be produced in any sequence, what is the
> probability? That is, what is the probability that in the next five
> runs the generator will produce five numbers no larger than 2, 3, 4,
> 5, and 6 but in any sequence?

A brute force computation says that 4802 sequences out of the 100000
possible satisfy the condition.

Python 3 code, which lists the ordered sequences, then builds the set
(removing duplicates) of their permutations, prints the sizes of the
two sets, and as a sanity check also prints a sample of the sequences:

from itertools import product, permutations, chain
from functools import partial
import random

ospool = tuple(product(*map(partial(range, 1), range(3, 8))))
uspool = set(chain.from_iterable(map(permutations, ospool)))

print('# ordered:', len(ospool), '=', 2 * 3 * 4 * 5 * 6)
print('#shuffled:', len(uspool))

print(' ordered:', random.sample(ospool, 3))
print(' ordered:', random.sample(ospool, 3))
print(' ordered:', random.sample(ospool, 3))
print('shuffled:', random.sample(uspool, 3))
print('shuffled:', random.sample(uspool, 3))
print('shuffled:', random.sample(uspool, 3))

Sample output:

# ordered: 720 = 720
#shuffled: 4802
ordered: [(2, 1, 1, 3, 1), (2, 1, 2, 4, 2), (2, 3, 1, 3, 3)]
ordered: [(1, 3, 1, 4, 6), (2, 1, 1, 4, 1), (1, 2, 3, 1, 3)]
ordered: [(2, 3, 4, 1, 2), (1, 2, 1, 2, 1), (2, 3, 4, 3, 5)]
shuffled: [(3, 3, 1, 2, 1), (3, 3, 2, 4, 1), (4, 3, 6, 2, 2)]
shuffled: [(6, 2, 2, 4, 5), (4, 1, 2, 5, 3), (3, 5, 1, 2, 2)]
shuffled: [(1, 5, 3, 5, 4), (1, 3, 4, 3, 5), (5, 3, 2, 3, 5)]

danh...@yahoo.com

unread,
Jan 26, 2012, 10:11:14 AM1/26/12
to
On Jan 26, 5:53 am, scrivener <scrive...@mindspring.com> wrote:
> On Tue, 24 Jan 2012 22:59:00 -0800 (PST), Ray Koopman <koop...@sfu.ca>
I assume you mean that each of the numbers 1,2,...,10 occurs with
probability 0.1. Then the probability that a number no larger than 6
occurs is 0.6. For 5 independent trials to have all results no larger
than 6, the probability is 0.6^5 .

In general, the largest value in n trials is no larger than x if, and
only if, each trial results in a value no larger than x; that's all
there is to it.

Rich Ulrich

unread,
Jan 26, 2012, 2:36:07 PM1/26/12
to
You mean to say, you drew, in order, 2,3,4,5,6?

Apparently the p is "1.0" for your RNG with its given seed, if
it is a common sort of computer algorithm. But in the long run,
every possible sequence is supposed to appear, of it is not
a faulty RNG. For an early RNG that I used, documentation
recommended picking a seed that was odd, and 7 digits, in
order to avoid some known "bad behavior."

>
>Well, in sequence, the probability is .2 x .3 x .4 x .5 x .6 =0.0072.

I suspect you have over-simplified your example.

As I read this, you have observed, in order, 23456.
And now you hypothesize, for testing the PRNG, that
the next values also will be less than 6, assuming that
the "problem" may be a bias toward being small. Would
that have been your hypothesis if the numbers had been
in a different order?

Sequential dependence is one of the best-known bugaboos
of programmed pseudo random number generators. Why not
hypothesze that the next value will be 7?

"What generates it?" -- is the best guide that I have for
figuring out what a distribution is apt to look like.

Your huge problem is that you haven't justified your hypothesis,
and that there are dozens or thousands of alternatives that
are equally as test-worthy. Or millions. Or you have other
information about the generator.

>
>But if the numbers can be produced in any sequence, what is the
>probability? That is, what is the probability that in the next five
>runs the generator will produce five numbers no larger than
>2, 3, 4, 5, and 6 but in any sequence?

So you are guessing, based on 5 unduplicated draws, that
there is a bias for magnitude of the number... no, that only
"1" is potentially untapped as available for the RNG?


>
>Way back in the last century I got top marks in a graduate school
>statistics class. But in the couple decades since I haven't needed it
>at all for work, and I am now a living cautionary example of how a
>once functioning part of the brain, left unused long enough, can turn
>to concrete. Be warned.
>
>Thanks for your consideration.
>
>>>
>>> I've looked around for the answer and as this seems a rather basic
>>> question have been surprised not to find it. Or maybe I'm just too
>>> innumerate to recognize it when I see it.
>>>
>>> Thanks in advance to anyone who straightens me out on this.
>>>
>>> Also thanks to anyone who can point me to a good web site that
>>> discusses this particular issue and related ones on a basic level.

If you are interested in testing RNGs, that is what to look for.

If you are looking for exact probabilities, that is a different topic.

--
Rich Ulrich

Frederick Williams

unread,
Jan 27, 2012, 11:56:03 AM1/27/12
to
Rich Ulrich wrote:

>On Jan 24, 9:24 pm, scrivener <scrive...@mindspring.com> wrote:
> >
> >A random number generator produces numbers from 1 to 10. In five runs
> >it produces numbers in the range from 1 to 2, 1 to 3, 1 to 4, 1 to 5,
> >and 1 to 6. What is the probability of this happening?
>
> You mean to say, you drew, in order, 2,3,4,5,6?

Shirley not. Rather

One of 1,2; followed by one of 1,2,3; followed by one of 1,2,3,4; etc.

--
When a true genius appears in the world, you may know him by
this sign, that the dunces are all in confederacy against him.
Jonathan Swift: Thoughts on Various Subjects, Moral and Diverting

Rich Ulrich

unread,
Jan 27, 2012, 2:02:29 PM1/27/12
to
On Fri, 27 Jan 2012 16:56:03 +0000, Frederick Williams
<freddyw...@btinternet.com> wrote:

>Rich Ulrich wrote:
>
>>On Jan 24, 9:24 pm, scrivener <scrive...@mindspring.com> wrote:
>> >
>> >A random number generator produces numbers from 1 to 10. In five runs
>> >it produces numbers in the range from 1 to 2, 1 to 3, 1 to 4, 1 to 5,
>> >and 1 to 6. What is the probability of this happening?
>>
>> You mean to say, you drew, in order, 2,3,4,5,6?
>
>Shirley not. Rather
>
>One of 1,2; followed by one of 1,2,3; followed by one of 1,2,3,4; etc.

Okay, that might be.

As I read it now, he does not say how many numbers
there were in any given draw - "produces numbers in the
range from ...."

Hard example, if the RNG produced 100 values of 1 and
2 in the first trial, that result by itself would mandate
reprogramming.

--
Rich Ulrich

Jussi Piitulainen

unread,
Jan 28, 2012, 3:11:39 AM1/28/12
to
Rich Ulrich writes:
> On Fri, 27 Jan 2012 16:56:03 +0000, Frederick Williams wrote:
> > Rich Ulrich wrote:
> >> On Jan 24, 9:24 pm, scrivener wrote:
> >> >
> >> > A random number generator produces numbers from 1 to 10. In
> >> > five runs it produces numbers in the range from 1 to 2, 1 to 3,
> >> > 1 to 4, 1 to 5, and 1 to 6. What is the probability of this
> >> > happening?

Then scrivener added this:

> >> > Well, in sequence, the probability is .2 x .3 x .4 x .5 x .6 =
> >> > 0.0072.

It's a clue.

> >> You mean to say, you drew, in order, 2,3,4,5,6?
> >
> > Shirley not. Rather
> >
> > One of 1,2; followed by one of 1,2,3; followed by one of 1,2,3,4;
> > etc.
>
> Okay, that might be.
>
> As I read it now, he does not say how many numbers there were in any
> given draw - "produces numbers in the range from ...."

That's a statement about the generator: in every draw it produces one
of the numbers 1, 2, ..., 10, presumably with uniform frequencies in
the long run and difficult to predict from the previous numbers (that
is, with the appearance of independence).

The assignment of the probability (.2)(.3)(.4)(.5)(.6) makes sense if
scrivener drew one number which happened to be at most 2, followed by
one number which happened to be at most 3, ..., followed by one number
which happened to be at most 6, assuming independence and uniform
distribution. A sequence of five numbers.

Jussi Piitulainen

unread,
Jan 28, 2012, 4:02:22 AM1/28/12
to
scrivener writes:

> Let me simplify to the example that actually got the discussion of
> this going with a friend:
>
> A random number generator produces numbers from 1 to 10. In five
> runs it produces numbers in the range from 1 to 2, 1 to 3, 1 to 4, 1
> to 5, and 1 to 6. What is the probability of this happening?
>
> Well, in sequence, the probability is .2 x .3 x .4 x .5 x .6 =0.0072.
>
> But if the numbers can be produced in any sequence, what is the
> probability? That is, what is the probability that in the next five
> runs the generator will produce five numbers no larger than 2, 3, 4,
> 5, and 6 but in any sequence?

My previous contribution was a computation to generate and count all
distinct sequences that matched my reading of the problem: 4802 out of
10000, for an exact probability assignment, 0.04802.

Let me now add a different computation: a simulation to generate and
test a large number of such sequences (large number = 10000). Still in
Python3. (Integer division is different, so at least this time the
version number is relevant.)

Three successive runs produce these relative frequencies of success:
0.0465, 0.0496, 0.0451. It took me seven more runs to get 0.0481, but
the three seem to me to agree well with my exact result. (It's
cheating to keep repeating the test until I get the desired result.)

The Code:

import random
from operator import lt as lessthan

bag = range(1, 11)
successes = 0
trials = 0
for trials in range(1, 10001):
five = sorted(random.choice(bag) for _ in range(5))
if all(map(lessthan, sorted(five), range(3,8))):
successes += 1
print(successes / trials)

Jasen Betts

unread,
Jan 30, 2012, 7:04:39 AM1/30/12
to
On 2012-01-25, scrivener <scri...@mindspring.com> wrote:

it seem that that the ways to fail are easer to define than the ways
to succeed.

for the 6 of 10 example given to fail you need

1 draw above 6
or 2 draws above 5
or 3 draws above 4
or 4 draws above 3
or 5 draws above 2
or 6 draws above 1

or something like that.



--
⚂⚃ 100% natural
0 new messages