# Generic Sports Series Probability Calculator

With the baseball playoffs upon us, I have decided to start building a simulator to determine series outcomes once they start. I decided to make this as generic as possible. This simulator is not specific to baseball or even to a particular series length.

Obviously, the first parts to think about I addressed in my previous post relating to home field advantage, ratings and the probability a team would win a single game versus a specific opponent.

I will come back to this later in the month, as we get closer to the playoffs and I tie this all together.

Let’s assume for today that we know the probability a specific that Team A will defeat Team B. Let’s also assume, for matters of simplicity, that this single-game probability remains the same throughout the a series, regardless of any possible home field advantage.

Since we are dealing with a single probability and no perceived home field advantage, all we need for inputs are: p(Team A wins a single game), the current series record of the two teams and the numbers of games to win the series (e.g., 1 for a one-game series, 3 for a five-game series and 4 for a seven-game series).

All of my code is listed here on github, https://gist.github.com/sixmanguru

INPUTS
Like I said, let’s keep this simple. Probabilities, current series record, length of series.

seriesProb(.54,0,0,4)

The function calls for the series probabilities, give Team A holding a 54% chance to win a single game, the series is just beginning (0-0) and it takes for games to win the series (seven-game series).

That’s all.

OUPUT
Here’s the abbreviated (rounded to four digits).

([0.085, 0.1565, 0.1799, 0.1655], 0.5869, [0.0448, 0.0967, 0.1306, 0.141], 0.4131)

The first list contains the probabilities that Team A wins the series EXACTLY 4-0, 4-1, 4-2 or 4-3. The number trailing is the total probability Team A wins the series.

The second list contains the probabilities Team A loses the series EXACTLY 0-4, 1-4, 2-4, 3-4, with the total probability they lose the series following.

ALTERNATE EXAMPLES
Let’s assume the only thing you change is the fact that Team A now leads the series 3-0.

seriesProb(.54,3,0,4)

([0.54, 0.2484, 0.1143, 0.0526], 0.9553, [0, 0, 0, 0.0448], 0.0448)

As you can see above, there exists no change for Team B to win the series now 4-0, 4-1 or 4-2 and they have a 4.5% chance to even win the series at all. This can be verified by 0.46^4, which is approximately 0.0448.

Now let’s assume that it is a one game series.

seriesProb(.54,0,0,1)

([0.54], 0.54, [0.46], 0.46)

As you can see, it is one game, so the original probabilities are returned.

Finally, as a test, we say Team A trails the series 3-4 in a seven-game series.

seriesProb(.54,3,4,4)

It quickly returns (0,1). It is impossible for Team A to win and certain that Team B will win.

LIMITATIONS
The two biggest limitations to resolve (assuming you accept the theory that you can actually assign a probability to the function at all) remain to be the possibility of a home field advantage and how it would play out based on the series’ format (i.e., 2-3-2 vs. 2-2-1-1-1 and such)

Lastly, I would like to thank Jeff Sackmann, the author of Tennis Abstract and several other endeavors. His original python code for simulating a tennis match was the foundation for this project. His Python code for tennis Markov Chains can be found here, http://summerofjeff.wordpress.com/2011/01/13/python-code-for-tennis-markov/

# MLB Home Field Advantage this season

Honestly, it is hard to get fired up about the MLB Playoffs these days as a Houston Astros fan. But I figure it may be a way to test a few models and work on my programming.

After scrubbing the internet for scores, I decided to do a simple non-linear programming model to create some rankings. If you want to read more about NLP Optimization, please read my earlier posts I ran during last year’s NFL season.

I tried to apply home field advantage as a singular term, but found there wasn’t a generic home field advantage as in football. I then decided to try and determine if each teams’ individual HFA would have any effect on the ratings. With so many more games, this number had a better likelihood of showing some importance.

In general, the average score of a MLB game this year has been 4.11-4.09 in favor of the home team.

When you look at individual HFA, results are pretty amazing. As expected, the Colorado Rockies get almost a run and a half (1.47) bump at home. The Rockies are a solid 19 games better at home.

Next on the list are the Florida Marlins. First off, does anyone really call them the Miami Marlins? The Marlins have a little over a run per game advantage at home (1.14). Like the Rockies, they appear to be out of the hunt for the playoffs.

The team most likely to be able to take advantage of the home field advantage in the playoffs appears to be the Oakland A’s, who are more than 3/4 of a run (0.76) better at home. The A’s have nine more games at home in the regular season. Also, they get to finish the season at Texas, who are rating only slightly ahead of Colorado, Arizona and Miami as the worst teams in baseball. The Rangers also have no effective HFA either.

Washington (0.429), Pittsburgh (0.333) and Atlanta (0.154) are the only other teams in the playoff picture with significant home field advantages.

Here are a list of the current home field advantages. Those not listed have no significant HFA (0).

 Team HFA COL 1.473564 MIA 1.14011 OAK 0.760433 SDP 0.704609 WSN 0.429156 PIT 0.33299 CHC 0.25553 CIN 0.239817 TBR 0.210181 ATL 0.153853 PHI 0.052209 TOR 0.016576

Here are the current team ratings, as we head into the final few games of the season.

 Team Rating LAA 5.137348 SEA 4.943415 OAK 4.925794 BAL 4.771614 WSN 4.513368 DET 4.462223 LAD 4.363542 SFG 4.326927 KCR 4.305852 TOR 4.229679 CLE 4.184073 TBR 4.164056 NYM 4.038186 STL 4.031671 NYY 3.997041 ATL 3.988839 PIT 3.944171 MIL 3.930484 MIN 3.825875 CIN 3.783494 HOU 3.759729 BOS 3.720102 PHI 3.676738 CHW 3.599442 CHC 3.442758 SDP 3.341322 TEX 3.337711 MIA 3.30692 ARI 3.278469 COL 2.669157

The next step in the coming weeks will be to use the rating and home field advantage numbers to create a simulation of the playoffs.

# 2014 US Open Men’s Draw Simulation

The U.S. Open main draw begins this morning and for the fourth year in a row, I will not be able to attend. Gone are the good ol’ days of working for the USTA and getting to take the trip up to New York to take it all in.

Since I cannot go, I decided to utilize Markov Chain models and Monte Carlo simulations to predict who will win.

