{"id":241,"date":"2020-01-24T01:42:15","date_gmt":"2020-01-24T01:42:15","guid":{"rendered":"http:\/\/www.stattosoftware.com\/consulting\/?p=241"},"modified":"2020-01-24T01:42:15","modified_gmt":"2020-01-24T01:42:15","slug":"afl-the-complete-winning-percentage-lookup-table","status":"publish","type":"post","link":"https:\/\/www.stattosoftware.com\/consulting\/2020\/01\/24\/afl-the-complete-winning-percentage-lookup-table\/","title":{"rendered":"AFL: The complete winning percentage lookup table"},"content":{"rendered":"<p>5.6 billion Aussie rules games, simulated on an off-the-shelf laptop.<\/p>\n<p>In the work on leverage I&#8217;ve done over the past couple of months, I figured there&#8217;s a fixed winning percentage given the minute, the margin, and a team&#8217;s initial (estimated) winning percentage. I also figured this could be easily achieved through simulation.<\/p>\n<p>I simulated 10,000 games for each minute, margin (within 12 goals), and initial winning percentage to get the estimated winning percentage, in order to create a master table of winning percentages which can be used by anyone. While computers are amazing, lookup tables still definitely have their uses.<\/p>\n<h4>Methodology<\/h4>\n<p>The simulator made some basic assumptions: there was a 52.4% chance of a scoring shot in any given minute, and an additional 6.8% chance of an additional, second scoring shot, based on 2019 data scraped from afltables.com. I did not simulate a third scoring shot, which is possible but very rare, because I only found two or three instances of that in the data set. I didn&#8217;t check to make sure there wasn&#8217;t a string of behinds which generated that event chain, simply choosing to ignore it completely.<\/p>\n<p>The simulator also translated the winning percentage into expected goals using a best-fit line from spreads using Squiggle AFL. Unfortunately, this did not work well as the winning percentage increased, as I had less data for predicted blowouts, so I ended up using trial and error to figure out which values corresponded with the initial winning percentage (if the initial winning percentage is 98%, the favourite should win roughly 9800 out of 10,000 games in all instances, just as a team with a 51% chance to win should win roughly 5100 out of 10,000 games.)<\/p>\n<p>I ended up using a fourth-order polynomial equation to generate expected goals for percentages greater than 82%, and it matched very well at the initial win percentage. An 80% win percentage with a tie score at the start of the game averaged out to 79.9% over 10,000,000 simulations, with a standard deviation of only 41 wins, and no simulation more than 1.5% away from the 80%. Similar results existed at the 90% mark, though this was skewed slightly above 90% and had a slightly lower standard deviation. Because of the margin of error involved, I would not use this data set to bet on any game below a certain threshold.<\/p>\n<p>I also wrote the simulator in php.<\/p>\n<p>In 2012, I was tasked with taking a large data set from a website, parsing it for updates, and then emailing a spreadsheet to my boss, who would present the spreadsheet at a daily 8:30am meeting. I wrote a php script which worked quickly and wonderfully.<\/p>\n<p>We hired someone with Silicon Valley credentials who asked me what I was doing and asked why I wasn&#8217;t using Python to run the script. I told him it was because I didn&#8217;t know Python that well yet (true) and that php was an order of magnitude faster (also true.) He ended up taking the project off my hands and re-writing it in Python even though the rewrite conveyed no benefit whatsoever, apart, apparently, from the fact it was in Python.<\/p>\n<p>I ended up re-writing the simulator in php. After letting it run overnight, it had almost finished. By my timer, Python would have taken several days. I then fed the finished data set into Python and graphed it.<\/p>\n<p>Finally, I ended up simulating margins which could only be considered theoretical, such as being down by 12 goals in the first minute. I thought the information would be very valuable in determining initial spreads given a win percentage. How many goals down does the favourite have to be to have a 50-50% of winning the match?<\/p>\n<h4>Findings<\/h4>\n<p>Because the data is four-dimensional, it&#8217;s obviously not the easiest to graph as an entire data set, but if you hold one or two of the values constant, there are wonderful graphs to be made.<\/p>\n<p>For instance, holding the margin constant at zero shows how the longer the underdog can keep the game tied, the more likely the favourite won&#8217;t win. While that&#8217;s an obvious conclusion, what&#8217;s interesting to me is just how even the game becomes if tied in the last ten minutes. Also note the noise.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"244\" data-permalink=\"https:\/\/www.stattosoftware.com\/consulting\/2020\/01\/24\/afl-the-complete-winning-percentage-lookup-table\/winpct_final\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.stattosoftware.com\/consulting\/wp-content\/uploads\/2020\/01\/winpct_final.png?fit=800%2C600&amp;ssl=1\" data-orig-size=\"800,600\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"winpct_final\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/www.stattosoftware.com\/consulting\/wp-content\/uploads\/2020\/01\/winpct_final.png?fit=300%2C225&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/www.stattosoftware.com\/consulting\/wp-content\/uploads\/2020\/01\/winpct_final.png?fit=640%2C480&amp;ssl=1\" class=\"alignnone size-full wp-image-244\" src=\"https:\/\/i0.wp.com\/www.stattosoftware.com\/consulting\/wp-content\/uploads\/2020\/01\/winpct_final.png?resize=640%2C480\" alt=\"\" width=\"640\" height=\"480\" srcset=\"https:\/\/i0.wp.com\/www.stattosoftware.com\/consulting\/wp-content\/uploads\/2020\/01\/winpct_final.png?w=800&amp;ssl=1 800w, https:\/\/i0.wp.com\/www.stattosoftware.com\/consulting\/wp-content\/uploads\/2020\/01\/winpct_final.png?resize=300%2C225&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.stattosoftware.com\/consulting\/wp-content\/uploads\/2020\/01\/winpct_final.png?resize=768%2C576&amp;ssl=1 768w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>I found the initial winning percentages interesting as well. The simulator predicts a team with an 85% initial winning percentage should win by five goals 50% of the time, as the simulator predicts the spread to be 30 points. At 90%, the spread should be six goals, increasing dramatically to 99%, which the simulator estimates would be a 12-goal initial spread. The 99% team would also still be favoured to win if they were down by five goals or less at halftime. Unfortunately, I don&#8217;t have betting data to look at to see if this holds true over time.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"243\" data-permalink=\"https:\/\/www.stattosoftware.com\/consulting\/2020\/01\/24\/afl-the-complete-winning-percentage-lookup-table\/winpct_equality\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.stattosoftware.com\/consulting\/wp-content\/uploads\/2020\/01\/winpct_equality.png?fit=800%2C600&amp;ssl=1\" data-orig-size=\"800,600\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"winpct_equality\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/www.stattosoftware.com\/consulting\/wp-content\/uploads\/2020\/01\/winpct_equality.png?fit=300%2C225&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/www.stattosoftware.com\/consulting\/wp-content\/uploads\/2020\/01\/winpct_equality.png?fit=640%2C480&amp;ssl=1\" class=\"alignnone size-full wp-image-243\" src=\"https:\/\/i0.wp.com\/www.stattosoftware.com\/consulting\/wp-content\/uploads\/2020\/01\/winpct_equality.png?resize=640%2C480\" alt=\"\" width=\"640\" height=\"480\" srcset=\"https:\/\/i0.wp.com\/www.stattosoftware.com\/consulting\/wp-content\/uploads\/2020\/01\/winpct_equality.png?w=800&amp;ssl=1 800w, https:\/\/i0.wp.com\/www.stattosoftware.com\/consulting\/wp-content\/uploads\/2020\/01\/winpct_equality.png?resize=300%2C225&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.stattosoftware.com\/consulting\/wp-content\/uploads\/2020\/01\/winpct_equality.png?resize=768%2C576&amp;ssl=1 768w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>These are just a couple of the stories you can tell from the simulated data set &#8211; if you come up with any more on your own, I&#8217;d love to read about them.<\/p>\n<h4>Download<\/h4>\n<p>I&#8217;ve put both the PHP code and the final table up at <a href=\"https:\/\/github.com\/johnpholden\/afl-leverage-simulator\">https:\/\/github.com\/johnpholden\/afl-leverage-simulator<\/a>. I just noticed the &#8220;home team&#8221; should be labeled &#8220;favourite&#8221; and the &#8220;away team&#8221; should be labeled &#8220;underdog&#8221; in the table.<\/p>\n<p>If you end up using the table or code, or performing any sort of statistical analysis on this, please let me know.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>5.6 billion Aussie rules games, simulated on an off-the-shelf laptop. In the work on leverage I&#8217;ve done over the past couple of months, I figured there&#8217;s a fixed winning percentage given the minute, the margin, and a team&#8217;s initial (estimated) winning percentage. I also figured this could be easily achieved through simulation. I simulated 10,000 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.stattosoftware.com\/consulting\/2020\/01\/24\/afl-the-complete-winning-percentage-lookup-table\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;AFL: The complete winning percentage lookup table&#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,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[9,7],"tags":[],"class_list":["post-241","post","type-post","status-publish","format-standard","hentry","category-australian-rules-football","category-sports-analytics","entry"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pbkw4b-3T","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.stattosoftware.com\/consulting\/wp-json\/wp\/v2\/posts\/241","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.stattosoftware.com\/consulting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.stattosoftware.com\/consulting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.stattosoftware.com\/consulting\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.stattosoftware.com\/consulting\/wp-json\/wp\/v2\/comments?post=241"}],"version-history":[{"count":2,"href":"https:\/\/www.stattosoftware.com\/consulting\/wp-json\/wp\/v2\/posts\/241\/revisions"}],"predecessor-version":[{"id":245,"href":"https:\/\/www.stattosoftware.com\/consulting\/wp-json\/wp\/v2\/posts\/241\/revisions\/245"}],"wp:attachment":[{"href":"https:\/\/www.stattosoftware.com\/consulting\/wp-json\/wp\/v2\/media?parent=241"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.stattosoftware.com\/consulting\/wp-json\/wp\/v2\/categories?post=241"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.stattosoftware.com\/consulting\/wp-json\/wp\/v2\/tags?post=241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}