{"id":2342,"date":"2014-01-27T09:57:05","date_gmt":"2014-01-27T14:57:05","guid":{"rendered":"http:\/\/2d823b65bb.nxcli.io\/?p=2342"},"modified":"2014-01-27T09:57:05","modified_gmt":"2014-01-27T14:57:05","slug":"first-move-advantage-in-chess","status":"publish","type":"post","link":"https:\/\/www.robweir.com\/blog\/2014\/01\/first-move-advantage-in-chess.html","title":{"rendered":"First Move Advantage in Chess"},"content":{"rendered":"<h3>The Elo Rating System<\/h3>\n<p>Competitive chess players, at the amateur club level all the way through the top grandmasters, receive ratings based on their performance in games.\u00a0\u00a0 The ratings formula in use since 1960 is based on a model first proposed by the Hungarian-American physicist <a href=\"http:\/\/en.wikipedia.org\/wiki\/Arpad_Elo\">Arpad Elo<\/a>.\u00a0 It uses a logistic equation to estimate the probability of a player winning as a function of that player&#8217;s rating advantage over his opponent:<\/p>\n<p>$latex E = \\frac 1 {1 + 10^{-\\Delta R\/400}}&amp;s=3$<\/p>\n<p>So for example, if you play an opponent who out-rates you by 200 points then your chances of winning are only 24%.<\/p>\n<p>After each tournament, game results are fed back to a national or international rating agency and the ratings adjusted.\u00a0 If you scored better than expected against the level of opposition played your rating goes up.\u00a0 If you did worse it goes down.\u00a0 Winning against an opponent much weaker than you will lift your rating little.\u00a0 Defeating a higher-rated opponent will raise your rating more.<\/p>\n<p>That&#8217;s the basics of the Elo rating system, in its pure form.\u00a0 In practice it is slightly modified, with ratings floors, bootstrapping new unrated\u00a0 players, etc.\u00a0 But that is its essence.<\/p>\n<h3>Measuring the First Mover Advantage<\/h3>\n<p>It has long been known that the player that moves first, conventionally called &#8220;white&#8221;, has a slight advantage, due to their ability to develop their pieces faster and their greater ability to coax the opening phase of the game toward a system that they prefer.<\/p>\n<p>So how can we show this advantage using a lot of data?<\/p>\n<p>I started with a Chessbase database of\u00a0 1,687,282 chess games, played from 2000-2013.\u00a0\u00a0 All games had a minimum rating of 2000 (a good club player).\u00a0 I excluded all computer games.\u00a0\u00a0 I also excluded 0 or 1 move games, which usually indicate a default (a player not showing up for an assigned game) or a bye.\u00a0 I exported the games to <a href=\"http:\/\/en.wikipedia.org\/wiki\/Portable_Game_Notation\">PGN<\/a> format and extracted the metadata for each game to a CSV file via a python script.\u00a0 Additional processing was then done in R.<\/p>\n<p>Looking at the distribution of ratings differences (white Elo-black Elo) we get this.\u00a0 Two oddities to note.\u00a0 First note the excess of games with a ratings difference of exactly zero.\u00a0 I&#8217;m not sure what caused that, but since only 0.3% of games had this property, I ignored it.\u00a0\u00a0 Also there is clearly a &#8220;fringe&#8221; of excess counts for ratings that are exactly multiples of 5.\u00a0 This suggests some quantization effect in some of the ratings, but should not harm the following analysis.<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/2d823b65bb.nxcli.io\/blog\/images\/chess\/count-by-diff.png\" \/><br \/>\n<img decoding=\"async\" alt=\"\" src=\"https:\/\/2d823b65bb.nxcli.io\/blog\/images\/chess\/count-by-rating.png\" \/><\/p>\n<p>The collection has results of:<\/p>\n<ul>\n<li>1-0 (36.4%)<\/li>\n<li>1\/2-1\/2 (35.5%)<\/li>\n<li>0-1 (28.1%)<\/li>\n<\/ul>\n<p>So the overall score, from white&#8217;s perspective was 54.2% (counting a win as 1 point and a draw as 0.5 points).<\/p>\n<p>So white as a 4.2% first move advantage, yes?\u00a0 Not so fast.\u00a0\u00a0 A look at the average ratings in the games shows:<\/p>\n<ul>\n<li>mean white Elo: 2312<\/li>\n<li>mean black Elo: 2309<\/li>\n<\/ul>\n<p>So on average white was slightly higher rated than black in these games.\u00a0 A t-test indicated that the difference in means was significant to the 95% confidence level.\u00a0 So we&#8217;ll need to do some more work to tease out the actual advantage for white.<\/p>\n<h3><\/h3>\n<h3>Looking for a Performance Advantage<\/h3>\n<p>I took the data and binned it by ratings difference, from -400 to 400, and for each difference I calculated the expected score, per the Elo formula, and the average actual score in games played with that ratings difference.\u00a0\u00a0 The following chart shows the black circles for the actual scores and a red line for the predicted score.\u00a0 Again, this is from white&#8217;s perspective.\u00a0\u00a0 Clearly the actual score is above the expected score for most of the range.\u00a0\u00a0 In fact white appears evenly matched even when playing against an opponent 35-points higher.<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/2d823b65bb.nxcli.io\/blog\/images\/chess\/score-by-diff.png\" \/><\/p>\n<p>The trend is a bit clearer of we look at the &#8220;excess score&#8221;, the amount by which white&#8217;s results exceed the expected results.\u00a0 In the following chart the average excess score is indicated by a dotted line at y=0.034.\u00a0 So the average performance advantage for white, accounting for the strength of opposition, was around 3.4%.\u00a0 But note how the advantage is strongest where white is playing a slightly stronger player.<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/2d823b65bb.nxcli.io\/blog\/images\/chess\/excess-by-diff.png\" \/><\/p>\n<p>Finally I looked at the actual game results, the distribution of wins, draws and losses, by ratings differences.\u00a0 The Elo formula doesn&#8217;t speak to this.\u00a0 It deals with expected scores.\u00a0 But in the real world one cannot score 0.8 in a game.\u00a0\u00a0 There are only three options:\u00a0 win, draw or lose.\u00a0 In this chart you see the first mover advantage in another way.\u00a0 The entire range of outcomes is essentially shifted over to the left by 35 points.<br \/>\n<img decoding=\"async\" alt=\"\" src=\"https:\/\/2d823b65bb.nxcli.io\/blog\/images\/chess\/results-by-diff.png\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Elo Rating System Competitive chess players, at the amateur club level all the way through the top grandmasters, receive ratings based on their performance in games.\u00a0\u00a0 The ratings formula in use since 1960 is based on a model first proposed by the Hungarian-American physicist Arpad Elo.\u00a0 It uses a logistic equation to estimate the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[216,217],"tags":[227],"class_list":{"0":"post-2342","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-chess","7":"category-r","8":"tag-chess","9":"entry"},"_links":{"self":[{"href":"https:\/\/www.robweir.com\/blog\/wp-json\/wp\/v2\/posts\/2342","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.robweir.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.robweir.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.robweir.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.robweir.com\/blog\/wp-json\/wp\/v2\/comments?post=2342"}],"version-history":[{"count":22,"href":"https:\/\/www.robweir.com\/blog\/wp-json\/wp\/v2\/posts\/2342\/revisions"}],"predecessor-version":[{"id":2364,"href":"https:\/\/www.robweir.com\/blog\/wp-json\/wp\/v2\/posts\/2342\/revisions\/2364"}],"wp:attachment":[{"href":"https:\/\/www.robweir.com\/blog\/wp-json\/wp\/v2\/media?parent=2342"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.robweir.com\/blog\/wp-json\/wp\/v2\/categories?post=2342"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.robweir.com\/blog\/wp-json\/wp\/v2\/tags?post=2342"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}