PGA Rocket Mortgage Classic - 2nd Rd: Which PLAYER will record a LOWER FRONT 9 SCORE?
1:00PM
Rickie Fowler (USA)
Webb Simpson (USA) or Tie
Inputs to Solve
##### User Estimates #####
##### User Estimates #####
hole_1 = {'2':38,
'3':311,
'4':98,
'5':5}
hole_2 = {'3':62,
'4':290,
'5':89,
'6':11}
hole_3 = {'3':52,
'4':310,
'5':84,
'6':6}
hole_4 = {'2':72,
'3':301,
'4':70,
'5':10}
hole_5 = {'3':72,
'4':300,
'5':75,
'6':6}
hole_6 = {'3':68,
'4':312,
'5':65,
'6':5}
hole_7 = {'3':60,
'4':334,
'5':56,
'6':3,
'7':1}
hole_8 = {'2':76,
'3':317,
'4':56,
'5':3}
hole_9 = {'3':94,
'4':301,
'5':57,
'6':1}
## Inputs Defined in the Problem
stroke_diff = 0
golfers = ['h1','h2','h3','h4',
'h5','h6','h7','h8','h9']
Method to Solve
- [1] Enumrate all the possible combinations of observed scores and their respective probabilities on holes 1-9.
- [2] Compute the combined probability of each score for each golfer.
- [3] The probability Fowler has a lower score on the FRONT 9 (p_rf) is the sum of the probabilities where Fowler’s score is lower than Simpson’s.
## [1]
import numpy as np
import pandas as pd
t=sum(hole_1.values())
for i in hole_1:
hole_1[i] = hole_1[i]/t
t=sum(hole_2.values())
for i in hole_2:
hole_2[i] = hole_2[i]/t
t=sum(hole_3.values())
for i in hole_3:
hole_3[i] = hole_3[i]/t
t=sum(hole_4.values())
for i in hole_4:
hole_4[i] = hole_4[i]/t
t=sum(hole_5.values())
for i in hole_5:
hole_5[i] = hole_5[i]/t
t=sum(hole_6.values())
for i in hole_6:
hole_6[i] = hole_6[i]/t
t=sum(hole_7.values())
for i in hole_7:
hole_7[i] = hole_7[i]/t
t=sum(hole_8.values())
for i in hole_8:
hole_8[i] = hole_8[i]/t
t=sum(hole_9.values())
for i in hole_9:
hole_9[i] = hole_9[i]/t
y = np.array([(a,b,c,d,e,f,g,h,i) for a in hole_1.keys() for b in hole_2.keys() for c in hole_3.keys()
for d in hole_4.keys() for e in hole_5.keys() for f in hole_6.keys()
for g in hole_7.keys() for h in hole_8.keys() for i in hole_9.keys()])
scores = pd.DataFrame(y)
scores.columns = golfers
scores = scores.apply(pd.to_numeric)
scores['total_strokes'] = scores.sum(axis=1)
z = np.array([(a,b,c,d,e,f,g,h,i) for a in hole_1.values() for b in hole_2.values() for c in hole_3.values()
for d in hole_4.values() for e in hole_5.values() for f in hole_6.values()
for g in hole_7.values() for h in hole_8.values() for i in hole_9.values()])
probability = pd.DataFrame(z)
probability.columns = golfers
probability['p'] = probability.product(axis=1)
p_total_scores =[]
total_scores=[]
for s in set(scores['total_strokes']):
p_total_scores.append(probability['p'][scores['total_strokes']==s].sum())
total_scores.append(s)
## [2]
golfers = ['Fowler','Simpson']
y = np.array([(a,b) for a in total_scores for b in total_scores])
Scores = pd.DataFrame(y)
Scores.columns = golfers
Scores['rf_less'] = Scores['Fowler'] < Scores['Simpson']
x = np.array([(a,b) for a in p_total_scores for b in p_total_scores])
probability = pd.DataFrame(x)
probability.columns = golfers
probability['p'] = probability.product(axis=1)
Scores
Fowler | Simpson | rf_less | |
---|---|---|---|
0 | 24 | 24 | False |
1 | 24 | 25 | True |
2 | 24 | 26 | True |
3 | 24 | 27 | True |
4 | 24 | 28 | True |
… | … | … | … |
836 | 52 | 48 | False |
837 | 52 | 49 | False |
838 | 52 | 50 | False |
839 | 52 | 51 | False |
840 | 52 | 52 | False |
841 rows × 3 columns
probability
Fowler | Simpson | p | |
---|---|---|---|
0 | 2.335224e-08 | 2.335224e-08 | 5.453270e-16 |
1 | 2.335224e-08 | 1.043809e-06 | 2.437529e-14 |
2 | 2.335224e-08 | 2.079257e-05 | 4.855530e-13 |
3 | 2.335224e-08 | 2.436024e-04 | 5.688661e-12 |
4 | 2.335224e-08 | 1.865029e-03 | 4.355259e-11 |
… | … | … | … |
836 | 3.746621e-19 | 4.132001e-12 | 1.548104e-30 |
837 | 3.746621e-19 | 1.506271e-13 | 5.643427e-32 |
838 | 3.746621e-19 | 3.789691e-15 | 1.419854e-33 |
839 | 3.746621e-19 | 5.726994e-17 | 2.145687e-35 |
840 | 3.746621e-19 | 3.746621e-19 | 1.403717e-37 |
841 rows × 3 columns
## [3]
p_rf = probability['p'][Scores['rf_less']==True].sum()
Solution
print("The probability Fowler has a lower score on the FRONT 9 is ~ %s" % round(p_rf,3))
The probability Fowler has a lower score on the FRONT 9 is ~ 0.42
Info
download markdown file
email: krellabsinc@gmail.com
twitter: @KRELLabs
import sys
print(sys.version)
3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)]
Posted on 7/3/2020