Finding the average time with given probability

In summary: This is a problem with your code. If you play this game and ##p \leq \frac{1}{3}##, the game will end with probability one.
  • #1
KFC
488
4
Hi all,
I am thinking a problem of drawing a ball in a sealed box. Assuming there is a box, contains plenty red and white balls, the number of red and white balls are unknown but let's assume there will be ##p## chance to draw a red ball and ##q=1-p## chance to get a white one. Those probability is constant throughout the calculation. Let assume that at beginning we start the game by picking one ball out of the box, if it is a red one, there will be 3 more draws given; otherwise, game over.

For each draw out of 3, if you get a red ball, 3 more draws added other wise, use up one chance until all draws used up. I wonder if there is any way to estimate the maximum draws could be at the given ##p## and ##q##?

I can estimate the average draws to be about 3.01993 if #p=0.006659#. But how to find the maximum possible number of draws? I write a program to simulate this process for billions times and I see that in some game I could get up to 21 draws. Is it any way to compute this number in theory? Thanks.
 
Physics news on Phys.org
  • #2
KFC said:
But how to find the maximum possible number of draws?
There is no maximum possible. You could possibly draw a red ball each time.
 
Last edited:
  • #3
In your scenario there is no maximum on the number of draws.
You make things complicated. Easier: flip a coin many times. There is a nonzero probability for all heads, no matter how many times you flip.
 
  • #4
KFC said:
Hi all,
I am thinking a problem of drawing a ball in a sealed box. Assuming there is a box, contains plenty red and white balls, the number of red and white balls are unknown but let's assume there will be ##p## chance to draw a red ball and ##q=1-p## chance to get a white one. Those probability is constant throughout the calculation. Let assume that at beginning we start the game by picking one ball out of the box, if it is a red one, there will be 3 more draws given; otherwise, game over.

For each draw out of 3, if you get a red ball, 3 more draws added other wise, use up one chance until all draws used up. I wonder if there is any way to estimate the maximum draws could be at the given ##p## and ##q##?

I can estimate the average draws to be about 3.01993 if #p=0.006659#. But how to find the maximum possible number of draws? I write a program to simulate this process for billions times and I see that in some game I could get up to 21 draws. Is it any way to compute this number in theory? Thanks.

I think you are probably asking for a lot more than you think / want here.

For starters, either your specification of the problem, or your code seems to be buggy. It would also be prudent to explicitly state that you are sampling with replacement from the box, or instead, tossing a coin.

My understanding is that this can be interpreted as starting with a score of ##0##. If we get a white ball, our score has ##-1## added to it. If we get a red ball, the score is incremented by ##+2##. We stop whenever our score is ##=-1##.

If my understanding is correct, this maps to a simulation (and analytical result) that is markedly different than what you have stated for ##p=0.006659## -- i.e. it gets you ##\approx 1.0203842## draws on average until the game ends. This is the associated code:

Python:
import numpy as np
import numba
# in Python 3.x

@numba.jit(nopython= True)
def do_sim(p_red, n_trials):   
    total_counter = 0
    for trial in range(n_trials):
        local_counter = 0
        score = 0
        while score > -1:
            my_random_num = np.random.random()
            if my_random_num <= p_red:
                score += 2
            else:
                score -= 1
            local_counter += 1
        total_counter += local_counter
    return total_counter / n_trials

do_sim(p_red = 0.006659, n_trials = 10000000)
It's worth pointing out that if you play this game and ##p \leq \frac{1}{3}##, the game will end with probability one. If ##p \gt \frac{1}{3}## your stopping time is actually a defective random variable -- i.e. ##\infty## has positive probability.

In the case of ##p = \frac{1}{3}## the game ends with probability one, but the expected draws until ending ##= \infty##. For ##p \lt \frac{1}{3}##, you can use Wald's equality and recover that the expected draws until ending is ##\frac{1}{1-3p}##.

As mentioned by others, you can't put a hard bound on any finite natural number of draws. However, for ##p \lt \frac{1}{3}##, you can use tools like Markov's inequality to get a (loose) probabilistic bound on the number of draws.

Your problem actually seems to be a variant of a recent Riddler Classic puzzle going under the name of micro-organism multiplication. The solution is found here under the title "Solution to last week's riddler classic"

https://fivethirtyeight.com/features/can-you-rule-riddler-nation/
 

Related to Finding the average time with given probability

1. What is the meaning of "average time" in the context of probability?

The average time in this context refers to the expected or most likely amount of time it will take for an event to occur based on a given probability. It is a measure of central tendency and can help predict the likelihood of future events.

2. How is the average time calculated with a given probability?

The average time can be calculated by multiplying the probability of an event by the time it takes for that event to occur and summing the results for all possible outcomes. This is known as the expected value or mean.

3. Can the average time be used to accurately predict the exact time of an event?

No, the average time is a measure of central tendency and does not guarantee that the event will occur at that specific time. It is simply a statistical estimate based on the given probability.

4. How does the probability affect the average time?

The higher the probability of an event, the lower the average time will be. This is because a higher probability indicates a greater likelihood of the event occurring, resulting in a shorter expected time for the event to happen.

5. Are there any limitations to using average time with given probability?

Yes, there are limitations to using average time with given probability. It assumes that the event will occur at a constant rate and that all outcomes are equally likely. In real-life situations, this may not always be the case and can affect the accuracy of the average time calculation.

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
8
Views
153
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
3
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
13
Views
824
  • Set Theory, Logic, Probability, Statistics
Replies
3
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
927
  • Set Theory, Logic, Probability, Statistics
Replies
5
Views
894
  • Set Theory, Logic, Probability, Statistics
Replies
3
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
946
  • Set Theory, Logic, Probability, Statistics
Replies
15
Views
1K
Back
Top