PGA 3M Open - 1st Rd: How many of these players (D. Johnson, Finau, Fleetwood) will SHOOT UNDER-PAR on the FRONT 9?
Inputs to Solve
##### User Estimates #####
hole_1 = {'3':118,
'4':321,
'5':26,
'6':1}
hole_2 = {'3':59,
'4':285,
'5':87,
'6':26,
'7':9}
hole_3 = {'3':53,
'4':308,
'5':96,
'6':9}
hole_4 = {'2':1,
'3':104,
'4':315,
'5':41,
'6':5}
hole_5 = {'2':1,
'3':110,
'4':317,
'5':35,
'6':3}
hole_6 = {'3':8,
'4':213,
'5':212,
'6':28,
'7':5}
hole_7 = {'2':4,
'3':147,
'4':265,
'5':40,
'6':7,
'7':3}
hole_8 = {'1':1,
'2':78,
'3':322,
'4':58,
'5':7}
hole_9 = {'2':1,
'3':51,
'4':267,
'5':116,
'6':26}
## Inputs Defined in the Problem
front9_par = 4 + 4 + 4 + 3 + 4 + 5 + 4 + 3 + 4
golfers_underPAR = 1
holes = ['h1','h2','h3','h4',
'h5','h6','h7','h8','h9']
golfers = ['Johnson', 'Finau', 'Fleetwood']
Method to Solve
- [1] Enumrate all the possible combinations of observed scores and their respective probabilities on holes 1-9.
- [2] Compute the probability of any one golfer scoring UNDER PAR on the FRONT 9 (p_under).
- [3] Enumerate all the possible combinations of the 3 golfers scoring under par or not under par (2^3 outcomes) and their respective probabilties.
- [4] The probability that 0 or 1 golfer scores UNDER PAR on the FRNOT 9 is the sum of the probabilities of al the outcomes where 0 or 1 golfer score UNDER PAR (p_0or1).
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 = holes
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)
## [2]
p_under = probability['p'][scores['total_strokes']<=front9_par].sum()
print("The probability any gofler scores UNDER PAR on the FRNOT 9 is ~ %s" % round(p_under,3))
The probability any gofler scores UNDER PAR on the FRNOT 9 is ~ 0.509
## [3]
y = np.array([(a,b,c) for a in [0,1] for b in [0,1] for c in [0,1]])
par = pd.DataFrame(y)
par.columns = golfers
par = par.apply(pd.to_numeric)
par['total_under'] = par.sum(axis=1)
z = np.array([(a,b,c) for a in [1-p_under,p_under] for b in [1-p_under,p_under] for c in [1-p_under,p_under]])
probability = pd.DataFrame(z)
probability.columns = golfers
probability['p'] = probability.product(axis=1)
## [4]
p_0or1 = probability['p'][par['total_under']<=golfers_underPAR].sum()
Solution
print("The probability 0 or 1 golfer SCOERS UNDER PAR on the FRONT 9 is ~ %s" % round(p_0or1,3))
The probability 0 or 1 golfer SCOERS UNDER PAR on the FRONT 9 is ~ 0.487
Info
download markdown file
email: krellabsinc@gmail.com
twitter: @KRELLabs
import sys
print(sys.version)
3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)]
Posted on 7/23/2020