The Open Championship 2019 - 3rd Rd: Which PLAYER will card a LOWER COMBINED SCORE on Holes 1-3?
10:50 AM
Shane Lowry (IRE) or Tie
JB Holmes (USA)
Inputs Needed to Solve
Royal Portrush Golf Club Course Stats
##### User Estimates #####
hole_1 = {'3':33,
'4':232,
'5':60,
'6':10,
'7':4}
hole_2 = {'3':4,
'4':124,
'5':178,
'6':23,
'7':6,
'8':1}
hole_3 = {'2':45,
'3':246,
'4':43,
'5':1}
print("The observed distribution of scores on hole 18 is: %s" % hole_1)
print("The observed distribution of scores on hole 18 is: %s" % hole_2)
print("The observed distribution of scores on hole 18 is: %s" % hole_3)
The observed distribution of scores on hole 18 is: {'3': 33, '5': 60, '4': 232, '7': 4, '6': 10}
The observed distribution of scores on hole 18 is: {'3': 4, '5': 178, '4': 124, '7': 6, '6': 23, '8': 1}
The observed distribution of scores on hole 18 is: {'3': 246, '2': 45, '5': 1, '4': 43}
## Inputs Defined in the Problem
stroke_diff = 0
golfers = ['hole1','hole2','hole3']
Method to Solve
- Enumerate all the possible combinations of score outcomes for 2 golfers on the three holes.
- Compute the probability that the golfers score the same (tie).
- The probability that Holmes is in the lead is (1 - p_of_a_tie)/2
import numpy as np
import pandas as pd
t=sum(hole_1.values())
for i in hole_1:
hole_1[i] = float(hole_1[i])/t
t=sum(hole_2.values())
for i in hole_2:
hole_2[i] = float(hole_2[i])/t
t=sum(hole_3.values())
for i in hole_3:
hole_3[i] = float(hole_3[i])/t
y = np.array([(w,x,z) for w in hole_1.keys() for x in hole_2.keys() for z in hole_3.keys()])
scores = pd.DataFrame(y)
scores.columns = golfers
scores = scores.convert_objects(convert_numeric=True)
scores['total_strokes'] = scores.sum(axis=1)
z = np.array([(w,x,y) for w in hole_1.values() for x in hole_2.values() for y in hole_3.values()])
probability = pd.DataFrame(z)
probability.columns = golfers
probability['p'] = probability.product(axis=1)
C:\Users\Krell\Anaconda2\lib\site-packages\ipykernel\__main__.py:19: FutureWarning: convert_objects is deprecated. Use the data-type specific converters pd.to_datetime, pd.to_timedelta and pd.to_numeric.
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)
golfers = ['lowry','holmes']
y = np.array([(x,z) for x in total_scores for z in total_scores])
Scores = pd.DataFrame(y)
Scores.columns = golfers
Scores['equal'] = Scores['lowry'] == Scores['holmes']
x = np.array([(y,z) for y in p_total_scores for z in p_total_scores])
probability = pd.DataFrame(x)
probability.columns = golfers
probability['p'] = probability.product(axis=1)
Scores.head()
lowry | holmes | equal | |
---|---|---|---|
0 | 8 | 8 | True |
1 | 8 | 9 | False |
2 | 8 | 10 | False |
3 | 8 | 11 | False |
4 | 8 | 12 | False |
probability.head()
lowry | holmes | p | |
---|---|---|---|
0 | 0.000156 | 0.000156 | 2.423290e-08 |
1 | 0.000156 | 0.006771 | 1.054058e-06 |
2 | 0.000156 | 0.073649 | 1.146488e-05 |
3 | 0.000156 | 0.288959 | 4.498196e-05 |
4 | 0.000156 | 0.379390 | 5.905935e-05 |
p_tie = round(probability['p'][Scores['equal']==True].sum(),3)
print("The probability that the players are tied after 3 holes is %s" % round(p,3))
The probability that the players are tied after 3 holes is 0.267
Solution
print("The proability that JB Holmes has a lower score after holes 1-3 is ~%s" % round((1-p_tie)/2,3))
The proability that JB Holmes has a lower score after holes 1-3 is ~0.366
Posted on 7/20/2019