Consider a ‘best of 5’ series in sports/competition where the first team to win 3 games wins the series. So N=5, K=3. Where probability
w = p(team A winning game)
andl = p(team A losing game)
. Assume these probabilities do not change during the series.When I first thought about this I mistakenly tried adding the individual probabilities of winning 3/3, 3/4, and 3/5 games:
wrong = function(w) { p = dbinom(3,3,w) + dbinom(3,4,w) + dbinom(3,5,w) return(p) } wrong(.9) # 1.0935
Obviously, the issue is there is redundancy since 3 wins in a row, W-W-W renders any game 4 and 5 results obsolete. i.e. W-W-W-L-W and W-W-W-W-L aren’t possible.
After removing redundancies these are the possible permutations:
win = function(w) { l = 1-w p = w*w*w + w*w*l*w + w*l*w*w + l*w*w*w + l*l*w*w*w+ l*w*l*w*w+ l*w*w*l*w+ w*l*l*w*w+ w*l*w*l*w+ w*w*l*l*w return(p) } win(.9) # 0.99144 win(.9) + win(.1) # 1
Manually typing the permutations gets out of hand quickly with longer series i.e. winning a N = 7 game series, 9 game series, etc. Generally, how does
wrong()
function need to be modified to get the correct probability?
Answer
You can use the negative binomial distribution for this problem.
If X is distributed as NegBin(n, w), then X is the number of games the player loses before winning n of them, if the probability of winning any given game is w.
So, dnbinom(q = 2, size = 2, prob = w)
is the probability that the player loses a total of 2 games before winning 2.
Then, pnbinom(q = 2, size = 3, prob = w)
is the probability that the player loses 2 or less before they win 3 games. This is equal to the probability of winning a 3 out of 5 series.
In general, the probability of winning a best n-out-of-(2n-1) series can be calculated with pnbinom(q = n-1, size = n, prob = w)
.
## w is the probability of winning any individual game
## k is the number of wins needed to win the series (3 in a best 3 of 5 series)
win <- function(w, k){
return (pnbinom(q = k - 1, size = k, prob = w))
}
win(0.9, 3)
## 0.99144
Attribution
Source : Link , Question Author : Nitro , Answer Author : RyanFrost