Markov Models for tennis are essentially placing some initial inputs into a model and allow it to simulate an entire match, giving you the probabilities player A wins over player B. A Monte Carlo simulation is when you run an entire tournament over and over like this. Even if you can do the math, one of the most difficult parts is creating the initial inputs to run the Markov Model.

MY METHODOLOGY
I decided to experiment with an idea that begins with something I read in Dr. Kamran Aslam’s PhD dissertation he wrote at USC. Dr. Aslam and his advisor, Dr. Paul K. Newton published portions of this paper several times, including in the Journal of Quantitative Analysis in Sport back in 2009.

Dr. Aslam took the idea that you start by finding the overall mean probability to win a point while returning. This is defined as the returning average of ‘the field’. Let’s say this is 0.330. Then, if Roger Federer is playing Novak Djokovic and Roger’s average ability to win a point returning is 0.40, then he is 0.07 better than ‘the field’. If Novak’s average is 0.41, then he is 0.08 better than ‘the field’.

Then, if Roger’s percentage he wins serve is 0.7, you subtract Novak’s ability ‘above the field’ (0.08), making Roger’s effective serving percentage, 0.62.

Likewise, if Novak’s serving percentage is 0.68, then his effective serving percentage is 0.61. Therefore, the input to the program would be 0.62 and 0.39 for Roger (one minus Novak’s effective serving percentage). If you ran this for Novak, the inputs would be 0.61 and 0.38.

Modifications
To get the data, I scraped all serving and receiving stats from the ATP website for each player in the draw. I also decided to scale the data.

Scaling
Using only hard court results for the 2014 season, I scaled the data based on the level of competition. This allowed me to include all Challenger data as well as ATP-level, which is available on the ATP site. If an opponent was inside the top-64, no scaling was done. If the opponent was ranked between 65 and 128, then I scaled it down by 1.5%. If the opponent was in the top-192, I scaled it another 1.5%. I scaled it another 1.5% for between 193-256 and another 1.5% for those over a 256 ranking.

For some matches, the opponent’s ranking is listed at N/A. In those cases, the scaling was done based on the player’s own ranking, which seemed to be close enough to the actual ranking, except in a few instances.

Scaling this way may not be the best solution, but this is a solid starting point.
I then found ‘the field’ by averaging the scaled percentages of all players in the tournament. Five players have not played on the hard courts yet this season, so I removed them when calculating the field. Also, rather than placing zeroes in the data for them, I substituted numbers slightly below the averages for both serving and receiving.

In future versions, I may substitute scaled, full season statistics, irrelevant of surface for these players.

Noah Rubin
Then there was the case of Noah Rubin, who only had one hard court match, where he had some pretty good numbers, despite losing last week in Winston-Salem. In this case, I decided to manually modify his percentages down closer to the five I had to manually enter who had not played a single hard court match.

Shortcomings
Most of the problems come from too little data on some players. Some of this can be handled by using more stringent scaling for Challenger-level matches. Two of the most noticeable are Gilles Muller and Jared Donaldson. Muller won the Guadalajara Challenger and none of his opponents’ rankings are listed in the data, so they were only scaled per his No.68-ranking. Donaldson also had a lot of Challenger results that were not scaled sufficiently.

Coding
Jeff Sackman at tennisabstract.com published some python code to run the Markov Models a few years ago (here’s a link to his 2014 predictions, which you may like more than mine). He uses similar inputs and generates a probability player A wins the match. I modified Jeff’s code for my purposes, then wrapped it within a Monte Carlo Simulation and ran it 50,000 times.

I am not posting my entire code just yet on github, but hope to soon. I need to refine my entire process, soup-to-nuts, before I feel comfortable with that.

THE RESULTS
The table below shows howe far a player advances. For instance, Roger Federer lost 1802 out of 50,000 trials in the first round, but won the tournament 16895 times.

