Writing this post in early May, we have observed a month of baseball in the 2021 season and we’re interested in comparing home run hitting with previous Statcast seasons. Since temperature is a relevant input for understand home run rates, a reasonable approach is to compare home run rates for the same time interval for two seasons. For example, it makes sense to compare the observed April home run hitting in 2021 with the April 2019 home run hitting. (We don’t consider the previous season 2020 since that season didn’t start until July.)
I recently introduced a Shiny app intended to compute batted ball and home run rates over a selected launch variable region across all of the Statcast seasons. Although this app is useful, I thought it may be better to focus on two Statcast seasons and present a comparison of batted ball and home run rates for the two seasons across all of the plausible values of launch angle and exit velocity. This approach is more comprehensive than my first Shiny app and may be useful in making a summary comparison of the ball and player effects related to hitting home runs.
To understand home run counts, it is helpful to consider three steps in the process of hitting a home run. First, one must put the ball in play, so the rate of balls in play is relevant. Due to the steady increase in strikeouts, the balls in play rate has been declining in recent seasons, so that would have a negative impact on the count of home runs. Second, the batter needs to hit the hard hard (high exit velocity) at a proper launch angle (in some interval about 30 degrees), so the rates of batted balls with these “good” launch variable values is important. Last, given that a batter has hit the ball hard at a good launch angle, the ball must carry outside of the fences and that defines a third “home run” rate. We’re going to focus on changes in the rates at steps 2 and 3 in this process.
I will introduce this new Shiny app in this post. First I will give an overview of the binning procedure, the rates we consider, and the methods we will use to compare rates for two seasons. Then I will show snapshots of the app, focusing on a comparison of April 2019 and April 2021 home run hitting.
Binning Balls in Play by Launch Conditions
Practically all home runs are hit when the launch angle is between 15 and 45 degrees and the exit velocity is between 90 and 115 mph. I divide the launch angles into 6 subintervals and the exit velocities into 5 subintervals. For the balls put in play for a particular season and time interval, I group the (launch angle, exit velocity) values into 6 x 5 = 30 bins. For each bin, I collected
- the number of balls in play
- the number of home runs
As an example, consider the April 2021 balls in play (through April 29). One bin contains the balls in play where the launch angle is in the interval (20, 25) and the exit velocity is in the interval (105, 110). Of the total count of 17,769 balls put in play during that period, we observe 138 BIP in this bin and 92 home runs. Consider two rates:
- the rate of batted balls in the bin
- the rate of home runs among batted balls in the bin
For this particular bin, the batted ball rate is
138 / 17769 = 0.00777 = 0.777 %
The home run rate in this bin is
92 / 138 = 0.667 = 66.7 %
We’re interested in comparing the rates for two seasons for a particular bin. For example, for the (20, 25) x (105, 110) bin, we observe the following batted ball rates for April in the seasons 2019 and 2021:
Season Total BB BB_Rate_Pct 1 2019 18781 133 0.708 2 2021 17769 138 0.777
We’ll use several ways to compare the 2019 and 2021 rates:
- The difference in 2021 and 2019 percentage rates. Here the difference in percentage rates is 0.777 – 0.708 = 0.069
- To check if the difference in rates is significant, we can use a Z statistic
The difference in rates is significant if the absolute value of Z exceeds 2. For this example we get
Z = 0.762
so this particular difference of rates is not significant.
The Compare Seasons Shiny App
The Shiny App for comparing BIP and home run rates for two seasons is live at
The Statcast data is loaded automatically. To use the app, one chooses a range of dates of interest, two seasons to compare, and a statistic to use (either a difference in percentages or a Z value).
The app (under the Batted Ball Rates tab) displays the difference in batted ball percentage rates for all bins where the label is colored by the sign of the difference.
If you instead select a Z statistic, you’ll see a graphical display of the Z statistics for all bins.
Note that practically all of these Z values are smaller than 2 in absolute value. There is some evidence that there are higher rates of batted balls in 2021 for high exit velocity values, but the strength of the evidence is relatively weak.
Comparing Home Run Rates
By selecting the Home Run Rates tab, you’ll see similar displays comparing the home run rates for the two seasons.
Here are the difference in home run percentage rates:
Here are the corresponding Z values.
Here we see a dramatic change in home run rates between the two seasons. For a large region of launch angle-exit velocity values, the home run rates in 2021 are 10-18 percentage points lower than the home run rates in 2019. Note that the corresponding Z values in absolute value exceed 2, so these differences in rates represent significant differences.
Comments about the App
- This Shiny app also contains Data and Information tabs. The Data tab displays all of the raw count data that are used in the calculations and the Information tab provides general information about the app.
- By using the live app, one is able to compare batted ball and home run rates of the current season with any other Statcast season over any time interval of interest. Generally, it appears that the 2021 batted ball rates in the “home run friendly region” are similar to the analogous rates of 2019. But the 2021 home run rates in these bins are significantly lower than 2019. In fact, the 2021 home run rates appear similar to the 2018 home run rates when the total home run count was relatively low. In other words, the launch conditions of hitting in 2021 are similar to those of 2019, but the balls appear to be exhibiting more drag in 2021 compared to 2019.
- I will continually update the 2021 data, so the app should be useful for monitoring the batted ball and home run rates as the 2021 season progresses.
- The Shiny code for both my home run apps HomeRunRates2021 and HomeRunCompare can be found at my Github site. The live versions of the app are currently available at https://bayesball.shinyapps.io/HomeRunRates2021/ and https://bayesball.shinyapps.io/HomeRunsCompare/. The code for each Shiny app is contained in a single file
app.Rthat can be downloaded from my Github Gist site and run locally on one’s computer. All of the Statcast data is loaded from my Github site. I welcome the interested reader to improve or enhance this app.