Tennis simulator


This Wimbledon has seen a large number of injuries and withdrawals, prompting commentators to ask - could this be coincidence, or has something changed to make the courts more dangerous? Hearing people on the radio attempt to decide whether this was a fluke or not got me thinking: how much luck is there in tennis anyway? I decided to write a simulator to see what I could find out.


Chance is hard to estimate, given that in the real world it is almost impossible to recreate exact circumstances. Using simulators, though, we can get a reasonable guess at how structures affect the likelihood of outcomes. Below is a link to a simulator that can be used to estimate how much luck and how much skill goes into winning a tennis match.

Recently I wrote a football simulator, which appeared to show that to be certain of victory a team had to be multiple times more skilled than the opposition. This was because goals are rare in football, and these rare events determine outcomes. In tennis, though, every game is a mini-competition, which in turn are parts of sets, which ultimately determine the winner. Hence to be victorious in tennis one needs to win a large number of smaller contests, meaning that upsets are much less likely. Injuries, mental frailty, home support, wrong line-calls, or divine intervention are not accounted for. 

The rules of the simulator are simple: two equally skilled players have identical likelihood of winning each point. Onto this we can add a 'serve bonus', to capture the fact that most commonly the  player to serve will win the game. Otherwise the simulator rules are the same as for the matches at Wimbledon: best of three sets wins, there are no tie-breaks in the final set, tiebreaks and deuce must be won by a two-point margin. 

The simulator is a python script hosted here. This Wimbledon, after Nadal and Federer were knocked out, Murray and Djokovic are currently (28/06/2013) favourites for the title. Djokovic, as world number one, is probably a stronger favourite than Murray. Follow the link above, and the default settings entered are:

runApp(1,"Murray",90,"Djokovic",100,.5)

For me this gave a match where Djokovic won in straight sets:


Murray fans need not despair though - just keep running the simulator, or change the weightings, and sooner or later Murray will inevitably win - such is the nature of chance =)

The simulator may be launched as follows: go here and press either F8 or the button labelled 'run it'. The code is all there, so feel free to go exploring/pillaging.

Here's how it works: 'runApp' is the function used to launch the simulator. Inside the brackets the '1' represents the number of matches we will play, player1 is Murray, with a skill-level of 90; Djokovic has a skill level of 100. The '0.5' means there is a 50% bonus for serving. Try running the game. Probably Djokovic won, but not necessarily.

Let's change the number of simulations. Enter code something like this:

runApp(100,"Murray",90,"Djokovic",100,.5)

Now we run the match 100 times, and count how many times Murray won. We don't bother printing the running scores, but the underlying game-play is identical. Now Murray probably won somewhere between 10 and 30 times. 

This shows that the structure of tennis is such, that, unlike football, one only has to be a bit better than one's opponent to be likely to win. If we accept the 90-100 skills difference between Murray and Djokovic, it also means Murray *probably* won't win Wimbledon this year either. But he might. 

What about a player half as good as Murray? Could Murray lose? In Football this would not be unheard of, but with tennis' structure, it is. I ran the simulation 1000 times, and Murray won every single one. This means that if Murray really were to face Serena Williams in Vegas the odds would be stacked against Serena. If we estimate that Murray is 20% better (i.e. stronger, faster) than Serena, he would win 95% of the time. 

What about the serve bonus? Here we assume that the bonus is a percentage one, and that it is equal for both players. Given these assumptions, would Serena be more or less likely to beat Murray in Vegas, if the bonus for serving is high or low?

Try this:
runApp(1,"Murray",120,"Serena",100,3)

With a 300% percent serve bonus you probably found you got a match a bit like Isner v Mahut a few years ago: the chance of breaking is so small, that the match becomes very long. In this scenario mental strength would probably be decisive, but theoretically this scenario should make for a more level playing field: we can assume no one drops serve, so every set will go to a tie-break. This should favour the underdog. Over 10000 iterations I found the effect to be very modest. Serena's odds appeared to improve from about 8.5% to about 8.8%:

runApp(10000,"Murray",120,"Serena",100,0)
runApp(10000,"Murray",120,"Serena",100,2.0)

The reason the effect was so modest is partly that there is no tiebreak in the final set, but also that best of 5 tiebreaks still is a large number of points, enough to come out the victor more often than not. 

When asked whether she would agree to face Andy, Serena said she'd be lucky to win a game. How much better would a player have to be to win 6-0,6-0,6-0? Given I take no pride in my tennis prowess I'm happy to be the subject of this example. I ran the simulation below a few times, and basically, if someone were four times better than me, I'd have little chance of winning a game:

runApp(1,"Rolf",1,"Someone moderately good",4,.5)
So in conclusion then, in tennis, unlike football, great consistency coupled with marginal superiority will likely result in a win. Football is much less predictable, which might explain why one of the favourites tends to win Wimbledon, while recent winners of the European Championships include Greece and Denmark. 


No comments:

Post a Comment