Federer seems to be the biggest winner here with Rafael Nadal out. I know this isn’t perfect, but it is a good start and something to work with moving forward. There are some basic assumptions I make and some data that needs refining, but overall I am satisfied with the outcome.

 PLAYER R1 R2 R3 R16 Q S F W PCT Roger-Federer 1802 1399 4752 5083 5099 8057 6913 16895 33.8% Tomas-Berdych 4984 1008 5294 6528 7710 11934 5119 7423 14.8% Novak-Djokovic 244 18702 4269 3604 5764 4425 5658 7334 14.7% Andy-Murray 795 7560 7183 7213 13748 5073 4877 3551 7.1% Gilles-Muller 5497 25948 3678 3013 3864 2726 2705 2569 5.1% Milos-Raonic 3273 16891 7391 7462 5420 5007 2704 1852 3.7% Stan-Wawrinka 10010 5230 11653 5295 7827 5558 2753 1674 3.3% Kei-Nishikori 9637 4005 2004 16234 7388 6449 2777 1506 3.0% David-Ferrer 6078 14349 3023 8772 9880 5189 1576 1133 2.3% Blaz-Kavcic 6213 9611 16077 5177 6755 3917 1524 726 1.5% Marin-Cilic 17736 6164 6662 8257 6488 3217 905 571 1.1% Peter-Gojowczyk 6533 24512 5850 5298 3446 2674 1152 535 1.1% Jared-Donaldson 21742 3033 10349 5732 6508 1532 677 427 0.9% David-Goffin 2882 3878 15412 13738 10691 2144 836 419 0.8% Roberto-Bautista-Agut 9661 6577 12280 16611 2253 1578 685 355 0.7% Adrian-Mannarino 9823 8095 13559 14600 1878 1270 528 247 0.5% Paolo-Lorenzi 4830 17542 13070 6225 6295 1285 515 238 0.5% Simone-Bolelli 12534 12440 6899 10541 4619 2052 681 234 0.5% Facundo-Bagnis 22299 5898 6488 11127 2308 1093 590 197 0.4% Bernard-Tomic 16933 18795 2488 5200 4245 1712 432 195 0.4% Igor-Sijsling 10360 6161 21214 6118 3278 2052 626 191 0.4% Ernests-Gulbis 10555 16235 7808 10532 2450 1743 487 190 0.4% Gael-Monfils 28258 2975 8844 4478 4152 860 292 141 0.3% Dominic-Thiem 13221 16989 7085 8985 1991 1272 317 140 0.3% Ivo-Karlovic 12126 5162 26714 3018 1564 938 342 136 0.3% Jo-Wilfried-Tsonga 20942 8099 8426 7785 3365 856 395 132 0.3% Richard-Gasquet 13310 18723 9403 4126 3460 664 222 92 0.2% Yen-Hsun-Lu 15007 14542 16524 1747 1306 530 254 90 0.2% Benoit-Paire 20522 10624 8481 6731 2643 642 277 80 0.2% Grigor-Dimitrov 15605 14089 10471 5488 3458 618 197 74 0.1% Philipp-Kohlschreiber 27701 5789 5829 8094 1545 654 317 71 0.1% Marcos-Baghdatis 32264 5563 4588 4262 2312 804 148 59 0.1% John-Isner 14229 12162 12604 8587 1547 599 217 55 0.1% Kevin-Anderson 3544 18025 16794 7219 3297 922 151 48 0.1% Juan-Monaco 29058 7290 6559 4912 1679 336 124 42 0.1% Sam-Querrey 2888 23684 19638 1877 1236 444 192 41 0.1% Alexander-Kudryavtsev 24959 5369 15596 2145 1205 570 117 39 0.1% Bradley-Klahn 21459 11049 12642 2322 1899 430 162 37 0.1% Evgeny-Donskoy 25041 5464 15495 2100 1199 560 116 25 0.1% Steve-Johnson 22309 10788 9442 5674 1130 539 93 25 0.1% Dudi-Sela 751 25740 14179 6185 2661 380 84 20 0.0% Tommy-Robredo 19699 17062 5206 5582 1758 570 106 17 0.0% Radek-Stepanek 11794 30753 3478 2102 1464 282 111 16 0.0% Andreas-Beck 2542 27796 11149 6347 1739 323 89 15 0.0% Sergiy-Stakhovsky 15749 11889 12577 7060 2052 550 109 14 0.0% Julien-Benneteau 29478 9134 6133 3817 1163 200 61 14 0.0% Wayne-Odesnik 40363 3301 1383 3746 849 295 54 9 0.0% James-McGee 10881 25214 7925 4574 1153 192 52 9 0.0% Andrey-Kuznetsov 28541 9826 9132 1393 891 159 49 9 0.0% Jiri-Vesely 39990 3818 3995 1132 811 202 44 8 0.0% Tatsuma-Ito 27691 9767 7701 3842 650 298 43 8 0.0% Lleyton-Hewitt 45016 1036 2024 1202 499 183 34 6 0.0% Ivan-Dodig 21405 16081 8031 3614 590 241 32 6 0.0% Mikhail-Youzhny 14304 19251 10826 4501 894 191 27 6 0.0% Marco-Chiudinelli 20849 21573 4124 2442 820 164 22 6 0.0% Dustin-Brown 33067 12283 1366 1966 1030 242 41 5 0.0% Jan-Lennard-Struff 21002 16351 8368 3712 434 111 17 5 0.0% Blaz-Rola 23408 15137 9150 1331 812 118 40 4 0.0% Gilles-Simon 10414 5720 27011 4809 1745 265 32 4 0.0% Thomaz-Bellucci 17702 25481 4806 1182 643 167 15 4 0.0% Feliciano-Lopez 28595 13364 5638 2021 284 85 9 4 0.0% Jeremy-Chardy 22487 19476 5697 1275 794 223 45 3 0.0% Fernando-Verdasco 26592 13988 7748 1047 529 77 17 2 0.0% Jerzy-Janowicz 25303 14188 7428 2276 656 132 15 2 0.0% Ryan-Harrison 34395 9438 4306 1399 417 34 9 2 0.0% Dusan-Lajovic 24697 14643 7500 2296 715 128 20 1 0.0% Alejandro-Falla 27513 16945 4151 827 449 97 17 1 0.0% Edouard-Roger-Vasselin 30301 13073 3280 2566 648 120 11 1 0.0% Jack-Sock 17867 26513 1780 3228 486 114 11 1 0.0% Fabio-Fognini 15873 23836 7021 2983 230 47 9 1 0.0% Sam-Groth 16829 31352 1087 534 148 41 8 1 0.0% Guillermo-Garcia-Lopez 34993 9023 5491 333 124 27 8 1 0.0% Illya-Marchenko 29151 16700 2530 1245 321 47 5 1 0.0% Victor-Estrella-Burgos 39640 4215 5357 598 145 39 5 1 0.0% Kenny-De-Schepper 39445 7622 1860 930 112 26 4 1 0.0% Mikhail-Kukushkin 28998 13406 5509 1915 134 34 3 1 0.0% Andreas-Seppi 34251 8382 5378 1699 261 27 1 1 0.0% Matthias-Bachinger 38206 11021 552 173 41 5 1 1 0.0% Daniel-Gimeno-Traver 9294 29670 6064 4411 431 97 33 0 0.0% Vasek-Pospisil 37466 7425 2746 1885 410 58 10 0 0.0% Lukas-Rosol 3411 36289 9252 834 174 33 7 0 0.0% Lukas-Lacko 36779 9154 2435 1390 181 57 4 0 0.0% Paul-Henri-Mathieu 44503 5116 256 70 41 10 4 0 0.0% Tobias-Kamke 9550 7288 27984 4629 464 82 3 0 0.0% Marinko-Matosevic 48198 762 571 318 113 35 3 0 0.0% Tim-Smyczek 20643 22118 5015 2062 125 34 3 0 0.0% Marcos-Giron 35771 8081 4583 1414 124 24 3 0 0.0% Pere-Riba 40177 4868 3526 1305 104 17 3 0 0.0% Teymuraz-Gabashvili 22253 21265 5983 390 91 15 3 0 0.0% Andreas-Haider-Maurer 40339 4504 3543 1481 108 23 2 0 0.0% Filip-Krajinovic 29357 16801 2890 900 40 10 2 0 0.0% Donald-Young 43787 3968 1813 305 106 20 1 0 0.0% Denis-Istomin 36690 9754 2577 701 260 17 1 0 0.0% Jarkko-Nieminen 37874 4004 7699 332 73 17 1 0 0.0% Nicolas-Mahut 32298 15471 1808 306 102 14 1 0 0.0% Alejandro-Gonzalez 24004 22641 2772 478 101 3 1 0 0.0% Andrey-Golubev 34127 13201 2166 478 25 2 1 0 0.0% Yoshihito-Nishioka 45170 3981 714 113 21 0 1 0 0.0% Damir-Dzumhur 43922 4573 607 655 215 28 0 0 0.0% Benjamin-Becker 43467 5726 551 194 54 8 0 0 0.0% Pablo-Andujar 32133 16181 760 850 70 6 0 0 0.0% Marcel-Granollers 12044 29804 7917 210 19 6 0 0 0.0% Martin-Klizan 12104 35990 1429 390 82 5 0 0 0.0% Nick-Kyrgios 35696 10478 3088 667 66 5 0 0 0.0% Santiago-Giraldo 27747 17902 4055 243 48 5 0 0 0.0% Frank-Dancevic 17016 28639 3479 755 108 3 0 0 0.0% Taro-Daniel 46727 2871 309 78 13 2 0 0 0.0% Dmitry-Tursunov 25996 21351 2271 317 64 1 0 0 0.0% Aleksandr-Nedovyesov 39119 9397 1234 239 10 1 0 0 0.0% Niels-Desein 47118 1643 1091 139 8 1 0 0 0.0% Radu-Albot 39586 4073 6027 279 35 0 0 0 0.0% Leonardo-Mayer 9476 29457 10544 512 11 0 0 0 0.0% Albert-Ramos-Vinolas 33171 16487 255 76 11 0 0 0 0.0% Federico-Delbonis 23729 20814 5281 167 9 0 0 0 0.0% Noah-Rubin 26271 19393 4197 131 8 0 0 0 0.0% Matthew-Ebden 40450 4523 4807 213 7 0 0 0 0.0% Joao-Sousa 32984 15840 1045 125 6 0 0 0 0.0% Michael-Llodra 40706 8643 555 93 3 0 0 0 0.0% Robin-Haase 49205 666 115 11 3 0 0 0 0.0% Pablo-Cuevas 46456 3144 374 24 2 0 0 0 0.0% Steve-Darcis 37896 11966 124 14 0 0 0 0 0.0% Jurgen-Melzer 37956 11030 1005 9 0 0 0 0 0.0% Albert-Montanes 40524 8732 738 6 0 0 0 0 0.0% Pablo-Carreno-Busta 47458 2446 93 3 0 0 0 0 0.0% Diego-Schwartzman 49756 234 8 2 0 0 0 0 0.0% Maximo-Gonzalez 47112 2751 136 1 0 0 0 0 0.0% Carlos-Berlocq 49249 733 17 1 0 0 0 0 0.0% Borna-Coric 46589 3335 76 0 0 0 0 0 0.0%

