0

Another question (Bernoulli trials required for k successes) asked how many Bernoulli trials with probability $p$ of success are expected before you get $k$ successes, which is given by: $$\mathbb{E}(X)=\frac{k}{p}$$ How does this answer change if those $k$ successes are required happen within a window of size $n$? To make it concrete, here are some sequences for $k=2, n=3$:

  • Success, failure, success $\to$ valid termination state
  • Success, failure, failure, success $\to$ need to keep going because the two successes are not within a window of $n=3$ trials
  • Success, failure, failure, success, success $\to$ valid termination state because the second and third successes are within a window of $n=3$ trials
Dan
  • 101

1 Answers1

0

If you are asking for the probability of getting k successes within n trials, it is best to illustrate through a $5$ set tennis match

eg for your winning a five set tennis match with probability p for winning a set, you need to win $3-0, 4-1\;\; or\;\; 5-2$

and the expected # of matches within the window of $5$ will be

$3\cdot\binom20q^0p^2\cdot p + 4\cdot\binom31q^1p^2\cdot p + 5\cdot\binom42q^2p^2\cdot p$

[Note the binomial coefficients and the appended p's to take into account that the last set has to be a winning set.]

If it goes beyond the window, you have failed, we can't compute the expectation that you have won within the window !


Answer after explanation of sliding window

In the first window of three,

  • win in $2$ steps with $Pr = p^2$
  • win in $3$ steps with $Pr = 2p^2q$

  • lose, but with last win with $Pr= q^2p$ from where $1/p$ steps needed to win by geometric distribution

  • lose window with $Pr = q^3+ 2q^2p\;$ and restart

Let E = expected number of games to win, then

$E = 2\cdot p^2 +3\cdot2p^2q +(1/p)(q^2p) + [(q^3+2q^2p)\cdot E]$

Simplify it out

  • That makes sense, but it doesn't quite answer the question because it's not easy to convert the probability of success within the window to an (exact) expected # of trials before success. You can use the approximation E[# of trials] = window size / P(success within window), but that doesn't take the sliding window into account, it just assumes that each window is totally independent. – Dan Dec 02 '22 at 16:24
  • @Dan: To be precise, what I computed was an exact figure for E(# of matches played | you won within the window). How can the expectation be computed if you have failed (not won within the window) ? – true blue anil Dec 02 '22 at 19:17
  • The window is sliding — you keep doing more trials until you hit a termination state. – Dan Dec 03 '22 at 20:41
  • @Dan: What is the sliding window mechanism ? Does one slot open after every turn ? Or does a window of size n open after you have failed in the first n ? Exact mechanism needs to be told. – true blue anil Dec 04 '22 at 07:56
  • Yes, you keep doing a trial one turn at a time until you hit the termination condition. I added one more example case above where there is a valid termination with 5 trials. – Dan Dec 05 '22 at 16:32