What’s up with home runs?

How have home run rates changed over time?

andrewstiegler
2022-09-01

How have home run rates changed? Are there more home runs now than ever?

In order to look at baseball data in R, we need a good baseball database. Luckily one exists for R already - the Lahman dataset. In fact, there’s even an R package available for it thanks to Chris Dalzell and his team. Let’s use this dataset to figure out if home run rates are high now compared to historical data. First, what’s the average rate of home runs per plate appearance over time? Checking the data…

It looks like the rate increases over time, but it’s noisy data. Let’s check if the time series is stationary. We can use the Augmented Dickey-Fuller test from the tseries package.


    Augmented Dickey-Fuller Test

data:  .
Dickey-Fuller = -2.71, Lag order = 4, p-value = 0.287
alternative hypothesis: stationary

Based on this results (p-value > 0.05), we can conclude that there is a trend, and home run rates have been increasing overall in the past 70 years or so.

Citation

For attribution, please cite this work as

andrewstiegler (2022, Sept. 1). the data doctoR: What's up with home runs?. Retrieved from https://andrewstiegler.github.io/posts/2022-09-01-post-3/

BibTeX citation

@misc{andrewstiegler2022what's,
  author = {andrewstiegler, },
  title = {the data doctoR: What's up with home runs?},
  url = {https://andrewstiegler.github.io/posts/2022-09-01-post-3/},
  year = {2022}
}