# All the data you need to predict World Cup games is at the World Bank

Forget massive mixed models, evaluating world-wide player and team data. Forget checking historical World Cup data. The only data you need to predict World Cup winners comes from a single source — The World Bank.

Yep, that’s right. Let’s Keep It Simple, Stupid and take GDP (Gross Domestic Product) growth since the last World Cup in 2010. Honestly, they do not even have all of that, so we will take the growth in 2010, 2011 and 2012.

So far using these three growth figures is a perfect 5-0 through the early Saturday game.

The Data:

Change in GDP for first five World Cup games

Scores:
Brazil 3 Croatia 1 (12.35 v -3.95)
Mexico 1 Camaroon (13.57 v 12.48)
Netherlands 5 Spain 1 (1.99 v -2)
Chile 3 Australia 1 (19.1 v 7.16)
Columbia 3 Greece 0 (15.73 v -16.95)
So there you go. Five-for-Five.

So what’s the outlook for the US versus Ghana?

Ghana’s GDP % increase for the last 3 recording periods: 8, 15, 7.9 for a total incredible increase of 34%

US’s GDP % increase: 2.5, 1.8, 2.8 for a total of 7.27%

uh-oh.

# Predicting Federer-Tursunov and other Friday French Open Matches Using Markov Chain

Today I was enamored with the FiveThirtyEight.com article, Inside the Shadowy World of High-Speed Tennis Betting. The article mentions the courtsiders who would sit court side at a tennis match and try to relay information quicker than the tournament computers to betting partners. Great read. Not sure these courtsiders were really doing anything illegal.

Buried deep in the article was a mention of the system this one organization created to predict the outcome of tennis matches for betting purposes. It links to a website, Summer of Jeff, and a post, Python Code for Tennis Markov. If you follow the links to the gitHub site, there is some pretty elaborate Python code for generating probabilities based on Markov Chain theory. The code is pretty easy to use, if you understand Python and statistics, although it needs some cleaning up if you plan on using it for entire match prediction (hint: the matchProbs function needs some fixes to run).

The biggest issue is determining the initial probabilities. You need to create each server’s probability to win a point.

To do this, I decided to hit the trusty ATPworldtour.com website and pulled that information up.

FEDERER-TURSUNOV
For the year Roger Federer has won 90% of all service games, but only 70% of his service points. On clay this season, he is 89% and 67%. On the other hand, Dmitry Tursunov has won 22% of return games and 36% of return points. On clay he is 24% and 37%. Assuming the majority of these results came from ‘inferior’ players, we might suggest that these numbers regress to each other. I am going to say that Federer is likely to win 65% of his service points. One down.

Now when Tursunov serves, he’s won 75% of service games and 61 of service points, 70%-60% on clay. Federer has won 29% of service return games and 41% of points, 27%-40% on clay. That seems to work out quite nicely to 60-40, so Federer’s return probability will be 40%.

Plugging this into the handy code mentioned above, we get that Federer is a 78.5% favorite to win tomorrow.

TSONGA-JANOWICZ
Jo-Wilfried Tsonga has won 68% of service points, 65% on clay, while Jerzy Janowicz has won 34% of return points all season and an improved 36% on clay. What is crazy about this is you might suggest that Janowicz is a better clay court than hard court player. Well, amazingly, he had not won a single clay court match this spring before winning his first two rounds at Roland Garros. Oh well. I am still going to give his the benefit and place Tsonga as 65% to win a point on serve.

Returning, Tsonga has been 34% for the year and 35% on clay, while Janowicz has won 62% on serve and 68% on clay. Again Janowicz stats are much better on the terre battue. I am going to just split this straight and leave Tsonga’s return percentage at 34%.

