PGA: Will R. McIlroy, T. Woods and B. Koepka ALL record the SAME SCORE on ANY SINGLE HOLE during Holes 16-18?
5:17 PM
Yes: All 3 same score on at least one of those holes
No: At least 1 has different score on each of those holes
Inputs to Solve
##### User Estimates #####
hole_16 = {'2':58,
'3':244,
'4':68,
'5':14}
hole_17 = {'3':42,
'4':247,
'5':82,
'6':13}
hole_18 = {'3':47,
'4':219,
'5':87,
'6':31}
## Inputs Defined in the Problem
golfers = ['McLlroy','Woods','Koepka']
Method to Solve
- [1] Enumerate all the possible combinations of scores for 3 golfers on the 16th, 17th and 18th holes (2^4 combinations per hole).
- [2] The probability that at the 3 golfer’s scores are the same (p_same_16, p_same_17, p_same_18) is the sum of all the probabilities where the scores are equal on each hole.
- [3] The probability all 3 golfer’s scores are different on each hole (p_noSame) is (1-p_same_16) * (1-p_same_17) * (1-p_same_18)
## [1]
import numpy as np
import pandas as pd
t=sum(hole_16.values())
for i in hole_16:
hole_16[i] = hole_16[i]/t
y = np.array([(a,b,c) for a in hole_16.keys() for b in hole_16.keys() for c in hole_16.keys()])
scores_16 = pd.DataFrame(y)
scores_16.columns = golfers
scores_16 = scores_16.apply(pd.to_numeric)
a = scores_16.values
b = (a == a[:, [0]]).all(axis=1)
scores_16['same'] = b
z = np.array([(a,b,c) for a in hole_16.values() for b in hole_16.values() for c in hole_16.values()])
probability_16 = pd.DataFrame(z)
probability_16.columns = golfers
probability_16['p'] = probability_16.product(axis=1)
t=sum(hole_17.values())
for i in hole_17:
hole_17[i] = hole_17[i]/t
y = np.array([(a,b,c) for a in hole_17.keys() for b in hole_17.keys() for c in hole_17.keys()])
scores_17 = pd.DataFrame(y)
scores_17.columns = golfers
scores_17 = scores_17.apply(pd.to_numeric)
a = scores_17.values
b = (a == a[:, [0]]).all(axis=1)
scores_17['same'] = b
z = np.array([(a,b,c) for a in hole_17.values() for b in hole_17.values() for c in hole_17.values()])
probability_17 = pd.DataFrame(z)
probability_17.columns = golfers
probability_17['p'] = probability_18.product(axis=1)
t=sum(hole_18.values())
for i in hole_18:
hole_18[i] = hole_18[i]/t
y = np.array([(a,b,c) for a in hole_18.keys() for b in hole_18.keys() for c in hole_18.keys()])
scores_18 = pd.DataFrame(y)
scores_18.columns = golfers
scores_18 = scores_18.apply(pd.to_numeric)
a = scores_18.values
b = (a == a[:, [0]]).all(axis=1)
scores_18['same'] = b
z = np.array([(a,b,c) for a in hole_18.values() for b in hole_18.values() for c in hole_18.values()])
probability_18 = pd.DataFrame(z)
probability_18.columns = golfers
probability_18['p'] = probability_18.product(axis=1)
## [2]
p_same_16 = probability['p'][scores_16['same']==True].sum()
p_same_17 = probability['p'][scores_17['same']==True].sum()
p_same_18 = probability['p'][scores_18['same']==True].sum()
## [3]
p_noSame = (1-p_same_16)*(1-p_same_17)*(1-p_same_18)
Solution
print("The probability R. McIlroy, T. Woods and B. Koepka ALL record the SAME SCORE on ANY SINGLE HOLE during Holes 16-18 is ~%s" % round(1-p_noSame,3))
The probability R. McIlroy, T. Woods and B. Koepka ALL record the SAME SCORE on ANY SINGLE HOLE during Holes 16-18 is ~0.487
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/16/2020