1

I know the individual chance for an event with probability $X$ happening $Y$ times in a row is $X^Y$.
But what if I want to know how many times this event with probability $X$ will happen $Y$ times in a row over $Z$ number of attempts?

This is the algorithm

success_counter = 0
counter_Y = 0

loop Z { if (chance(X) === success) { success_counter++

  if (success_counter === Y) { // We succeeded Y times in a row
    counter_Y++ // We save this on a counter
    success_counter = 0 // We reset the success counter after we reach Y
  }
} else 
  success_counter = 0 // We reset the success counter on failure

}

If I convert that to python code and run it with these parameters:

  • $X = 92\%$
  • $Y = 10$
  • $Z = 1.000.000.000$

I get that it succeeded $Y=10$ times in a row a total of $61.443.862$ times, which is around $6.14\%$

But what I want to know is, can I calculate this for any case?
At first I thought of "running" it in batches of 10, but that's where my problem is. When you don't consider the number of attempts, then you make each result independent of each other, which in this case is wrong.

Kyuuri
  • 11
  • 1
    You should try to be more precise with your language. The probability that an event that has probability $X$ of occuring in one trial will happen $Y$ times in a row is $X^Y$. This is also assuming that trials are independent of each other. In any case the probability of a run of length $Y$ in $Z$ trials is nontrivial to calculate as runs of length $Y$ can overlap with each other, and thus we don't have independence, as you correctly pointed out. It is possible to get upper bounds, however. – Julius Jul 04 '23 at 10:43
  • Thank you for the review, you are right my language can be improved. I will edit the post now. I can't find a way to improve the title due to the character limit, I hope it's okay as it is now. Otherwise feel free to suggest a change and I will accept it. – Kyuuri Jul 04 '23 at 10:46
  • Question 3.7 in James Norris' Advanced Probability Problem Sheet suggests that the probability of a run of length $Y$ in $Z$ independent trials is at least $1-C\alpha^Z$, where $C < \infty$ and $\alpha \in (0,1)$ are constants which depend on $X$ and $Y$. – Julius Jul 04 '23 at 10:46
  • I kept googling and I think this is related to https://math.stackexchange.com/questions/2082969/probability-event-with-70-success-rate-occurs-three-consecutive-times-for-sam

    To be honest I don't have the technical knowledge to understand the answers (also english is not my main language which makes it harder) but I think it's the exact same question

    – Kyuuri Jul 04 '23 at 13:40

0 Answers0