We all know the French crowd will be pulling for their man, so that may be the edge, however, the stats say that Janowicz looks to be a slight favorite at 56.1%. Moving Tsonga’s serve percentage up just a point makes this a dead heat.

THE ODDS
Looking at the odds at SportsBook.com, Federer is -2500, so that’s a ridiculous bet, but Janowicz is actually +325 v. Tsonga, so that may be worth a play. I hope to look into this more as the tournament progresses.

# NCAA Men’s DI Tennis Regionals Simulated 50,000 times

This is posted on my college tennis website so aptly named, texascollegetennis.com. I decided to post it here as well.. why not, right?

I’m sitting in the middle of exams and term projects looking for ways to relax. What better way than to run a Monte Carlo Simulation of each of the men’s regionals, based on my year-end ratings?

So I ran each regional 50,000 times and you can see the results. One of the more intriguing of course is the Nashville Regional, where I could not really account for the home court (and probably outdoor) advantage the Vanderbilt will have over Columbia. That probably sways things a little, I am guessing in the range of 5-15%.

The first number is how many times each team won the entire regional. The second is their probability of coming out of the regional.

BEST FIRST ROUND MATCH-UPS: The Vanderbilt-Virginia Tech match-up looks good, as do the Oklahoma State-Michigan, Memphis-Drake, South Florida-Florida State,  Northwestern-Mississippi, Wake Forest-Louisville, Boise State-USD and Auburn-Harvard. There are a few more, but that’s my quick take.

USC Regional

 University of Southern California 45307 90.614% University of Idaho 122 0.244% Oklahoma State University 2283 4.566% University of Michigan 2288 4.576%

.

Nashville Regional

 Vanderbilt University 9815 19.630% Virginia Tech 7818 15.636% East Tennessee State University 1917 3.834% Columbia University 30450 60.900%

.

Austin Regional

 University of Texas 39580 79.160% Marist College 224 0.448% University of Louisiana at Lafayette 1140 2.280% Mississippi State University 9056 18.112%

.

College Station Regional

 California 11649 23.298% Texas Tech University 5420 10.840% Alcorn State University 42 0.084% Texas A&M University 32889 65.778%

.

Waco Regional

 Baylor University 43520 87.040% Texas A&M-Corpus Christi 497 0.994% Stanford University 3601 7.202% University of Tulsa 2382 4.764%

.

Champaign Regional

 University of Memphis 6515 13.030% Drake University 5669 11.338% Ball State University 374 0.748% University of Illinois 37442 74.884%

.

South Bend Regional

 University of Notre Dame 35693 71.386% Univ. of Wisconsin-Green Bay 381 0.762% Northwestern University 6925 13.850% University of Mississippi 7001 14.002%

.

Charlottesville Regional

 Penn State University 3489 6.978% UNC Wilmington 636 1.272% U.S. Military Academy 104 0.208% University of Virginia 45771 91.542%

.

Columbus Regional

 Ohio State University 45064 90.128% Bryant University 72 0.144% Wake Forest University 2384 4.768% University of Louisville 2480 4.960%

.

Gainesville Regional

 University of South Florida 7877 15.754% Florida State University 7821 15.642% St. John’s University 1541 3.082% University of Florida 32761 65.522%

.

Durham Regional

 Duke University 35589 71.178% Winthrop University 606 1.212% University of Tennessee 12034 24.068% Elon University 1771 3.542%

.

UCLA Regional

 University of San Diego 2321 4.642% Boise State University 3591 7.182% Cal Poly 375 0.750% UCLA 43713 87.426%

.

Chapel Hill Regional

 North Carolina 40147 80.294% South Carolina State 233 0.466% University of South Carolina 8986 17.972% George Washington University 634 1.268%

.

Athens Regional

 North Carolina State 7642 15.284% University of Oregon 5472 10.944% Jacksonville State University 161 0.322% University of Georgia 36725 73.450%

.

Lexington Regional

 University of Kentucky 32487 64.974% University of Denver 948 1.896% Clemson University 9801 19.602% Purdue University 6764 13.528%

.

Norman Regional

 Auburn University 2313 4.626% Harvard University 2361 4.722% Montana 88 0.176% University of Oklahoma 45238 90.476%

# Live by the Variance, Die by the Variance (and why I hate Duke [and Mercer] for that matter

The first weekend of the NCAA Tournament was a wild one. In our competition, we chose models with high variance, knowing full well we could be in a world of hurt if a game or two did not go our way. Being scored on a log loss scale was new to us, and we knew of the risks, but did not really think things could get too bad.

We knew Wichita State was rated too high, but we thought, “hey, maybe they are just that good,” and rolled with it. Anyhow, we had figured they would eventually lose, but one game would not kill us since we could make it up somewhere else.

That was of course until Mercer took it to the Dukies. Most models had Duke as a very strong 3-seed. I believe the fivethirtyeight blog even had Duke as a 93-94% favorite. Those kinds of numbers are for wimps. We had them as a prohibitive 98.4% favorite in one model and 98.9% in another. When you do something like this in a competition where the scoring is based on log loss, you better hope that they win, or else you are dead in the water.

The average score using this model (at least your goal) should be in the 0.4 to 0.5 range. The Duke loss was a 4.1 to 4.5 point penalty that just destroyed us. Unfortunately, no one else was dumb enough to match our probability.

By comparison, last year’s Cinderella, Florida Gulf Coast, had only a 4% chance to beat Georgetown. Using the same formula, you penalty is in the 3′s.

We could have easily solved all of this and handled the huge variance by increasing the variance when calculating our probabilities. But we were in win or go home mode… oh well.

Here is a quick updated simulation of the remaining teams. I ran a somewhat newer updated model 50,000 times.

UPDATED MONTE CARLO SIMULATION WITH NEW PROBABILITIES

 Team Sweet 16 Elite 8 Final 4 Final Champion Louisville 9137 8891 12333 7167 12472 Arizona 7871 9126 13607 7425 11971 Florida 12205 4016 11482 10622 11675 Virginia 16372 7740 11536 7621 6731 Wisconsin 16889 22709 6769 2276 1357 Michigan St. 33628 6133 6169 2755 1315 Michigan 23402 18883 5046 1715 954 UCLA 37795 3240 5447 2581 937 Tennessee 26598 17198 4236 1266 702 Iowa St. 21098 20109 5932 2172 689 Kentucky 40863 5028 2921 810 378 Connecticut 28902 16018 3673 1139 268 San Diego St. 42129 4587 2510 562 212 Baylor 33111 13578 2578 570 163 Stanford 22166 23422 3430 860 122 Dayton 27834 19322 2331 459 54

