# Measuring Regression to the Mean in Hitting Home Runs

Anyone that follows baseball has likely heard about the out-of-nowhere MVP-type performance of Toronto's Jose Bautista. In the four years previous, he hit roughly 15 home runs per season. Last year he hit 54, a number surpassed by only 12 players in baseball history.

In 2010 he was paid 2.4 million and he's asking the team for 10.5 million for 2011. They're offering 7.6 million. If he can repeat that in 2011, he'll be easily worth either amount. But what are the odds of him repeating? How hard can we expect him to regress to the mean? How much of his performance can we expect was due to chance? What can we expect his regression-to-the-mean adjusted 2010 totals to be? How do I work it out?

I've been playing around with the Lahman Baseball Database and squeezed out a query that returns home run totals for all players in the previous five seasons who've had at least 50 at-bats per season.

The table looks like this (notice Jose Bautista in row 10)

     first     last hr_2006 hr_2007 hr_2008 hr_2009 hr_2010
1    Bobby    Abreu      15      16      20      15      20
2   Garret Anderson      17      16      15      13       2
3  Bronson   Arroyo       2       1       1       0       1
4  Garrett   Atkins      29      25      21       9       1
5     Brad   Ausmus       2       3       3       1       0
6     Jeff    Baker       5       4      12       4       4
7      Rod  Barajas      11       4      11      19      17
8     Josh     Bard       9       5       1       6       3
9    Jason Bartlett       2       5       1      14       4
10    Jose Bautista      16      15      15      13      54


and the full result (232 rows) is available here.

I really don't know where to start. Can anyone point me in the right direction? Some relevant theory, and R commands would be especially helpful.

Thanks kindly

Tommy

Note: The example is a little contrived. Home runs definitely aren't the best indicator of a player's worth, and home run totals don't consider the varying number of chances per season that a batter has the chance to hit home runs (plate appearances). Nor does it reflect that some players play in more favourable stadiums, and that league average home runs change year over year. Etc. Etc. If I can grasp the theory behind accounting for regression to the mean, I can use it on more suitable measures than HRs.

• Baseball is many US statisticians' favourite source of examples so a Google (/ Scholar) search will bring up several relevant articles, e.g. Morrison and Schmittlein (1981) jstor.org/stable/2630890 . I'll leave it to someone more familiar with both baseball and R to answer your question. – onestop Jan 20 '11 at 9:16
• I would also suggest you check out the work of J.C. Bradbury and his blog, Sabernomics, sabernomics.com/sabernomics . His book on measuring player worth will likely be insightful as to what characteristics are predictive of future productivity. – Andy W Jan 20 '11 at 13:13
• The problem as stated is a bit like an outlier problem, but not in the normal way one thinks of outliers. To incorporate the amazing result (i.e. the outlier) you would need a "sampling distribution" with a heavy tail (Jose's result well over 3 standard deviations away from his average over the past data), so this may help fit you data better, and account for it in prediction. – probabilityislogic Jan 21 '11 at 10:21
• If you would consider a crude little shortcut in addition to all the more sophisticated commentary appearing here, there's Dixon's Test for Outliers which you can perform on a sample as small as 4. See cee.vt.edu/ewr/environmental/teach/smprimer/outlier/… – rolando2 Jan 23 '11 at 18:38

I think that there's definitely a Bayesian shrinkage or prior correction that could help prediction but you might want to also consider another tack...

Look up players in history, not just the last few years, who've had breakout seasons after a couple in the majors (dramatic increases perhaps 2x) and see how they did in the following year. It's possible the probability of maintaining performance there is the right predictor.

There's a variety of ways to look at this problem but as mpiktas said, you're going to need more data. If you just want to deal with recent data then you're going to have to look at overall league stats, the pitchers he's up against, it's a complex problem.

And then there's just considering Bautista's own data. Yes, that was his best year but it was also the first time since 2007 he had over 350 ABs (569). You might want to consider converting the percentage increase in performance.

You can fit a model to this data alone and get predictions that account for regression to the mean by using mixed (multilevel) models. Predictions from such models account for regression to the mean. Even without knowing next to nothing about baseball I don't find results I got terribly believable, since, as you say, the model really needs to take account of other factors, such as plate appearances.

I think a Poisson mixed-effects model would be more suitable than a linear mixed model as the number of home runs is a count. Looking at the data you provided, a histogram of hr shows it is strongly positively skewed, suggesting so a linear mixed model isn't going to work well, and includes a fairly large number of zeroes, with or without log-transforming hr first.

Here's some code using the lmer function from the lme4 package. Having created an ID variable to identify each player and reshaped the data to 'long' format as mpiktas indicated in his answer, (i did that in Stata as i'm no good at data management in R, but you could do it in a spreadsheet package):

