Skip to content

Seb943/Markov4Tennis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 

Repository files navigation

Markov4Tennis

ℹ️ An R script to modelize a tennis match with Markov chains. Want to know more about Markov Chains ? See [1] for a quick visual overview 💯💯. To use this work, just open the Markov.R script 👍.

ℹ️ Medium article : https://medium.com/analytics-vidhya/modelizing-a-tennis-match-with-markov-chains-b59ca2b5f5bf

ℹ️ Functionalities :

  • Compute winning probabilities for a game, a set, a tie-break and a match
  • Compute winning probabilities for already started match
  • Compute final score probabilities in terms of set
  • Display Markov Chain models

ℹ️ Functions overview :

Function Purpose Working ?
determiMM() Compute match winning probabilities from any score ✔️
resGAME() Compute game winning probabilities ✔️
resTIE() Compute tie-break winning probabilities ✔️
resSET() Compute set winning probabilities ✔️
resMATCH() Compute exact set scores probabilities ✔️

ℹ️ The main functions which you can use are the following one :

1.determiMM(ppoint_srv1 = 0.7, ppoint_srv2 = 0.6, setscore = '1-0', gamescore = '0-3', 
           s0match, s0set, s0game, s0tb)
2.resGAME(ppoint_server = 0.7, s_game = s0game, graph = TRUE) 
3.resTIE(ppoint_srv1 = 0.7, ppoint_srv2= 0.6, s_tb = s0tb, graph = TRUE)
4.resSET(phold1 = 0.7, phold2 = 0.6, 
       ptie1 = resTIE(ppoint_srv1 = 0.7, ppoint_srv2= 0.6, s_tb = s0tb, graph = FALSE)[1, "SETv1"], 
       s_set = s0set, graph = TRUE)
5.resMATCH(pset_v1 = 0.7, s_match = s0match, graph = TRUE)

ℹ️ Outputs of the functions (extra-documentation can be found in the functions.R script):
1.determiMM()
Scraper_final code
2.resGAME()
GameMarkovOutput
GameMarkov
3.resTIE()
TieBreakMarkovOutput
TieBreakMarkov
4.resSET()
SetMarkovOutput
SetMarkov
5.resMATCH()
MatchMarkovOutput
MatchMarkov


ℹ️ Please report any bug/issue in the issues section or directly at sebcararo@hotmail.fr. Any feedback is really appreciated 💬 👍.





You can also have a look at the functions.py source code in order to understand the mechanics and eventually adapt the code to your own purpose. I suggest the reader to start by reading lines from n°722 to the end, because these functions are the most speaking ones and that I commented them to clarify the inputs/outputs and use.

Markov chains are a great tool for modelizing all many kinds of stochastic process, including statistical physics, information theory, statistics, finance, but also sports modelizations. Several bookmakers use related techniques to predict odds for in the sports betting industry.

Future work :

  • Adapt the code to various sports
  • Create evolving models of Markov Chains (i.e. if the player 1 won the first set then he might be less likely to win the second set, hence we could adapt the model depending on the result of the first games)

[1] https://setosa.io/ev/markov-chains/

Releases

No releases published

Packages

No packages published

Languages