# My 50,000 Monte Carlo Simulation Results for the NCAA Basketball Tournament

With March Madness upon us, I have been in a solid state of sleep-deprivation. It all started with a class project assigned in late February that suggested we enter the Kaggle competition of our choice or create a similar type project.

I was immediately drawn to the March Machine Learning Mania being hosted by Kaggle and Intel. For the past three weeks, in any spare time, I have been trying to find and clean data to run models. I thought things were slowing down last week until I decided to try some new data I had found.

That being said, I was running and testing models and way overthinking this whole competition down to the very last few hours, right up to the deadline yesterday afternoon. The competition requires you to submit a probability for all 2278 (68 teams) potential matchups. Only the 63 games are actually played (they do not count the play-in games) are scored.

Since I had all of these probabilities, I decided I should write my own Monte Carlo simulation to see what would happen. I meant to post the results yesterday, but as it seems to always happen when you write code without much sleep, debugging becomes a painful mess. I had a midterm yesterday as well and may have been a bit exhausted.

But here it is – 50,000 simulated runs of the tournament, based on the last data I generated for the contest. (You were allowed to submit to sets of scores with your best score becoming your entry).

I am still a little too tired to give much insight, but will post more as the tournament goes on….

 Team First Second Sweet 16 Elite 8 Final 4 Final Champion Arizona 76 3716 2635 8198 15541 6957 12877 Louisville 461 810 16698 4892 10298 5408 11433 Florida 82 4645 5746 6711 10486 11375 10955 Virginia 57 1858 9416 9911 13620 9194 5944 Wichita St. 86 5425 27100 4049 6536 2974 3830 Villanova 307 6967 9237 20123 8362 3727 1277 Creighton 682 6139 12844 20991 6396 1793 1155 Kansas 789 8190 10874 20648 5694 2934 871 Duke 831 12439 10829 19701 4117 1280 803 Michigan St. 1645 10072 28384 5140 3438 1089 232 Wisconsin 1174 11253 22337 11972 2635 467 162 Michigan 363 6456 26221 14597 1873 358 132 UCLA 3733 19990 21612 2534 1550 505 76 Syracuse 1839 16022 20145 9813 1648 468 65 VCU 5821 21730 18738 2082 1194 384 51 Iowa St. 4069 16082 20478 7517 1497 314 43 Pittsburgh 4715 40614 2617 1263 617 150 24 Tennessee 6498 30742 6326 5693 599 118 24 Ohio St. 11895 22636 11142 3751 475 89 12 Oklahoma 10482 17021 20399 1596 451 44 7 North Carolina 15357 19287 11678 3107 485 81 5 Kentucky 8253 36494 4727 338 157 26 5 Oklahoma St. 24608 23467 758 846 286 31 4 Gonzaga 25392 22744 815 766 250 30 3 Oregon 14064 25546 8095 2018 250 24 3 Connecticut 13243 30497 3583 2340 290 45 2 San Diego St. 7763 19228 21008 1557 411 31 2 New Mexico 17082 26126 4091 2373 285 42 1 Cincinnati 21385 21488 6385 557 162 22 1 Dayton 38105 9663 1985 234 11 1 1 Baylor 13150 30926 4120 1634 151 19 0 Harvard 28615 16988 4026 289 72 10 0 Stanford 32918 14955 1552 541 30 4 0 Providence 34643 11130 3680 505 39 3 0 Memphis 24284 24724 818 155 17 2 0 George Washington 25716 23364 778 124 17 1 0 Texas 22213 23781 3589 404 13 0 0 Saint Joseph’s 36757 12239 784 211 9 0 0 BYU 35936 12131 1734 190 9 0 0 Saint Louis 17891 31293 778 32 6 0 0 Arizona St. 27787 19413 2573 222 5 0 0 North Dakota St. 39518 7502 2897 78 5 0 0 Nebraska 36850 12319 702 126 3 0 0 New Mexico St. 42237 6249 1485 26 3 0 0 Massachusetts 43502 6034 405 57 2 0 0 Stephen F. Austin 44179 5000 796 23 2 0 0 Kansas St. 41747 7998 248 5 2 0 0 Manhattan 49539 313 145 2 1 0 0 North Carolina Central 45931 3501 550 18 0 0 0 Tulsa 46267 3280 440 13 0 0 0 Western Michigan 48161 1679 152 8 0 0 0 North Carolina St. 32109 17584 301 6 0 0 0 Colorado 45285 4659 51 5 0 0 0 Delaware 48355 1452 190 3 0 0 0 Louisiana Lafayette 49318 616 64 2 0 0 0 Mercer 49169 785 44 2 0 0 0 Eastern Kentucky 49211 729 59 1 0 0 0 American 48826 1070 104 0 0 0 0 Wofford 49637 350 13 0 0 0 0 Milwaukee 49693 297 10 0 0 0 0 Cal Poly 49914 83 3 0 0 0 0 Weber St. 49924 73 3 0 0 0 0 Coastal Carolina 49943 54 3 0 0 0 0 Albany 49918 82 0 0 0 0 0

# My TexasCollegeTennis.com Feb 18 Men’s Rankings

It has been too, too long since I have posted anything on here. I have been active on twitter (@TXCollege10s) and keeping up with the season as it progresses, but have not had a whole lot of time to really repost all of the articles.

I decided it was time to update the rankings program, so here we go. Please let me know where you see mistakes. NOTE: The records for each team indicate only matches against DI opponents. So please do not e-mail me that the record is wrong, unless you are certain that has been checked.

I have NOT proofed this. I am into crowdsourcing…. or just lazy. I understand I am missing certain schools that have just moved to D1 (Abilene Christian) or have moved from D1… Next week will be more complete.

