{"id":296,"date":"2016-05-28T06:47:28","date_gmt":"2016-05-28T06:47:28","guid":{"rendered":"http:\/\/www.laurentlessard.com\/bookproofs\/?p=296"},"modified":"2016-05-30T10:20:37","modified_gmt":"2016-05-30T10:20:37","slug":"baseball-division-champs","status":"publish","type":"post","link":"https:\/\/laurentlessard.com\/bookproofs\/baseball-division-champs\/","title":{"rendered":"Baseball division champs"},"content":{"rendered":"<body><p><\/p>Today\u2019s post is a <a href=\"http:\/\/fivethirtyeight.com\/features\/can-you-solve-the-puzzle-of-the-baseball-division-champs\/\">Riddler<\/a> problem about baseball, and it goes like this:\n<blockquote><p>Assume you have a sport (let\u2019s call it \u201cbaseball\u201d) in which each team plays 162 games in a season. Assume you have a division of five teams (call it the \u201cAL East\u201d) where each team is of exact equal ability. Specifically, each team has a 50 percent chance of winning each game. <em>What is the expected value of the number of wins for the team that finishes in first place?<\/em><\/p><\/blockquote>\n<p>The problem statement is a bit vague, so we must make some assumptions in order to solve the problem. Our first solution assumes that the win-loss records of the teams are mutually independent.<br>\n<a href=\"javascript:Solution('soln_baseballchamps','toggle_baseballchamps')\" id=\"toggle_baseballchamps\">[Show Solution]<\/a><\/p>\n<div id=\"soln_baseballchamps\" style=\"display: none\">\n<p>Our independence assumption basically reduces the AL East to a coin-flipping competition: each team flips 162 fair coins and counts the number of Heads obtained. The team with the most heads wins. In our second solution, we take a closer look at this assumption and discuss its validity.<\/p>\n<p>Let\u2019s say there are $m$ teams and each plays $n$ games. Let $Y_k$ be the number of wins obtained by team $k$. We\u2019d like to find the average number of wins obtained by the team with the most wins. In other words, if we define $Y = \\max(Y_1,\\dots,Y_m)$, we would like to find $\\mathbb{E}(Y)$. <strong>Note that multiple teams may be tied for first.<\/strong> If $p(y) = \\mathbb{P}(Y=y)$ is the probability mass function, we may rewrite our quantity of interest using cumulative distributions (CDFs).<\/p>\n<p>\\begin{align}<br>\n\\mathbb{E}(Y)<br>\n&amp;= \\sum_{y=0}^n y\\, p(y)<br>\n= \\sum_{y=0}^n \\sum_{z=0}^{y-1} p(y)<br>\n= \\sum_{z=0}^n \\sum_{y=z+1}^n p(y) \\\\<br>\n&amp;= \\sum_{z=0}^n\\left( 1 \u2013 \\sum_{y=0}^z p(y)\\right) \\\\<br>\n&amp;= \\sum_{z=0}^n\\bigl( 1 \u2013 \\mathbb{P}(Y \\le z)\\bigr)<br>\n\\end{align}<\/p>\n<p>Since $Y$ is the maximum over all $Y_k$, saying that $Y\\le z$ is equivalent to $Y_k \\le z$ holding for each $k$. Therefore:<\/p>\n<p>\\begin{align}<br>\n&amp;= \\sum_{z=0}^n\\bigl( 1 \u2013 \\mathbb{P}(Y_1 \\le z, Y_2 \\le z, \\dots, Y_m \\le z)\\bigr) \\\\<br>\n&amp;= \\sum_{z=0}^n\\bigl( 1 \u2013 \\mathbb{P}(Y_1 \\le z)\\mathbb{P}(Y_2 \\le z)\\cdots\\mathbb{P}(Y_m \\le z)\\bigr) \\\\<br>\n&amp;= \\sum_{z=0}^n\\bigl( 1 \u2013 \\mathbb{P}(Y_1 \\le z)^m \\bigr)<br>\n\\end{align}<\/p>\n<p>We made use of our independence assumption in the second equality, by stating that the joint cumulative distribution is equal to the product of cumulative distributions. In the third equality, we used the fact that each team has an identical win distribution, so each $\\mathbb{P}(Y_k \\le z)$ is the same for different $k$.<\/p>\n<p>Since the games played by a particular team are assumed to be independent <a href=\"https:\/\/en.wikipedia.org\/wiki\/Bernoulli_trial\">Bernoulli trials<\/a> (coin-flips), the probability of a team winning $y$ of its $n$ games has a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Binomial_distribution\">Binomial distribution<\/a> with probability mass function $p(y) = {n \\choose y} 2^{-n}$. Therefore, we have:<\/p>\n<p>\\[<br>\n\\mathbb{E}(Y) = \\sum_{z=0}^n\\left( 1 \\,-\\,  \\frac{1}{2^{mn}} \\left( \\sum_{y=0}^z {n \\choose y}\\right)^m \\right) = 88.3942\u2026<br>\n\\]<\/p>\n<p>Unfortunately, there is no way to simplify the expression further, so the numerical answer you see above is what you get when you substitute $n=162$ games and $m=5$ teams. One can also use the fact that Binomial distributions approach Normal distributions when the number of trials is high. Namely, $B(n,p) \\approx \\mathcal{N}(np,np(1-p))$. Using this approximation,<\/p>\n<p>\\[<br>\n\\mathbb{E}(Y) = \\int_0^\\infty \\left[ 1 \u2013 \\left(\\frac{2}{n\\pi}\\right)^{\\frac{m}{2}}<br>\n\\left( \\int_{-\\infty}^x e^{-\\frac{2}{n}\\left(y-\\frac{n}{2}\\right)^2} \\mathrm{d}y \\right)^m \\right] \\mathrm{d}x \\approx 88.4011<br>\n\\]<\/p>\n<p>It\u2019s a pretty good approximation to our first solution, but unfortunately not much easier to evaluate! For the curious among you, here is what the distribution of wins of the best team looks like:<\/p>\n<p><!--\nAnother thing we can do is compute the probability mass function so we can examine the distribution.\n\\begin{align}\np(z) &= \\mathbb{P}(Y \\le z) \\,-\\, \\mathbb{P}(Y \\le z-1) \\\\\n&= \\mathbb{P}(Y_1 \\le z)^m \\,-\\, \\mathbb{P}(Y_1 \\le z-1)^m \\\\\n&= \\frac{1}{2^{mn}} \\left[  \\left( \\sum_{y=0}^z {n \\choose y}\\right)^m - \\left( \\sum_{y=0}^{z-1} {n \\choose y}\\right)^m \\right]\n\\end{align}\n--><\/p>\n<p><a href=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2016\/05\/baseball.png\"><img decoding=\"async\" src=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2016\/05\/baseball.png\" alt=\"baseball\" width=\"798\" class=\"aligncenter size-full wp-image-374\" loading=\"lazy\" srcset=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2016\/05\/baseball.png 1020w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2016\/05\/baseball-300x85.png 300w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2016\/05\/baseball-768x217.png 768w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/a><\/p>\n<\/div>\n<p>This next solution explains how to tackle the more realistic case where the games are <em>not<\/em> played independently, and explains why the independence assumption is a good one for the AL East.<br>\n<a href=\"javascript:Solution('soln_baseballchamps2','toggle_baseballchamps2')\" id=\"toggle_baseballchamps2\">[Show Solution]<\/a><\/p>\n<div id=\"soln_baseballchamps2\" style=\"display: none\">\n<p>The coin-flipping assumption we previously used allowed for the (unlikely) possibility of all five teams winning all their games. But this isn\u2019t just unlikely, it\u2019s <em>impossible<\/em>. In reality, some of the teams will play each other, so it\u2019s impossible for every team to win every game. To illustrate this effect, let\u2019s imaging a simpler scenario with only 3 teams, and each team plays 60 games. In the first plot, I use the independent coin-flip assumption. In the second plot, I assume the teams play each other <em>exclusively<\/em>.<\/p>\n<p><a href=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2016\/05\/baseballsimple.png\"><img decoding=\"async\" src=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2016\/05\/baseballsimple.png\" alt=\"baseballsimple\" width=\"798\" class=\"aligncenter size-full wp-image-406\" loading=\"lazy\" srcset=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2016\/05\/baseballsimple.png 951w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2016\/05\/baseballsimple-300x172.png 300w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2016\/05\/baseballsimple-768x441.png 768w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/a><\/p>\n<p>The most notable difference is that in independent case, it\u2019s possible for a team to win the division despite only winning 29 of 60 games. This can\u2019t happen when the teams play each other, since there will always be at least one team that wins at least half of their games. In the first plot, the expected value is $33.27$ while in the second plot it is $34.01$, a little bit larger. This effect diminishes as we add more teams, or if we have an intermediate scenario (e.g. some fraction of games are played within the division while others are treated as independent coin flips).<\/p>\n<p><strong>Will we see a significant effect in the AL East?<\/strong> In a typical 162-game season, each of the five AL East teams plays 19 games against each of the other four teams for a total of 76 games. Out of the remaining 86 games, 66 are against out-of-division opponents and 20 are against out-of-league opponents. It turns out that the additional teams together with the significant proportion of out-of-division games ends up drowning out the difference between both distributions. In other words, the assumption that each team simply flips 162 coins turns out to be a good one.<\/p>\n<p>Here is one possible way to calculate the probabilities in the realistic case that accounts for inter-division games. Let\u2019s suppose team $i$ plays team $j$ a total of $g$ times. Let $X_{ij}$ be the number of games team $i$ wins in that matchup. Then we clearly have $X_{ij} + X_{ji} = g$. Let $Z_i$ be the out-of-division wins acquired by team $i$. Then the total number of wins by each team in the AL East is:<\/p>\n<p>\\begin{align}<br>\nY_k &amp;= Z_k + \\sum_{i\\ne k} X_{ki} \\\\<br>\n&amp;= Z_k + \\sum_{i=1}^{k-1} X_{ki} + \\sum_{i=k+1}^m X_{ki} \\\\<br>\n&amp;= Z_k + \\sum_{i=1}^{k-1} (g\\, \u2013 X_{ik}) + \\sum_{i=k+1}^m X_{ki} \\\\<br>\n\\end{align}<\/p>\n<p>So we have expressed $\\{Y_1,\\dots,Y_m\\}$ (which are not independent) in terms of $\\{X_{ij} \\mid 1 \\le i &lt; j \\le m\\}$ and $\\{Z_1,\\dots,Z_m\\}$, which are now independent. We\u2019ll compute the CDF of the maximum of the $Y_k$\u2019s as in the first solution. Using Bayes\u2019 theorem,<\/p>\n<p>\\begin{align}<br>\n\\mathbb{P}(Y \\le z)<br>\n&amp;= \\mathbb{P}( Y_1 \\le z,\\dots, Y_m \\le z ) \\\\<br>\n&amp;= \\mathbb{P}( Y_k \\le z \\mid X_{ij}, Y_k ) \\prod_{i &lt; j} \\mathbb{P}(X_{ij}) \\prod_{k=1}^m \\mathbb{P}(Z_k)<br>\n\\end{align}<\/p>\n<p>Note that $X_{ij} \\sim B(g,\\tfrac12)$ and $Z_k \\sim B(n-(m-1)g,\\tfrac12)$ because each team plays $(m-1)g$ in-division games and so the remaining $n-(m-1)g$ games are out-of-division. Define the region:<\/p>\n<p>\\begin{align}<br>\nD &amp;= \\left\\{ (x_{ij},z_k) \\,\\middle|\\, 0 \\le x_{ij} \\le g,\\quad 0 \\le z_k \\le n-(m-1)g \\right\\}\\\\<br>\nR(z) &amp;= \\left\\{ (x_{ij},z_k) \\,\\middle|\\,  z_k + \\sum_{i=0}^{k-1} (g\\, \u2013 x_{ik}) + \\sum_{i=k+1}^n x_{ki} \\le z\\,\\,\\forall k \\right\\}<br>\n\\end{align}<\/p>\n<p>So the distribution we seek is given by:<\/p>\n<p>\\begin{multline}<br>\n\\mathbb{P}(Y \\le z) \\\\<br>\n= \\frac{1}{2^{m(n-\\frac12 (m-1)g)}}  \\sum_{(x_{ij},z_k) \\in D \\cap  R(z)}  \\prod_{i &lt; j} {g \\choose x_{ij}} \\prod_{k = 1}^m {n \u2013 (m-1)g \\choose z_k}<br>\n\\end{multline}<\/p>\n<p>The region $D\\cap R(z)$ is simply a set of linear inequalities, so one could in principle evaluate the above sum. However, in the case of interest, $n=162$, $m=5$, and $g=19$, the sum has an astronomical number of terms, so some approximations are required to get an actual numerical answer in a reasonable amount of time. I\u2019ll spare the details, but suffice to say that we obtain a distribution that is virtually identical to the one we found in the first solution. So the coin-flipping assumption turns out to be a good one for the AL East schedule!<\/p>\n<\/div>\n<p><\/p>\n<\/body>","protected":false},"excerpt":{"rendered":"<p>Today\u2019s post is a Riddler problem about baseball, and it goes like this: Assume you have a sport (let\u2019s call it \u201cbaseball\u201d) in which each team plays 162 games in a season. Assume you have a division of five teams (call it the \u201cAL East\u201d) where each team is of exact equal ability. Specifically, each &hellip; <a href=\"https:\/\/laurentlessard.com\/bookproofs\/baseball-division-champs\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Baseball division champs&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[7],"tags":[9,8,2],"class_list":["post-296","post","type-post","status-publish","format-standard","hentry","category-riddler","tag-binomial","tag-probability","tag-riddler"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/posts\/296","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/comments?post=296"}],"version-history":[{"count":133,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/posts\/296\/revisions"}],"predecessor-version":[{"id":447,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/posts\/296\/revisions\/447"}],"wp:attachment":[{"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/media?parent=296"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/categories?post=296"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/tags?post=296"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}