Year.c <- Year - 2008   # centering y eases computation and interpretation
(M1 <- lmer(HR ~ Year.c + (Year.c|ID), data=baseball.long, family=poisson(log), nAGQ=5))


This fits a model with a log-link giving an exponential dependence of hit-rate on year, which is allowed to vary between players. Other link functions are possible, though the identity link gave an error due to negative fitted values. A sqrt link worked ok though, and has lower BIC and AIC than the model with the log link, so it may be a better fit. The predictions for hit-rate in 2011 are sensitive to the chosen link function, particularly for players such as Bautista whose hit-rate has changed a lot recently.

I'm afraid I haven't managed to actually get such predictions out of lme4 though. I'm more familiar with Stata, which makes it very easy to get predictions for observations with missing values for the outcome, although xtmelogit doesn't appear to offer any choice of link function other than log, which gave a prediction of 50 for Bautista's home runs in 2011. As I said, I don't find that terribly believable. I'd be grateful someone could show how to generate predictions for 2011 from the above lmer models above.

An autoregressive model such as AR(1) for the player-level errors might be interesting too, but I don't know how to combine such a structure with a Poisson mixed model.

• using function melt from package reshape, converting to long format is one line in R, melt(data,id=1:2). – mpiktas Jan 21 '11 at 18:41
• An interesting extension/alternative to this is to fit a hierarchical model with a Possion sampling distribution with a sampled rate parameter (1 rate per year), but a Cauchy sampling distribution for the rate parameter (instead of normal or normal mixture). The Cauchy distribution will allow for the extreme event to occur (by sampling a large rate parameter). An intermediate case (between normal and Cauchy) is the t-distribution. (Cauchy is easier to sample from as it can use the inverse CDF method). – probabilityislogic Jan 23 '11 at 2:49

You need additional data on the players and their characteristics in the time-span you have data about home-runs. For the first step add some time-varying characteristics such as players age or experience. Then you can use HLM or panel data models. You will need to prepare data in the form:

    First Last  Year HR Experience Age
1.  Bobby Abreu 2005 15     6      26


The most simple model would then be (the function lme is from package nlme)

lme(HR~Experience,random=~Experience|Year,data=your_data)


This model will heavily rely on assumption that each player's home-run number relies only on experience allowing some variability. It probably will not be very accurate, but you at least will get a feel how unlikely are Jose Bautista's numbers compared to average player. This model can be further improved by adding other player's characteristics.

• I wouldn't say that @TMOD needs more data, just that the predictions are likely to be more accurate if @TMOD had more data. There is enough information in the question to generate a prediction. – probabilityislogic Jan 21 '11 at 10:15
• @probabilityislogic, yes there is enough information to generate the prediction, but then the model will only have intercept. – mpiktas Jan 21 '11 at 10:23
• not necessarily, one could fit an AR(1) or AR(2) model to this data – probabilityislogic Jan 22 '11 at 0:42
• @probabilityislogic, ah yes, you are right. – mpiktas Jan 22 '11 at 3:53

You might want to check out The Book Blog.

Tom Tango and the other authors of "The Book: Playing the Percentages in Baseball" are probably the best sources of sabermetrics out there. In particular, they love regression to the mean. They came up with a forecasting system designed to be the most basic acceptable system (Marcel), and it relies almost exclusively on regression to the mean.

Off the top of my head, I suppose one method would be to use such a forecast to estimate true talent, and then find an appropriate distribution around that mean talent. Once you have that, each plate appearance will be like a Bernoulli trial, so the binomial distribution could take you the rest of the way.

FYI, from 2011 to 2014, he hit 43, 27, 28, and 35.

That's pretty close to his 162-game average of 32 (which of course includes those values), and about 1 SD under the 54 in 2010.

Looks like regression to the mean in action: An extreme group built by capitalising on noisy subjects (1 in this case) deviating from their group mean by chance.

http://www.baseball-reference.com/players/b/bautijo02.shtml