There are quite a few teams ranked with 0-0 records and sitting at 375.

 RK TEAM W L RATING 1 Ohio State University 13 0 1175.66 2 University of Southern California 7 1 1129.26 3 UCLA 7 1 1083.53 4 University of Virginia 6 1 1057.88 5 University of Oklahoma 8 1 1046.29 6 Baylor University 5 2 986.5 7 Texas A&M University 8 3 976.56 8 University of Notre Dame 9 2 976.45 9 University of Illinois 6 4 976.21 10 University of Texas 9 2 976.11 11 University of Tennessee 10 2 976.03 12 California 6 2 948.68 13 Vanderbilt University 7 1 940.79 14 Mississippi State University 9 2 935.64 15 North Carolina 9 1 933.35 16 Duke University 5 3 923.69 17 University of Kentucky 7 3 923.26 18 University of Florida 4 4 907.44 19 Clemson University 9 1 901.17 20 Wake Forest University 4 2 884.99 21 University of Georgia 3 5 864.35 22 Pepperdine 5 4 852.91 23 Northwestern University 8 3 827.05 24 University of Memphis 3 2 825.7 25 Elon University 3 1 820.87 26 North Carolina State 9 1 820.38 27 Columbia University 7 1 820.18 28 Auburn University 8 2 795.35 29 Penn State University 9 0 794.42 30 University of Michigan 3 4 791.81 31 Virginia Commonwealth University 8 4 790.0 32 University of South Carolina 5 3 788.47 33 Boise State University 6 2 782.23 34 University of Mississippi 1 2 763.03 35 Louisiana State University 5 2 762.76 36 Virginia Tech 5 2 758.6 37 Harvard University 2 3 758.55 38 University of Tulsa 8 5 758.49 39 University of Oregon 8 1 745.0 40 TCU 2 2 737.23 41 Florida State University 9 2 737.15 42 University of Alabama 4 3 731.57 43 University of Louisville 6 2 720.89 44 Stanford University 3 1 707.55 45 Drake University 5 3 706.51 46 Princeton University 6 1 693.51 47 University of South Florida 3 0 683.86 48 San Diego State University 5 2 678.08 49 Texas Tech University 4 3 677.29 50 University of Nebraska 4 3 677.15 51 University of Denver 5 2 677.06 52 University of Utah 8 2 676.86 53 University of New Mexico 11 3 676.57 54 Indiana University-Bloomington 5 4 675.59 55 University of Iowa 5 0 663.18 56 University of Minnesota 4 4 651.41 57 University of Washington 4 4 646.64 58 Michigan State University 4 5 644.78 59 Purdue University 4 1 640.43 60 University of Arkansas 6 4 633.44 61 UNC Wilmington 3 3 629.76 62 University of San Diego 1 2 629.52 63 University at Buffalo 4 0 622.73 64 University of Wisconsin 4 3 617.51 65 Santa Clara University 3 1 616.19 66 Presbyterian College 7 1 610.28 67 Cornell University 4 2 609.4 68 University of Louisiana at Lafayette 5 2 604.83 69 East Tennessee State University 3 5 589.05 70 Wichita State University 3 4 588.87 71 Georgia State University 4 5 588.74 72 Yale University 3 2 578.9 73 University of Miami (Florida) 3 2 573.95 74 Old Dominion University 6 1 565.44 75 University of Nevada 4 1 564.36 76 Furman University 5 4 563.03 77 Texas A&M-Corpus Christi 8 4 562.84 78 University of Arizona 8 6 562.66 79 U.S. Air Force Academy 2 2 559.83 80 Brigham Young University 5 6 559.67 81 Middle Tennessee State University 2 6 557.17 82 SMU 4 4 556.02 83 University of North Florida 4 0 549.89 84 Brown University 3 2 540.58 85 Marquette 5 3 538.8 86 Butler University 4 1 536.33 87 University of South Alabama 6 3 536.26 88 Lamar University 5 2 532.98 89 Illinois State University 2 3 531.63 90 Western Michigan University 6 3 531.46 91 Northern Illinois University 4 3 531.37 92 UNLV 4 2 530.94 93 Wake Forest University 2 0 527.03 94 Charlotte 2 1 525.08 95 UAB 3 3 524.92 96 Tulane University 6 2 524.77 97 Univ. of Wisconsin-Green Bay 5 4 523.47 98 Eastern Kentucky University 2 3 522.04 99 Xavier University 5 4 522.04 100 Binghamton University 4 3 521.83 101 East Carolina University 7 3 520.08 102 Coastal Carolina University 4 3 511.65 103 Wofford 3 4 502.67 104 Univ. of San Francisco 3 3 500.41 105 University of South Florida 2 0 495.53 106 UC Irvine 1 7 493.16 107 Gonzaga University 2 1 491.87 108 Northern Arizona University 3 3 491.79 109 Cleveland State University 3 4 491.59 110 New Mexico State University 5 3 491.43 111 Ball State University 3 2 491.42 112 University of Southern Mississippi 5 4 491.27 113 George Washington University 1 3 488.45 114 Eastern Illinois University 3 2 488.34 115 St. John’s University 1 2 488.1 116 College of William and Mary 7 6 488.06 117 U.S. Naval Academy 3 3 484.19 118 IPFW 4 4 475.73 119 NJIT 1 0 472.38 120 Saint Joseph’s University 1 2 472.37 121 Quinnipiac University 5 2 472.24 122 Fairfield University 4 2 472.16 123 Winthrop University 2 4 469.35 124 UC Santa Barbara 2 3 469.0 125 College of Charleston 1 3 468.99 126 University of the Pacific (California) 2 3 468.59 127 Wright State University 3 4 468.5 128 Colgate University 2 0 464.16 129 Monmouth University 1 2 464.0 130 Georgetown University 4 3 464.0 131 Boston College 2 5 463.96 132 Bryant University 4 3 463.73 133 Duquesne University 4 2 462.08 134 University of Detroit Mercy 2 5 462.02 135 Southern Illinois-Edwardsville 3 1 461.73 136 UNC Greensboro 2 2 461.51 137 Loyola Marymount University 2 2 457.7 138 South Dakota State 2 2 457.45 139 Florida Gulf Coast University 2 5 455.06 140 Florida Atlantic University 4 4 454.88 141 Univ. of Maryland-Baltimore County 3 3 453.58 142 Lehigh University 1 1 453.47 143 Drexel University 3 1 451.44 144 Southern Illinois-Carbondale 3 3 450.81 145 Austin Peay State University 2 1 446.69 146 University of Delaware 2 1 446.47 147 Univ. of Texas at San Antonio 1 4 445.6 148 Rice University 2 6 443.91 149 George Mason University 2 1 442.99 150 UC Davis 3 4 442.35 151 Saint Mary’s College of California 2 2 442.05 152 University of North Florida 0 5 440.46 153 U.S. Military Academy 1 0 439.33 154 Marist College 1 1 438.71 155 University of Portland 2 2 438.39 156 James Madison University 2 2 437.61 157 Montana State University-Bozeman 1 2 437.26 158 University of Toledo 3 9 437.08 159 Samford University 1 5 436.75 160 Jacksonville State University 2 3 435.93 161 Utah State University 3 5 431.13 162 Mercer University 3 9 425.46 163 Stony Brook University 1 1 423.66 164 University of Connecticut 3 3 423.13 165 Appalachian State University 1 1 419.72 166 Creighton University 1 1 416.35 167 South Carolina State 1 2 414.42 168 Kennesaw State University 3 4 414.29 169 University of Texas-Pan American 2 6 412.5 170 Fresno State 2 6 411.51 171 North Carolina Central University 1 4 408.88 172 Stetson University 1 1 405.3 173 Fordham University 1 1 404.12 174 Radford University 1 2 403.17 175 University of Hawaii 1 3 402.62 176 University of New Orleans 1 1 401.0 177 Youngstown State University 1 5 399.96 178 Bradley University 2 3 399.95 179 DePaul University 1 4 397.56 180 University of Idaho 2 6 396.51 181 Eastern Washington University 1 2 393.36 182 Saint Louis University 2 3 392.99 183 Davidson College 1 6 391.65 184 University of Richmond 3 6 391.56 185 Belmont University 1 3 388.75 186 Florida A&M University 2 6 386.05 187 Troy University 1 5 383.9 188 University of South Carolina-Upstate 1 3 381.84 189 Norfolk State University 1 3 379.75 190 Robert Morris University 0 0 375.0 191 Mississippi Valley State University 0 0 375.0 192 La Salle University 0 0 375.0 193 St. Peter’s College 0 0 375.0 194 Univ. of Maryland-Eastern Shore 0 0 375.0 195 Lafayette College 0 0 375.0 196 Hofstra University 0 0 375.0 197 Wagner College 0 0 375.0 198 Coppin State College 0 0 375.0 199 Centenary College (Louisiana) 0 0 375.0 200 Sacred Heart University 0 0 375.0 201 Mount St. Mary’s University 0 0 375.0 202 Univ. of Arkansas Pine Bluff 0 0 375.0 203 Niagara University 0 0 375.0 204 Western Kentucky University 0 0 375.0 205 Jacksonville University 0 0 375.0 206 Fairleigh Dickinson University 0 0 375.0 207 George Washington University 0 0 375.0 208 Chattanooga 1 4 371.5 209 Portland State University 0 1 371.36 210 Murray State University 0 3 370.94 211 St. Francis Univ. (Pennsylvania) 1 3 368.62 212 Tennessee State University 0 1 367.5 213 Longwood University 1 5 365.91 214 Weber State 1 5 365.61 215 Oral Roberts University 1 5 361.89 216 Univ. of Northern Colorado 0 1 360.7 217 Univ. of Illinois at Chicago 1 4 357.83 218 Sacramento State 1 3 355.02 219 Loyola College (Maryland) 0 1 353.1 220 Idaho State University 0 1 351.29 221 Valparaiso University 0 2 350.63 222 Univ. of Dayton 1 5 349.46 223 Alabama A&M University 0 3 348.78 224 University of Pennsylvania 0 2 348.1 225 Nicholls State University 0 3 347.55 226 Montana 0 2 345.24 227 Lipscomb University 0 3 339.57 228 Georgia Southern University 1 5 339.49 229 Villanova University 0 2 337.1 230 Campbell University 0 3 337.0 231 Seattle University 1 7 336.49 232 Liberty University 1 4 336.19 233 Alcorn State University 0 4 334.86 234 UNC Asheville 0 3 334.0 235 Morehead State University 0 2 333.68 236 Siena College 0 2 333.53 237 University of Texas at Arlington 0 4 327.69 238 Hampton University 0 2 325.81 239 Howard University 0 4 324.26 240 Bucknell University 0 3 322.49 241 The Citadel 0 6 320.29 242 Tennessee Tech University 0 5 319.4 243 St. Francis College (New York) 0 3 319.0 244 Morgan State University 0 4 318.36 245 Rider University 0 3 318.23 246 Western Illinois University 0 4 316.79 247 Boston University 0 3 316.75 248 UMKC 0 5 314.45 249 Gardner-Webb University 0 5 302.03 250 University of Hartford 0 4 301.44 251 Cal Poly 0 7 299.88 252 Jackson State University 0 8 293.71 253 Bethune-Cookman University 0 5 292.92 254 St. Bonaventure University 0 5 286.25 255 Prairie View A&M University 0 5 285.24 256 Alabama State University 0 6 283.27 257 IUPUI 0 7 279.33 258 Temple University 0 7 267.66 259 Chicago State University 0 8 265.79 260 UC Riverside 0 9 259.51

