2
$\begingroup$

The problem is from the book "Think stats". It's formulated as follows:

If there are 10 players in a basketball game and each one takes 15 shots during the course of the game, and each shot has a 50% probability of going in, what is the probability that you will see, in a given game, at least one player who hits 10 shots in a row? If you watch a session of 82 games, what are the chances you weill see at least one streak of 10 hits or misses?

My solution:

  1. Calculate the probability of a streak for a player in a game. The probability of a streak is the sum of probabilities of striking 10, 11, 12, 13, 14 or 15 hits out of 15 trials. If B(k, n, p) is the PMF of the binomial distribution (n- trials, k - successes, p - success probability) and equals the probability of exactly k success trials out of n total trials with each trial having p probability then

    P(S) = B(10) + B(11) + B(12) + B(13) + B(14) + B(15)

  2. Calculate the probability of at least one streak in a game If there are 10 players and each attempts to make a streak, the probability of at least one streak is P(G)=P(S)*10

  3. Calculate the probability of at least one streak over the course of 82 games: P(TOTAL)=P(G)*82

I wrote a bit of python code to calculate that:

import math

games = 82
players = 10
shots = 15
shot_chance = 0.5
streak_size = 10

def binomial(n, k, p):
    binomial_coefficient = math.factorial(n)/ ( math.factorial(k)*math.factorial(n-k) )
    return binomial_coefficient * math.pow(p, k) * math.pow((1 - p), n-k)

#Chance that a player will make a streak
def streak_prob(shots, streak_size, shot_chance):
    return sum([binomial(shots, x, shot_chance) for x in range(streak_size, shots+1)])

probability_of_streak_in_a_game = streak_prob(shots, streak_size, shot_chance)*players
probability_of_streak_on_multiple_games = probability_of_streak_in_a_game*games
print(probability_of_streak_in_a_game, probability_of_streak_on_multiple_games)

But the output gives me: 1.5087890625 123.720703125 What's wrong with my reasoning? I suspect it's the point 1 where I calculate the probability of a streak, but I am confused. Could you guide me?

$\endgroup$

2 Answers 2

3
$\begingroup$

Cool problem!

I think the first issue is that just because you make 10 shots doesn't mean you make 10 in a row, though that would be true for 15 if you only shoot 15!

For example, $$P(ten-in-a-row|10-makes) = \frac{6}{15\choose{10}} =\frac{6}{3003}=\frac{2}{1001}$$ There are 15 choose 10 ways to make 10 out of 15 baskets, but only 6 of those (0 to five misses prior to the streak) have a streak of 10.

So each of your B's (other than 15) should be multiplied by some factor such as that above.

The second issue is that the odds of at least one player getting a streak in any given game is $pgame=1-(1-p)^{10}$ not 10p, where p is the odds of any given player. The odds that none of n players make a streak are $(1-p)^n$. Though for small p, np can be a pretty good approximation!

Similarly for 82 games, the odds are $1-(1-pgame)^{82}$

$\endgroup$
6
  • $\begingroup$ Thanks! Can negative binomial be used to calculate the probability of a streak? $\endgroup$
    – Euphe
    May 23, 2016 at 21:41
  • $\begingroup$ I don't understand the example though. That is conditional probability of ten in a row given "10-makes". What does "10-makes" mean? I don't really understand why 6 is divided by 15 choose 10. $\endgroup$
    – Euphe
    May 23, 2016 at 22:33
  • 1
    $\begingroup$ Ha ha, MikeP showed you the easy term (exactly 10 baskets made). The others are trickier to compute. If you wait a while, I'll show you 3 rather different methods which all produce the same (correct) result. $\endgroup$ May 23, 2016 at 22:45
  • 1
    $\begingroup$ My answer, promised in the preceding comment, has now been posted. $\endgroup$ May 24, 2016 at 1:28
  • $\begingroup$ "10-makes" means that the player made 10 of his 15 attempts. There are 6 ways to make 10 in a row out of 15, and there are 15 choose 10 ways to make 10 shots out of 15. P.S. I do like @Mark L. Stone's Markov chain method - as I can see it's applicability to more complex problems! But I'll have to do some digging to understand it fully +1 to his answer! $\endgroup$
    – MikeP
    May 24, 2016 at 12:19
2
$\begingroup$

Here are three different solution methods for calculating the probability that a given player gets a streak of at least 10 baskets in a given game. I believe method C is the most straightforward and least error prone, so long as you can numerically evaluate matrix powers, which can readily be done in many computing environments. I will not discuss paragraphs 2. and 3. of the OP's question, since they are addressed in MikeP's answer. The bottom line is that there's a pretty damn good chance that there will be at least one streak of at least 10 baskets by at least one player during the 82 game long season (but this probability is less than one).

Method A: Condition on the number of baskets made, and use the law of total probability to find the probability of a streak of at least 10 baskets. This is the @MikeP method more or less.

