PGA Travelers Championship - 4th Rd: How many BIRDIES will Sungjae Im AND Shane Lowry record on Holes 1-4?
Inputs to Solve
##### User Estimates #####
p_bird = [72/378, 123/378, 77/378, 45/378]
count = 1
for p in p_bird:
print("The probability that a golfer BIRDIES hole " + str(count) + " is %s" % round(p,3))
count +=1
The probability that a golfer BIRDIES hole 1 is 0.19
The probability that a golfer BIRDIES hole 2 is 0.325
The probability that a golfer BIRDIES hole 3 is 0.204
The probability that a golfer BIRDIES hole 4 is 0.119
## Inputs Defined in the Problem
total_birdies = 1
holes = ['Im_1','Lowry_1','Im_2','Lowry_2','Im_3','Lowry_3','Im_4','Lowry_4']
Method to Solve
- [1] Enumerate all the possible combinations BIRDIES and NON-BIRDIES being scored on holes 1-4 for 2 golfers (2^8 combinations).
- [2] The probability that 0 or 1 BIRDIE is recorded by Sungjae Im AND Shane Lowry record on Holes 1-4 is the sum of the probabilities for all the outcomes where the total number of BIRDIES is exactly equal to 0 or 1 (p_0or1).
## [1]
import numpy as np
import pandas as pd
outcomes = (1,0)
y = np.array([(a,b,c,d,e,f,g,h) for a in outcomes for b in outcomes for c in outcomes
for d in outcomes for e in outcomes for f in outcomes for g in outcomes
for h in outcomes])
birdies = pd.DataFrame(y)
birdies.columns = holes
birdies['total_birdies'] = birdies.sum(axis=1)
x = np.array([(a,b,c,d,e,f,g,h) for a in (p_bird[0],1-p_bird[0]) for b in (p_bird[0],1-p_bird[0])
for c in (p_bird[1],1-p_bird[1]) for d in (p_bird[1],1-p_bird[1])
for e in (p_bird[2],1-p_bird[2]) for f in (p_bird[2],1-p_bird[2])
for g in (p_bird[3],1-p_bird[3]) for h in (p_bird[3],1-p_bird[3])])
probability = pd.DataFrame(x)
probability.columns = holes
probability['p'] = probability.product(axis=1)
birdies
Im_1 | Lowry_1 | Im_2 | Lowry_2 | Im_3 | Lowry_3 | Im_4 | Lowry_4 | total_birdies | |
---|---|---|---|---|---|---|---|---|---|
0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 8 |
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 7 |
2 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 7 |
3 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 6 |
4 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 7 |
… | … | … | … | … | … | … | … | … | … |
251 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 |
252 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 2 |
253 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 |
254 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |
255 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
256 rows × 9 columns
probability
Im_1 | Lowry_1 | Im_2 | Lowry_2 | Im_3 | Lowry_3 | Im_4 | Lowry_4 | p | |
---|---|---|---|---|---|---|---|---|---|
0 | 0.190476 | 0.190476 | 0.325397 | 0.325397 | 0.203704 | 0.203704 | 0.119048 | 0.119048 | 0.000002 |
1 | 0.190476 | 0.190476 | 0.325397 | 0.325397 | 0.203704 | 0.203704 | 0.119048 | 0.880952 | 0.000017 |
2 | 0.190476 | 0.190476 | 0.325397 | 0.325397 | 0.203704 | 0.203704 | 0.880952 | 0.119048 | 0.000017 |
3 | 0.190476 | 0.190476 | 0.325397 | 0.325397 | 0.203704 | 0.203704 | 0.880952 | 0.880952 | 0.000124 |
4 | 0.190476 | 0.190476 | 0.325397 | 0.325397 | 0.203704 | 0.796296 | 0.119048 | 0.119048 | 0.000009 |
… | … | … | … | … | … | … | … | … | … |
251 | 0.809524 | 0.809524 | 0.674603 | 0.674603 | 0.796296 | 0.203704 | 0.880952 | 0.880952 | 0.037543 |
252 | 0.809524 | 0.809524 | 0.674603 | 0.674603 | 0.796296 | 0.796296 | 0.119048 | 0.119048 | 0.002680 |
253 | 0.809524 | 0.809524 | 0.674603 | 0.674603 | 0.796296 | 0.796296 | 0.119048 | 0.880952 | 0.019833 |
254 | 0.809524 | 0.809524 | 0.674603 | 0.674603 | 0.796296 | 0.796296 | 0.880952 | 0.119048 | 0.019833 |
255 | 0.809524 | 0.809524 | 0.674603 | 0.674603 | 0.796296 | 0.796296 | 0.880952 | 0.880952 | 0.146761 |
256 rows × 9 columns
## [2]
p_0or1 = probability['p'][birdies['total_birdies']<=total_birdies].sum()
Solution
print("The probability that Sungjae Im AND Shane Lowry record 0 or 1 BIRDIES on Holes 1-4 is ~ %s" % round(p_0or1,3))
The probability that Sungjae Im AND Shane Lowry record 0 or 1 BIRDIES on Holes 1-4 is ~ 0.472
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 6/28/2020