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/

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.

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