PGA Tour Championship - 1st Rd (Atlanta, GA): How many BIRDIES will Rory McIlroy and John Rahm record on Holes 2-4?
2:00PM
2 or 3 Birdies
Any Other Number
Inputs To Solve
East Lake Golf Club 2018 Course Stats
##### User Estimates #####
p_bird_2 = 18/(18+84+18)
p_bird_3 = 29/(29+72+19)
p_bird_4 = 17/(17+74+27+2)
print("The probability of a PLAYER scoring BIRDIE on hole 2 is ~%s" % round(p_bird_2,3))
print("The probability of a PLAYER scoring BIRDIE on hole 3 is ~%s" % round(p_bird_3,3))
print("The probability of a PLAYER scoring BIRDIE on hole 4 is ~%s" % round(p_bird_4,3))
The probability of a PLAYER scoring BIRDIE on hole 2 is ~0.15
The probability of a PLAYER scoring BIRDIE on hole 3 is ~0.242
The probability of a PLAYER scoring BIRDIE on hole 4 is ~0.142
## Inputs Defined in the Problem
num_birdies = [2,3]
golfers = ['RM','JR']
Method to Solve
- [1] Compute the probability of 0, 1 or 2 Birdies being scored on each hole (2-4) by the 2 golfers
- [2] Enumerate all the possible combinations of 0, 1 or 2 BIRDIES being scored on holes 2-4 (birdies) and their respective probabilities (probability).
- [3] The probability that 2 or 3 total BIRDIES are scored by both golfers on holes 2-4 is the sum of the probabilities of all the outcomes where the total number of BIRDIES is equal to 2 or 3 (p_2or3).
## [1]
import numpy as np
import pandas as pd
# Hole 2
p_other = 1 - p_bird_2
prob = (p_bird_2,p_other)
bird = (1,0)
b = {}
y = np.array([(x,z) for x in bird for z in bird])
birdies = pd.DataFrame(y)
birdies.columns = golfers
birdies['total_birdies'] = birdies.sum(axis=1)
x = np.array([(x,z) for x in prob for z in prob])
probability = pd.DataFrame(x)
probability.columns = golfers
probability['p'] = probability.product(axis=1)
for i in set(birdies.total_birdies):
b[i] = round(probability['p'][birdies['total_birdies']==i].sum(),2)
# Hole 3
p_other = 1 - p_bird_3
prob = (p_bird_3,p_other)
bird = (1,0)
c = {}
y = np.array([(x,z) for x in bird for z in bird])
birdies = pd.DataFrame(y)
birdies.columns = golfers
birdies['total_birdies'] = birdies.sum(axis=1)
x = np.array([(x,z) for x in prob for z in prob])
probability = pd.DataFrame(x)
probability.columns = golfers
probability['p'] = probability.product(axis=1)
for i in set(birdies.total_birdies):
c[i] = round(probability['p'][birdies['total_birdies']==i].sum(),2)
# Hole 4
p_other = 1 - p_bird_4
prob = (p_bird_4,p_other)
bird = (1,0)
d = {}
y = np.array([(x,z) for x in bird for z in bird])
birdies = pd.DataFrame(y)
birdies.columns = golfers
birdies['total_birdies'] = birdies.sum(axis=1)
x = np.array([(x,z) for x in prob for z in prob])
probability = pd.DataFrame(x)
probability.columns = golfers
probability['p'] = probability.product(axis=1)
for i in set(birdies.total_birdies):
d[i] = round(probability['p'][birdies['total_birdies']==i].sum(),2)
print("The number of possible birdies on hole 2 for 3 golfers and their respective probabilities are: %s" % b)
print("The number of possible birdies on hole 3 for 3 golfers and their respective probabilities are: %s" % c)
print("The number of possible birdies on hole 4 for 3 golfers and their respective probabilities are: %s" % d)
The number of possible birdies on hole 2 for 3 golfers and their respective probabilities are: {0: 0.72, 1: 0.26, 2: 0.02}
The number of possible birdies on hole 3 for 3 golfers and their respective probabilities are: {0: 0.58, 1: 0.37, 2: 0.06}
The number of possible birdies on hole 4 for 3 golfers and their respective probabilities are: {0: 0.74, 1: 0.24, 2: 0.02}
## [2]
holes = ['2','3','4']
outcomes = (0,1,2)
y = np.array([(w,x,z) for w in outcomes for x in outcomes for z in outcomes])
birdies = pd.DataFrame(y)
birdies.columns = holes
birdies['total_birdies'] = birdies.sum(axis=1)
birdies.head()
2 | 3 | 4 | total_birdies | |
---|---|---|---|---|
0 | 0 | 0 | 0 | 0 |
1 | 0 | 0 | 1 | 1 |
2 | 0 | 0 | 2 | 2 |
3 | 0 | 1 | 0 | 1 |
4 | 0 | 1 | 1 | 2 |
x = np.array([(w,y,z) for w in b.values() for y in c.values() for z in d.values()])
probability = pd.DataFrame(x)
probability.columns = holes
probability['p'] = probability.product(axis=1)
probability.head()
2 | 3 | 4 | p | |
---|---|---|---|---|
0 | 0.72 | 0.58 | 0.74 | 0.309024 |
1 | 0.72 | 0.58 | 0.24 | 0.100224 |
2 | 0.72 | 0.58 | 0.02 | 0.008352 |
3 | 0.72 | 0.37 | 0.74 | 0.197136 |
4 | 0.72 | 0.37 | 0.24 | 0.063936 |
## [3]
p_2or3 = probability['p'][birdies['total_birdies']==num_birdies[0]].sum() + probability['p'][birdies['total_birdies']==num_birdies[1]].sum()
Solution
print("The probability that Rory McIlroy and John Rahm record 2 or 3 BIRDIES on holes 2-4 is ~%s" % round(p_2or3,3))
The probability that Rory McIlroy and John Rahm record 2 or 3 BIRDIES on holes 2-4 is ~0.282
Info
download markdown file
email: krellabsinc@gmail.com
twitter: @KRELLabs
import sys
print(sys.version)
3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)]
Posted on 8/22/2019