2019 MLB All-Star Game: How many STRIKEOUTS will be recorded in the 8th Inning?
10:00PM
2 or Fewer
3 or More
Inputs To Solve
##### User Estimates #####
k_perct = 793/(90*9*3)
# use NYM total strike outs divided by total outs as an estimate for MLB
print("The probability of a PLAYER striking out when making an out is ~%s" % round(k_perct,3))
The probability of a PLAYER striking out when making an out is ~0.326
## Inputs Defined in the Problem
Ks = 2
Method to Solve
- Enumerate all the possible combinations of 0, 1, 2, 3, 4, 5 or 6 STRIKEOUTS being recorded in the 8th Inning
- The probability that 0, 1 or 2 STRIKEOUTS are recorded is the sum of the probabilities for all the outcomes where the total number of STRIKEOUTS is less than or equal to 2.
import numpy as np
import pandas as pd
p_noK = 1 - k_perct
prob = (k_perct,p_noK)
K_grid = (1,0)
a = {}
y = np.array([(t,u,v,w,x,z) for t in K_grid for u in K_grid for v in K_grid for w in K_grid for x in K_grid for z in K_grid])
K = pd.DataFrame(y)
K['total_Ks'] = K.sum(axis=1)
x = np.array([(t,u,v,w,y,z) for t in prob for u in prob for v in prob for w in prob for y in prob for z in prob])
probability = pd.DataFrame(x)
probability['p'] = probability.product(axis=1)
for i in set(K.total_Ks):
a[i] = round(probability['p'][K['total_Ks']==i].sum(),2)
K.head()
0 | 1 | 2 | 3 | 4 | 5 | total_Ks | |
---|---|---|---|---|---|---|---|
0 | 1 | 1 | 1 | 1 | 1 | 1 | 6 |
1 | 1 | 1 | 1 | 1 | 1 | 0 | 5 |
2 | 1 | 1 | 1 | 1 | 0 | 1 | 5 |
3 | 1 | 1 | 1 | 1 | 0 | 0 | 4 |
4 | 1 | 1 | 1 | 0 | 1 | 1 | 5 |
probability.head()
0 | 1 | 2 | 3 | 4 | 5 | p | |
---|---|---|---|---|---|---|---|
0 | 0.326337 | 0.326337 | 0.326337 | 0.326337 | 0.326337 | 0.326337 | 0.001208 |
1 | 0.326337 | 0.326337 | 0.326337 | 0.326337 | 0.326337 | 0.673663 | 0.002493 |
2 | 0.326337 | 0.326337 | 0.326337 | 0.326337 | 0.673663 | 0.326337 | 0.002493 |
3 | 0.326337 | 0.326337 | 0.326337 | 0.326337 | 0.673663 | 0.673663 | 0.005147 |
4 | 0.326337 | 0.326337 | 0.326337 | 0.673663 | 0.326337 | 0.326337 | 0.002493 |
print("The number of possible STRIKEOUTS in the 8th Inning and their respective probabilities are: %s" % a)
The number of possible STRIKEOUTS in the 8th Inning and their respective probabilities are: {0: 0.09, 1: 0.27, 2: 0.33, 3: 0.21, 4: 0.08, 5: 0.01, 6: 0.0}
p = round(probability['p'][K['total_Ks']<=Ks].sum(),3)
Solution
print("The probability that 2 or FEWER STRIKEOUTS are recorded in the 8th Inning is ~%s" % p)
The probability that 2 or FEWER STRIKEOUTS are recorded in the 8th Inning is ~0.694
Posted on 7/9/2019