ATP Western & Southern Open - 2nd Rd (Nick Kyrgios v. #8 Karen Khachanov): Will the 1st Set GO TO A TIEBREAK?
8:45PM
Yes: 1st Set goes to a tiebreak
No: 1st Set doesn’t go to a tiebreak
Inputs Needed To Solve
Service Games Won %
Kyrgios and Khachanov
##### User Estimates #####
Kyrgios_SRV_Wperct = .88
Khachanov_SRV_Wperct = .82
Method To Solve
- [1] Use Monte Carlo Simulation and simulate 9999 Sets between Kyrgios and Khachanov using their respective Service Games Won Percent
- [2] The ratio of Simulated Sets that reach TIEBREAK to the total number of Simulations is an estimate of the probability of a set reaching TIEBREAK (p_tie)
## [1]
import numpy as np
def sim_game(server,player1,player2):
if server:
serve = np.random.choice([1,0],1,p=[player1,1-player1])
if serve == 1:
ans = '1'
else:
ans = '0'
else:
serve = np.random.choice([1,0],1,p=[player2,1-player2])
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(player1,player2):
winner = ''
server = True
set_over_ = False
tie = 0
while not set_over_:
game = sim_game(server,player1,player2)
winner += str(game)
server = not server
set_over_ = set_over(winner)
if winner.count('0') == 6 and winner.count('1') == 6:
tie = 1
return tie
iterations = 9999
tie_count = 0
for i in range(iterations):
tie_count += sim_set(Kyrgios_SRV_Wperct,Khachanov_SRV_Wperct)
## [2]
p_tie = tie_count/iterations
Solution
print("The probability the 1st SET goes to a TIEBREAK is ~%s" % round(p_tie,3))
The probability the 1st SET goes to a TIEBREAK is ~0.264
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/14/2019