Post Reply 
little problem(s) 2022.09
09-26-2022, 07:09 PM
Post: #1
little problem(s) 2022.09
#1
Given a not fair coin, where heads shows up 60% of the time, and 50 coin tosses , what is the probability to get at least 5 tails in a row ? What about "exactly 5" ?

#2
Practically generalize #1.

Given a probability P of success (getting tails, heads or what have you) and N repetitions, what is the probability that we get a streak of at least S successes in N repetitions?


Of course approximations based on programs are welcomed.

Wikis are great, Contribute :)
Find all posts by this user
Quote this message in a reply
09-27-2022, 08:10 PM (This post was last modified: 09-27-2022 08:18 PM by ijabbott.)
Post: #2
RE: little problem(s) 2022.09
Using a bit of educated guesswork for #2 ...
  • Probability of S successes in a run of S trials = \(P^S\)
  • ∴ Probability of less than S successes in a run of S trials = \(1-P^S\)
  • Number of (overlapping) runs of S in N = \(\begin{cases} N-S+1 & S<=N \\
    0 & S>N \end{cases}\)
  • ∴ Probability of no run of S consecutive successes in a run of N trials = \(\begin{cases} \frac{1-P^S}{N-S+1} & S<=N \\
    1 & S>N \end{cases}\)
  • ∴ Probability of at least one run of S consecutive successes in a run of N trials = \(\begin{cases} 1-\frac{1-P^S}{N-S+1} & S<=N \\
    0 & S>N \end{cases}\)

To determine the probability of a run of exactly S successes in a run of N trials, determine the probability of a run of at least S+1 consecutive successes in a run of N trials and subtract from the probability of a run of at least S consecutive successes in a run of N trials.

— Ian Abbott
Find all posts by this user
Quote this message in a reply
09-27-2022, 09:03 PM
Post: #3
RE: little problem(s) 2022.09
(09-27-2022 08:10 PM)ijabbott Wrote:  Probability of no run of S consecutive successes in a run of N trials = \(\begin{cases} \frac{1-P^S}{N-S+1} & S<=N \\
1 & S>N \end{cases}\)
Shouldn't that be \((1-P^S)^{N-S-1}\)?
Find all posts by this user
Quote this message in a reply
09-28-2022, 01:55 PM
Post: #4
RE: little problem(s) 2022.09
Recursive formula for obtaining k consecutive heads from n coin tosses

50 coin tosses, runs of 5 tails or more. Probability of tails = 1 - 0.6 = 0.4

>>> k, N = 5, 50
>>> p, P = 0.4, [0]*(N+1)
>>> P[k] = p**k
>>> for n in range(k+1,N+1): P[n] = P[n-1] + (1-P[n-k-1])*(1-p)*p**k
...
>>> P[N]
0.25645932207797717

Confirmed by simulations:

>>> from random import random
>>> pat = lambda: ''.join("HT"[random()<=p] for x in range(N))
>>> sum('TTTTT' in pat() for i in range(10**6))
256541

Real life is clumpy
The inherent clumpiness of randomness
The Longest Run of Heads - Mark F. Schilling
Find all posts by this user
Quote this message in a reply
09-29-2022, 07:39 AM
Post: #5
RE: little problem(s) 2022.09
(09-27-2022 09:03 PM)David Hayden Wrote:  
(09-27-2022 08:10 PM)ijabbott Wrote:  Probability of no run of S consecutive successes in a run of N trials = \(\begin{cases} \frac{1-P^S}{N-S+1} & S<=N \\
1 & S>N \end{cases}\)
Shouldn't that be \((1-P^S)^{N-S-1}\)?

You are probably correct about it being an exponential, but if so it would be \((1-P^S)^{N-S+1}\), otherwise the \(N=S\) case would be wrong.

I'm not sure if the \(N-S+1\) sets of \(S\) can be treated as independent events. They overlap, but their constituent parts are random, so I am thinking that the overlap does not matter.

It is possible to work out exact probabilities for given values of N, S and P by other means to see if the formula works. I don't have time to do that right now.

— Ian Abbott
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)