# Creating Maps on the Fly For UIL Realignment

This morning the high school football season officially started with the release of the much anticipated 2014-2016 UIL Football Alignments. This usually started with the UIL servers crashing due to the high volume of traffic (it did briefly, prior to release). This year the UIL was prepared and had a back-up plan to divert traffic off their site.

So at exactly 9:00 am, the Twitterverse was alive with the ramblings of everyone who cares about Texas high school football.

I downloaded the files and immediately started sorting the teams into an Excel spreadsheet I had prepared for the occasion. Once done, I placed the data into my main database online.

I had been modifying my map code I created and showed in a previous post to handle the different divisions, sort them by division and district and color code them. By recycling this code, I easily created three maps.

Here’s the one where I sort them by division (blue for d1, red for d2)
http://sixmanfootball.com/big_alignment_map.php

Here’s a look at it

2014 UIL Realignment

Then here are the ones where I separate Division 1 and 2 and then split up the districts.
http://sixmanfootball.com/alignment_map.php?did=1
http://sixmanfootball.com/alignment_map.php?did=2

Here’s an example shot of what they look like

UIL Division 1 snapshot

Using the new google maps API, it took less than an hour to get everything up and running. All that was left was a little formatting and fine-tuning. The conversion of the data to an XML file makes all of the debugging so much easier.