{"id":8154,"date":"2013-07-20T10:34:23","date_gmt":"2013-07-20T14:34:23","guid":{"rendered":"http:\/\/scienceblogs.com\/principles\/?p=8154"},"modified":"2013-07-20T10:34:23","modified_gmt":"2013-07-20T14:34:23","slug":"baseball-is-pretty-random","status":"publish","type":"post","link":"http:\/\/chadorzel.com\/principles\/2013\/07\/20\/baseball-is-pretty-random\/","title":{"rendered":"Baseball Is Pretty Random"},"content":{"rendered":"<p>After Thursday&#8217;s post about <a href=\"http:\/\/scienceblogs.com\/principles\/2013\/07\/18\/sports-and-statistics-nobody-deals-well-with-randomness\/\">sports and statistics<\/a>, a friend from my Williams days, Dave Ryan, raised an objection on Facebook:<\/p>\n<blockquote>\n<p>There&#8217;s an unstated assumption (I think) in your analysis: that there is some intrinsic and UNALTERABLE statistical probability of getting a hit inherent in every hitter. If that is the case, then yes &#8212; a hitter whose mean is .274 that hits .330 in the first half should, reasonably, be expected to regress towards the &#8220;true&#8221; outcome of .274 in the second half; and if the hitter winds up batting .330, it&#8217;s a statistical outlier. But that ONLY applies if the underlying probability is unalterable. Which, in baseball, isn&#8217;t something you can just blithely assume. Hitters can and do get better (or worse) through coaching, experience, PEDs, or what have you. And when the mean itself is malleable, you can&#8217;t dismiss Kornheiser as just ignorant of statistical regression.<\/p>\n<\/blockquote>\n<p>That&#8217;s a good point, and as someone who has played a lot of sports (though not much baseball&#8211; I suck at pretty much any game involving hitting a ball with a stick), I would certainly like to believe that there are real changes in the underlying distributions. I mean, it certainly <em>feels<\/em> like there are days when I&#8217;m shooting the basketball better than others, and thus there&#8217;s a higher probability of a given shot going in.<\/p>\n<p>The problem, of course, is showing that scientifically, which turns out to be damnably difficult. This is related to the famous <a href=\"http:\/\/scienceblogs.com\/principles\/2011\/05\/09\/on-the-hot-hand\/\">&#8220;hot hand&#8221; problem<\/a>, and nobody has really managed to find any evidence that this kind of effect exists.<\/p>\n<p>But the question at hand dealt with baseball, and changes in the underlying &#8220;real&#8221; batting average for a player. So let&#8217;s see if we can learn anything about this, armed with some really rudimentary statistical knowledge, and some historical statistics for players chosen not quite at random from the <a href=\"http:\/\/www.baseball-reference.com\/leaders\/batting_avg_career.shtml\">career batting average list<\/a>.<\/p>\n<p>I&#8217;m sure a bunch of different sabremetric geeks have done vastly more comprehensive studies of this, but for the purposes of this blog, we&#8217;re going to settle for plural anecdotes. I went down that list and picked a half-dozen players out to look at: guys who have had fairly long careers, are generally good hitters, if not at the very top of the career average list, and are names that I recognize despite not really being a baseball fan. The six I picked were: Barry Bonds and Alex Rodriguez (because Dave mentioned drugs as a driver of changes in hitting percentages), Chipper Jones and Derek Jeter (because to the limited extent that I follow baseball, I root for the Yankees, and I have a cousin in Atlanta who&#8217;s a big Braves fan), Cal Ripken, Jr (because I was living in Maryland during the year when he single-handedly saved baseball), and Ichiro Suzuki (because he&#8217;s famously a somewhat different sort of hitter, getting lots of singles off his great speed, but not hitting much for power). That seems like enough guys to make a point of some sort, but not so many that wrestling them all through Excel makes me want to claw my eyes out.<\/p>\n<p>So, the question is whether we can see changes in the underlying probability of random processes from these data, in a way that is clearly distinct from random statistical fluctuations about a single unchanging average. So here&#8217;s a graph of the batting average for each season (the blue points) compared to each player&#8217;s career average (click for a version that&#8217;s large enough to read clearly):<\/p>\n<figure id=\"attachment_8152\" aria-describedby=\"caption-attachment-8152\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/scienceblogs.com\/principles\/files\/2013\/07\/career_average_comp.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/scienceblogs.com\/principles\/files\/2013\/07\/sm_career_average_comp.png\" alt=\"Batting averages compared to career totals for six famous players.\" width=\"500\" height=\"408\" class=\"size-full wp-image-8152\" srcset=\"http:\/\/chadorzel.com\/principles\/wp-content\/uploads\/2013\/07\/sm_career_average_comp.png 500w, http:\/\/chadorzel.com\/principles\/wp-content\/uploads\/2013\/07\/sm_career_average_comp-300x245.png 300w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/a><figcaption id=\"caption-attachment-8152\" class=\"wp-caption-text\">Batting averages compared to career totals for six famous players.<\/figcaption><\/figure>\n<p>Those are the data we have to work with, so how would we go about determining whether there&#8217;s a real change in the underlying probability of one of these guys getting a hit from season to season? The problem, of course, is that even if there&#8217;s an absolutely fixed probability that does not change over the course of a player&#8217;s career, there will be year-to-year fluctuations just from what you would call &#8220;shot noise&#8221; in electrical engineering or quantum optics: because a season consists of several hundred attempts to hit the ball with some probability, you will inevitably get a one-season average that bounces around a bit&#8211; if each at-bat is random, you&#8217;ll get occasional &#8220;hot&#8221; and &#8220;cold&#8221; streaks naturaly.<\/p>\n<p>The bouncing around can be characterized by a standard deviation, and as I mentioned in the last post, this is roughly equal to the square root of the number of hits divided by the number of at-bats. For these guys, those values come out to be around 0.02 for any given season. The horizontal grid lines on the graph are spaced by 0.02 units, so roughly one standard deviation each.<\/p>\n<p>Now, for each player, you can see a bunch of points that are more than one grid line away from the horizontal line indicating the career average, which you might be tempted to cite as evidence that there are real changes. Except that&#8217;s not how it works&#8211; really, you expect 68% of normally distributed measurements to fall within one standard deviation of the mean, so roughly one-third of the measurements ought to be outside that range just due to natural fluctuations (assuming the underlying random process fits a normal-ish distribution, which is generally a good place to start).<\/p>\n<p>(This is forever fixed in my mind, by the way, because I got nailed by Bill Phillips on this point when giving a presentation on some of the data for my thesis&#8211; I put up a graph of collision rate measurements with error bars, and he objected that the theory line went through too many of the error bars. He was right&#8211; I had calculated the errors in a way that was a little too conservative&#8211; and he was also one of a very small set of people who ever would&#8217;ve raised that objection&#8230;)<\/p>\n<p>So, the question isn&#8217;t whether there are <em>any<\/em> points outside the nominal uncertainty range, but whether there are <em>too many<\/em> points outside that range. You can count points on those graphs if you want, but I calculated it a little more accurately in Excel, and the fraction of single-season batting averages outside the one-standard-deviation range of the career batting average are:<\/p>\n<ul>\n<li>Bonds: 0.476<\/li>\n<li>Rodriguez: 0.235<\/li>\n<li>Jones: 0.412<\/li>\n<li>Jeter: 0.294<\/li>\n<li>Ripken: 0.444<\/li>\n<li>Suzuki: 0.538<\/li>\n<\/ul>\n<p>If this were <cite>Mythbusters<\/cite>, they&#8217;d probably say that the fact that none of these are the 0.32 you would expect from a perfect normal distribution indicates that they&#8217;re way off. But, really, with the exception of Bonds and Suzuki, those are not that far off. And if you excluded Bonds&#8217;s first four years, he&#8217;d be at 0.412, in line with the others.<\/p>\n<p>If you want to talk about real changes in underlying distributions from these, there are four things you might point to: Bonds&#8217;s first four years (where he seems to trend sharply upward before reaching a plateau), Bonds&#8217;s peak steroid era (the cluster of high points toward the end of his run), and the last three years for both Rodriguez and Suzuki, who have been well below their prior averages for those years. The only one of those that&#8217;s really dramatic, in a statistical sense, is Suzuki&#8217;s, as he&#8217;s been at least two standard deviations off for three years running. Bonds&#8217;s steroid years are close to that, but not out of line with previous fluctuations, and Rodriguez&#8217;s recent slump is a little more marginal.<\/p>\n<p>Meanwhile, Jeter, Jones, and Ripken are indistinguishable from robots.<\/p>\n<p>Another way you might try to look at it is to ask what the actual standard deviation in the average of averages is. I&#8217;ll give two numbers for each of these: the first is the standard deviation of the actual set of annual batting averages, the second is an average of the standard deviations you would expect based on shot noise in the number of hits for each of those seasons.<\/p>\n<ul>\n<li>Bonds: 0.036 &#8211; 0.026<\/li>\n<li>Rodriguez: 0.022 &#8211; 0.023<\/li>\n<li>Jones: 0.030 &#8211; 0.025<\/li>\n<li>Jeter: 0.021 &#8211; 0.023<\/li>\n<li>Ripken: 0.025 &#8211; 0.021<\/li>\n<li>Suzuki: 0.033 &#8211; 0.022<\/li>\n<\/ul>\n<p>Again, those are pretty close to what you would expect from pure randomness. If you excluded Suzuki&#8217;s last three years, he&#8217;d drop to 0.023, and excluding Bond&#8217;s first four years would bring him down to 0.030, while knocking out the steroid years would bring him to 0.028. If there&#8217;s anything real happening, those would be the spots to look.<\/p>\n<p>But it&#8217;s important to note that these are very, very small datasets as statistical samples go. Throwing out four years from Bonds&#8217;s career is better than 15% of the total data, and he&#8217;s got the longest career of any of these guys. So it&#8217;s very dicey to start talking about breaking out still smaller subsets of these. And there&#8217;s not a whole lot you can point to, in an objective mathematical sense, to suggest that any of these guys have really seen significant changes that would depart from the notion of an unchanging and innate &#8220;batting average&#8221; over the course of their whole career.<\/p>\n<p>One additional thing you might look at to see if there&#8217;s change happening is to compare individual years not to a career-long total average, but some sort of cumulative average up to that point in their career (that is, total career hits divided by total career at-bats for the years prior to the one being measured). Those data look like this:<\/p>\n<figure id=\"attachment_8150\" aria-describedby=\"caption-attachment-8150\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/scienceblogs.com\/principles\/files\/2013\/07\/cumulative_average_comp.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/scienceblogs.com\/principles\/files\/2013\/07\/sm_cumulative_average_comp.png\" alt=\"Batting average compared to cumulative average to that point for six famous players.\" width=\"500\" height=\"408\" class=\"size-full wp-image-8150\" srcset=\"http:\/\/chadorzel.com\/principles\/wp-content\/uploads\/2013\/07\/sm_cumulative_average_comp.png 500w, http:\/\/chadorzel.com\/principles\/wp-content\/uploads\/2013\/07\/sm_cumulative_average_comp-300x245.png 300w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/a><figcaption id=\"caption-attachment-8150\" class=\"wp-caption-text\">Batting average compared to cumulative average to that point for six famous players.<\/figcaption><\/figure>\n<p>There are two things to look for here: one is whether it does a better job of matching the data generally, which might suggest that it&#8217;s tracking a slow but real change that isn&#8217;t captured by a career-long average. The other is that it might make discontinuous changes departing from a long-term trend stand out more.<\/p>\n<p>Again, this is pretty equivocal. The one dramatic effect this has is to do a better job matching Bonds&#8217;s first few years (because they dominate the cumulative average during that span), but this actually makes his steroid years look slightly worse. The others don&#8217;t really change much (and really, any counting of discontinuous changes ought to ignore the first few years, where the cumulative average is pretty bad, but then you&#8217;re into the too-little-data problem again).<\/p>\n<p>So, what&#8217;s the take-home from this? Well, that baseball is pretty random, at least at the really rudimentary statistical level used here. It&#8217;s very hard to rule out a model where players really have a single innate &#8220;batting average&#8221; that they keep for their whole career in favor of a model where that innate average changes over time.<\/p>\n<p>The other thing to note here is that this is a valuable reminder that statistical methods demand <em>really big<\/em> datasets. Even baseball, with its interminably long season of games that drag on forever, doesn&#8217;t really produce enough statistics to have all that much confidence in the averages&#8211; these are guys with long and distinguished careers, but only two of them (Jeter and Ripken) have managed 10,000 at-bats. Even on that scale, you have an uncertainty of around 0.005 in their career-long batting average. That uncertainty is much larger for shorter spans&#8211; over 0.020 for a single season&#8211; and that means that it&#8217;s just not possible to statistically detect real changes from season to season, let alone within the course of a single season. No matter how much we might like to use those random numbers to construct narratives of change.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After Thursday&#8217;s post about sports and statistics, a friend from my Williams days, Dave Ryan, raised an objection on Facebook: There&#8217;s an unstated assumption (I think) in your analysis: that there is some intrinsic and UNALTERABLE statistical probability of getting a hit inherent in every hitter. If that is the case, then yes &#8212; a&hellip; <a class=\"more-link\" href=\"http:\/\/chadorzel.com\/principles\/2013\/07\/20\/baseball-is-pretty-random\/\">Continue reading <span class=\"screen-reader-text\">Baseball Is Pretty Random<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":8152,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[663,9,7,147,11,27],"tags":[],"class_list":["post-8154","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-everyday","category-math","category-physics","category-playing-with-graphs","category-science","category-sports","entry"],"_links":{"self":[{"href":"http:\/\/chadorzel.com\/principles\/wp-json\/wp\/v2\/posts\/8154","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/chadorzel.com\/principles\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/chadorzel.com\/principles\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/chadorzel.com\/principles\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/chadorzel.com\/principles\/wp-json\/wp\/v2\/comments?post=8154"}],"version-history":[{"count":0,"href":"http:\/\/chadorzel.com\/principles\/wp-json\/wp\/v2\/posts\/8154\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/chadorzel.com\/principles\/wp-json\/wp\/v2\/media\/8152"}],"wp:attachment":[{"href":"http:\/\/chadorzel.com\/principles\/wp-json\/wp\/v2\/media?parent=8154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/chadorzel.com\/principles\/wp-json\/wp\/v2\/categories?post=8154"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/chadorzel.com\/principles\/wp-json\/wp\/v2\/tags?post=8154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}