$$P(\text{streak of at least 10}) = \sum_{k=10}^{15} P(\text{streak of at least 10|exactly k baskets made}) P(\text{exactly k baskets made})$$ First note that Probability of making exactly k baskets (not necessarily in a row) = ${15 \choose k} 0.5^{15}$. If the player makes exactly 10 baskets, then MikeP's fraction of ways of making 10 baskets which result in a streak of 10 baskets, times probability of making exactly 10 baskets, has a ${{15}\choose{10}}$ in the numerator and denominator which cancel out, resulting in a total of 6 ways, each having probability $0.5^{15}$ of occurring, for a total contribution to the above sum of $6 *.5^{15}$ But that is the easy term. For 11 baskets made, a streak of at least 10 can start on shot 1,2,3,4, or 5, and for each of these, there are ${5\choose 1}$ possibilities for where the other basket goes. For 12 baskets, a streak of at least 10 can start on shots 1,2,3, or 4, and for each of these, there are ${5 \choose 2}$ possibilities for where the other 2 baskets go, etc. So the number of possibilities, each with a probability of $0.5^{15}$ to get a streak of at least 10 = $$6 {5\choose0} + 5 {5\choose1} + 4 {5\choose2} + 3 {5\choose 3} + 4 {5\choose 4} + 5 {5\choose 5} = 112.$$ So $P(\text{streak of at least 10}) = 112 * .5^{15}$.

Method B: Condition on the shot at which streak of at least 10 starts. Then use the law of total probability to get the answer.

If the streak of at least 10 starts on shot 1, then anything goes on shots 11 through 15, for a total of $2^5 = 32$ possibilities, each having probability of occurrence of $.5^{15}.$

If the streak of at least 10 starts on shot 2, then shot 1 must have been a miss, but anything goes on shots 12 through 15, for a total of $2^4 = 16 $ possibilities, each having probability of occurrence of $.5^{15}.$

If the streak of at least 10 starts on shot 3, then shot 2 must have been a miss, but anything goes on shots 1 and 13 through 15, for a total of $2^4 = 16 $ possibilities, each having probability of occurrence of $.5^{15}.$

If the streak of at least 10 starts on shot 4, shot 3 must have been a miss, but anything goes for shots 1,2,14, and 15, for a total of $2^4 = 16$ possibilities, each having probability of occurrence of $.5^{15}$.

If the streak of at least 10 starts on shot 5, shot 4 must have been a miss, but anything goes for shots 1,2,3, and 15, for a total of $2^4 = 16$ possibilities, each having probability of occurrence of $.5^{15}$.

If the streak of at least 10 starts on shot 6, shot 5 must have been a miss, but anything goes for shots 1 through 4, for a total of $2^4 = 16$ possibilities, each having probability of occurrence of $.5^{15}$.

Adding these up, there are (32 + 5 * 16) = 112 possibilities, each having probability of occurrence of $.5^{15}$. So we have duplicated the result from method A.

Method C: Use Discrete Time Markov Chain. Note: This is much simpler in my opinion than the counting required in methods A and B, and all the more so for other problem variants (data input changes, such as probability of making a basket, length of streak, and number of shots)) for which the logic needs to be reworked, and may become more complicated, in order to correctly use those methods, but the Markov Chain approach is changed only in very straightforward ways.

Define a time-homogeneous Markov Chain with states 0, 1, ..., 10, where the state number is the current length of streak. Except that state 10 is special in that it is made an absorbing state, so that once the Markov Chain gets into state 10, it stays there. So state 10 really denotes that a streak of length at least 10 has occurred, even if that streak is not still in progress.

Each shot counts as one step of the Markov Chain. The Markov Chain is started in state 0 after 0 shots, and there are 15 steps until the end of the game. So letting $P_{\text{one step}}$ be the one step transition matrix of the Markov Chain, the probability of interest (a given player having streak of at least 10 in a given game) is equal to the state 0 (row) to state 10 (column) element of $P_{\text{one step}}^{15}$.

Here is $P_{\text{one step}}$, with states ordered from 0 to 10. For each state i, other than 10, there is a 0.5 probability of transitioning to state i+1 (occurs if make the basket), and 0.5 probability of transitioning to state 0 (occurs if miss). State 10 only transitions to state 10 by construction as an absorbing state (once a streak of at least 10 has occurred, that streak can not be taken away for the rest of the game).

0.5000   0.5000        0        0        0        0        0         0        0        0       0
0.5000        0   0.5000        0        0        0        0         0        0        0       0
0.5000        0        0   0.5000        0        0        0         0        0        0       0
0.5000        0        0        0   0.5000        0        0         0        0        0       0
0.5000        0        0        0        0   0.5000        0         0        0        0       0
0.5000        0        0        0        0        0   0.5000         0        0        0       0
0.5000        0        0        0        0        0        0    0.5000        0        0       0
0.5000        0        0        0        0        0        0         0   0.5000        0       0
0.5000        0        0        0        0        0        0         0        0   0.5000       0
0.5000        0        0        0        0        0        0         0        0        0  0.5000
     0        0        0        0        0        0        0         0        0        0  1.0000

Perform the calculation described above, and voila, the answer matches methods A and B.

$\endgroup$
3
  • $\begingroup$ Thanks! I spent all night trying different things to calculate that streak probability. To test I used small cases, for example with 3 total throws and 2 length streak. What surprised me in that case is that B(2,3,0.5) provides the right answer right away: 3/8. It doesn't feel logical because there are 3 ways to make 2 or more throws out of 3,but Binomial(2,3) should only account for probability of exactly 2 successful throws. Does Binomial provide probability for at least k successful trials out of n? I will test if it provides the right answer to the full problem soon $\endgroup$
    – Euphe
    May 24, 2016 at 12:28
  • $\begingroup$ Binomial(k=10,n=15) provides a completely different answer. I am also curious if this can be solved using negative binomial. Guess I will test it after I work through your solutions:) $\endgroup$
    – Euphe
    May 24, 2016 at 12:37
  • $\begingroup$ I have a question about method B: why are the probabilities of all possibilities 0.5^n? $\endgroup$
    – Euphe
    May 24, 2016 at 13:24

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.