12:35 PM
0 or 1
2 or More
Luis Castillo Strikeout per Out Rates
LC_KOut_Rate_2019 = float(144)/(123*3)
print("Luis Castillo's 2019 K per Out rate is ~%s" % round(LC_KOut_Rate_2019,3))
Luis Castillo's 2019 K per Out rate is ~0.39
K_ = 1
Method to Solve
- Enumerate all possible combinations of STRIKEOUTS (0,1,2,3*)
- The probability that 0 or 1 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 1.
*assume the probability of a dropped strike three is very small
import numpy as np
import pandas as pd
p_K_lc = LC_KOut_Rate_2019
p_no_K_lc = 1 - p_K_lc
prob_lc = (p_K_lc,p_no_K_lc)
K_grid = (1,0)
a = {}
y = np.array([(w,x,z) 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([(w,y,z) for w in prob_lc for y in prob_lc for z in prob_lc])
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
|
total_Ks
|
0
|
1
|
1
|
1
|
3
|
1
|
1
|
1
|
0
|
2
|
2
|
1
|
0
|
1
|
2
|
3
|
1
|
0
|
0
|
1
|
4
|
0
|
1
|
1
|
2
|
probability.head()
|
0
|
1
|
2
|
p
|
0
|
0.390244
|
0.390244
|
0.390244
|
0.059430
|
1
|
0.390244
|
0.390244
|
0.609756
|
0.092860
|
2
|
0.390244
|
0.609756
|
0.390244
|
0.092860
|
3
|
0.390244
|
0.609756
|
0.609756
|
0.145094
|
4
|
0.609756
|
0.390244
|
0.390244
|
0.092860
|
print("The number of possible STRIKEOUTS in Inning 1 and their respective probabilities are: %s" % a)
The number of possible STRIKEOUTS in Inning 1 and their respective probabilities are: {0: 0.23, 1: 0.44, 2: 0.28, 3: 0.06}
p = round(probability['p'][K['total_Ks']<=K_].sum(),3)
Solution
print("The probability that 0 or 1 STRIKEOUTS are recorded in Inning 1 by Luis Castillo is ~%s" % p)
The probability that 0 or 1 STRIKEOUTS are recorded in Inning 1 by Luis Castillo is ~0.662
Posted on 7/31/2019