0
$\begingroup$

There is a problem in DataCamp about computing the probability of winning an NBA series. Cavs and the Warriors are playing a seven game championship series. The first to win four games wins the series. They each have a 50-50 chance of winning each game. If the Cavs lose the first game, what is the probability that they win the series?

Here is how DataCamp computed the probability using Monte Carlo simulation:

B <- 10000
set.seed(1)
results<-replicate(B,{x<-sample(0:1,6,replace=T) # 0 when game is lost and 1 when won. 
sum(x)>=4})
mean(results)

Here is a different way they computed the probability using simple code:

# Assign a variable 'n' as the number of remaining games.
n<-6

# Assign a variable `outcomes` as a vector of possible game outcomes: 0 indicates a loss and 1 a win for the Cavs.
outcomes<-c(0,1)

# Assign a variable `l` to a list of all possible outcomes in all remaining games. Use the `rep` function on `list(outcomes)` to create list of length `n`.
l<-rep(list(outcomes),n)

# Create a data frame named 'possibilities' that contains all combinations of possible outcomes for the remaining games.
possibilities<-expand.grid(l) # My comment: note how this produces 64 combinations.

# Create a vector named 'results' that indicates whether each row in the data frame 'possibilities' contains enough wins for the Cavs to win the series.
rowSums(possibilities)
results<-rowSums(possibilities)>=4

# Calculate the proportion of 'results' in which the Cavs win the series. 
mean(results)

Question/Problem:

They both produce approximately the same probability of winning the series ~ 0.34. However, there seems to be a flaw in the the concept and the code design. For example, the code (sampling six times) allows for combinations such as the following:

G2   G3   G4   G5   G6   G7 rowSums
0    0    0    0    0    0      0   # Series over after G4 (Cavs lose). No need for game G5-G7.
0    0    0    0    1    0      1   # Series over after G4 (Cavs lose). Doubling counting!
0    0    0    0    0    1      1   # Double counting!

...
1    1    1    1    0    0      4   # No need for game G6 and G7.
1    1    1    1    0    1      5   # Double counting! This is the same as 1,1,1,1,0,0.
0    1    1    1    1    1      5   # No need for game G7.
1    1    1    1    1    1      6   # Series over after G5 (Cavs win). Double counting! 

> rowSums(possibilities)
 [1] 0 1 1 2 1 2 2 3 1 2 2 3 2 3 3 4 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 1 2 2 3 2 3 3 4 2 3 3 4 3 4 4 5 2 3 3 4 3 4 4 5 3 4 4 5 4 5 5 6

As you can see, these are never possible. After winning the first four of the remaining six games, no more games should be played. Similarly, after losing the first three games of the remaining six games, no more games should be played. So these combinations shouldn't be included in the computation of the probability of winning the series. There is double counting for some of the combinations.

Here is what I did to omit some of the combinations that are not possible in real life.

outcomes<-c(0,1)
l<-rep(list(outcomes),6)
possibilities<-expand.grid(l)
possibilities<-possibilities %>% mutate(rowsums=rowSums(possibilities)) %>% filter(rowsums<=4)

But then I am not able to omit the other unnecessary combinations. For example, I want to remove two of these three: (a) 1,0,0,0,0,0 (b) 1,0,0,0,0,1 (c) 1,0,0,0,1,1. This is because no more games will be played after losing three times in a row. And they are basically double counting.

There are too many conditions for me to be able to filter them individually. There has to be a more efficient and intuitive way to do this. Can someone provide me with some hints on how to solve this whole mess?

$\endgroup$
8
  • $\begingroup$ I see no double counting here. Could you clarify what you mean by this term? $\endgroup$
    – whuber
    Jul 10, 2021 at 12:47
  • $\begingroup$ @whuber For example, these three combinations are the same: (a) 1,0,0,0,0,0 (b) 1,0,0,0,0,1 (c) 1,0,0,0,1,1. Here, the series is over after 1,0,0,0 as cavs already lost one before. There is no need for game 6 and game 7. So the rest of these need to be removed ... $\endgroup$
    – Mango
    Jul 10, 2021 at 12:53
  • $\begingroup$ On the contrary, those combinations explicitly differ. You need to consider them all in order to account correctly for the probabilities; removing any of them from a probability calculation would be an error. You might find it helpful to think of a simpler problem, such as playing to win two out of three coin flips. Tabulate the eight outcomes and their probabilities. Another helpful way to approach this is to draw the probability tree. You are claiming that certain branches of the tree should be removed because they won't be reached. Looking at the tree might reveal the error. $\endgroup$
    – whuber
    Jul 10, 2021 at 12:55
  • $\begingroup$ @whuber But in the NBA, when a team wins 4 games, the series is over. So this is a bit different. Here the max number of games that can be played is 7. But the series is over when one team wins 4 games - now that can be 4 wins in 5 games or 4 wins in 4 games. $\endgroup$
    – Mango
    Jul 10, 2021 at 12:58
  • $\begingroup$ I'm afraid it's not different. This very question was first discussed in the 15th century (in the setting of a tennis match) and finally was resolved in the mid-17th century by Blaise Pascal and Pierre Fermat. One of them made exactly the same objection you make here. Research the "Problem of Points" for more information. $\endgroup$
    – whuber
    Jul 10, 2021 at 13:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.