{"id":38,"date":"2015-01-04T20:34:02","date_gmt":"2015-01-04T20:34:02","guid":{"rendered":"http:\/\/blog.rickstafford.com\/?p=38"},"modified":"2015-01-04T20:54:47","modified_gmt":"2015-01-04T20:54:47","slug":"who-will-get-to-europe","status":"publish","type":"post","link":"http:\/\/blog.rickstafford.com\/?p=38","title":{"rendered":"Who will get to Europe?"},"content":{"rendered":"<p>The UK football season is just over halfway through its year. The top four teams will qualify for the European Champions league, and that means a lot of money. So, what is the probability that any given team will actually qualify? We have a league table, giving positions and points of each team, so we have some knowledge of the season so far, current form of the teams and so on. So how can I calculate the probability that a team will qualify? For my Bayesian belief network I want some prior values \u2013 probabilities between 0 and 1 that this may occur.<\/p>\n<p>My solution is this:<\/p>\n<p>I work out the overall form of the team this season (I am not considering current form, recent form, changes in management or anything else at the moment).<\/p>\n<p>Prob of winning = Games Won \/ Games Played<\/p>\n<p>And the same for drawing and losing<\/p>\n<p>I then simulate all remaining games (18 for each team on the 4th Jan)<\/p>\n<p>Suppose I take Chelsea, currently top of the table:<\/p>\n<p>Won 14, drawn 4, lost 2<\/p>\n<p>Prob of winning = 14\/20 = 0.7<br \/>\nProb of drawing = 4\/20 = 0.2<br \/>\nProb of losing = 2\/20 = 0.1<\/p>\n<p>So for each game, I generate a random number between 0 and 1. If it is less than 0.1, I assume they lose, if it is between 0.1 and 0.3, they draw, if it is over 0.3, they win.<\/p>\n<p>I do this for all 20 teams, then calculate their points (3 for each win, 1 for each draw). I then pick the highest four teams. As I am only interested in the top four teams, I am not worried if aspects of these calculations are not fully correct \u2013 for example, in this calculation, all the top teams could (although it is unlikely) win all their remaining games. In practice, this could not happen, as they will have to play each other and they can\u2019t all win these games. <\/p>\n<p>Since this is all highly stochastic, I run the simulation 10,000 times and calculate the percentage of times each team ends up in the top four \u2013 this gives me my probability.<\/p>\n<p>So, for those of you interested, here are the probabilities \u2013 if your team isn\u2019t here, then they have no chance, sorry\u2026.<\/p>\n<p>Arsenal \u2013 20.01%<br \/>\nChelsea    &#8211; 99.99%<br \/>\nLiverpool    &#8211; 2.19%<br \/>\nMan City    &#8211; 99.99%<br \/>\nMan United   &#8211; 71.53%<br \/>\nNewcastle   &#8211; 0.32%<br \/>\nSouthampton \u2013 59.54%<br \/>\nStoke City  &#8211; 0.19%<br \/>\nSwansea City \u2013 2.12%<br \/>\nTottenham    &#8211; 31.12%<br \/>\nWest Ham \u2013 13.00%<\/p>\n<p>The R code for the calculations may be horribly inefficient, but is available <a href=\"http:\/\/www.rickstafford.com\/software\/prem.r\">here <\/a>(it took an hour to calculate, so if you want to play with it, then reduce the bootstrap size).<\/p>\n<p>The league table as of the 4th Jan \u2013 formatted for the R code \u2013 is <a href=\"http:\/\/www.rickstafford.com\/software\/Prem4Jan15.csv\">here<\/a>.<\/p>\n<p>Of course, there should be consideration of new players, current form, new managers and so on, and that is something which can be built on, now I have my probabilities. More to come on this in the next few days<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The UK football season is just over halfway through its year. The top four teams will qualify for the European Champions league, and that means a lot of money. So, what is the probability that any given team will actually &hellip; <a href=\"http:\/\/blog.rickstafford.com\/?p=38\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/blog.rickstafford.com\/index.php?rest_route=\/wp\/v2\/posts\/38"}],"collection":[{"href":"http:\/\/blog.rickstafford.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.rickstafford.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.rickstafford.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.rickstafford.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=38"}],"version-history":[{"count":5,"href":"http:\/\/blog.rickstafford.com\/index.php?rest_route=\/wp\/v2\/posts\/38\/revisions"}],"predecessor-version":[{"id":43,"href":"http:\/\/blog.rickstafford.com\/index.php?rest_route=\/wp\/v2\/posts\/38\/revisions\/43"}],"wp:attachment":[{"href":"http:\/\/blog.rickstafford.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=38"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.rickstafford.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=38"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.rickstafford.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=38"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}