Binomial Distribution

Alex Egg,

Basketball free throw contest. I can make two bets:

Which bet would maximize my odds of winning and why?

import numpy as np
from scipy.special import comb
%pylab inline
Populating the interactive namespace from numpy and matplotlib

Binomial Distribution

Shooting a sequence of free throws can be modeled by a binomial distribution. Below we define the probability mass function for the binomial distribution (also available in scipy.stats.binom.pmf):

PMF=lambda p,n,k: comb(n,k) * p**k*(1-p)**(n-k)
#making at least 5 out of 8
five_out_of_eight = lambda p: PMF(p,8,5)+PMF(p,8,6)+PMF(p,8,7)+PMF(p,8,8)

#making at least 2 out of 3
two_out_of_three = lambda p: PMF(p,3,2)+PMF(p,3,3)
#free throw percentages 0-1 in .1 increments
single_shot_probs=np.arange(0,1.1, .1)
for p in single_shot_probs:
plt.plot(single_shot_probs, _2_3, label="2/3")
plt.plot(single_shot_probs, _5_8, label="5/8")
plt.legend(loc='lower right')
<matplotlib.legend.Legend at 0x10cf54c10>


The answer: It depends how good you are. If your average free throw percentage is <.7 then you should take the 2/3 bet. However, if your free throw percentage is > .7 then you should take the 5/8 bet. But either way, iregardless of your skill level, 2/3 is most safe bet.

Permalink: binomial-distribution


Last edited by Alex Egg, 2017-03-25 15:26:53
View Revision History