Men’s US Open - 1st Rd (John Millman v. #2 Rafael Nadal): How many GAMES will be PLAYED in the 1st Set?
7:10PM
8 Games or Fewer
9 Games or More
Inputs Needed To Solve
Service Games Won %
John Millman
Rafael Nadal
##### User Estimates #####
JM_SRV_Wperct = .77
RN_SRV_Wperct = .86
# Adjust to match current market odds
JM_SRV_Wperct = .5
RN_SRV_Wperct = .92
## Inputs Defined in the Problem
games = 8
Method To Solve
- [1] Simulate 9999 Sets between John Millman and Rafael Nadal using their respective Service Games Won Percent
- [2] The ratio of Simulated Matches where there are 8 or less games played in the 1st Set to the total number of Simulations is an estimate of the probability there are 8 Games or Fewer PLAYED in the 1st Set (p_8orless) based on the Monte Carlo Method.
## [1]
import numpy as np
def sim_game(server,perct1,perct2):
if server:
serve = np.random.choice([1,0],1,p=[perct1,1-perct1])
if serve == 1:
ans = '1'
else:
ans = '0'
else:
serve = np.random.choice([1,0],1,p=[perct2,1-perct2])
if serve == 1:
ans = '0'
else:
ans = '1'
return ans
def set_over(winner):
set_over = False
if winner.count('1') >= 7:
set_over = True
if winner.count('0') >= 7:
set_over = True
if winner.count('1') >=6 and winner.count('0') < 5:
set_over = True
if winner.count('0') >=6 and winner.count('1') < 5:
set_over = True
if winner.count('0') == 6 and winner.count('1') == 6:
set_over = True
return set_over
def sim_set(perct1,perct2):
winner = ''
server = True
set_over_ = False
while not set_over_:
game = sim_game(server,perct1,perct2)
winner += str(game)
server = not server
set_over_ = set_over(winner)
return winner
## [2]
iterations = 9999
_8_orless = 0
for i in range(iterations):
winner = (sim_set(RN_SRV_Wperct,JM_SRV_Wperct))
if len(winner) <= games:
_8_orless += 1
if i < 10:
print(len(winner))
p_8orless = _8_orless/iterations
7
9
9
7
6
9
6
10
9
9
Solution
print("The probability 8 Games or Fewer are PLAYED in the 1st Set is ~%s" % round(p_8orless,3))
The probability 8 Games or Fewer are PLAYED in the 1st Set is ~0.58
Info
download md 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/27/2019