25 October, 2023

For hitters, cold streaks run colder than hot streaks run hot

This blog post is just the product of a thought exercise: how much information do you get from a certain number of plate appearances? Suppose we observe $n = 25$ plate appearances for a batter. If the batter gets on-base $x = 5$ times, is that the same amount of information as if the batter gets on-base $x = 10$ times? 

The answer is no. As it turns out, the batter obtaining fewer hits is more informative for the batter being "bad" than the batter obtaining more hits is for the batter being "good." How is this possible? Consider the very simple case of forming a standard 95% confidence interval for a binomial proportion. From any statistics textbook, this is just

 

$\hat{p} \pm 1.96 \sqrt{\dfrac{\hat{p}(1-\hat{p})}{n}}$

 

where $\hat{p}$ is the proportion of on-base events for $n$ plate appearances.  Consider the second part, which I will refer to as the "margin of error" and which controls the width of the confidence interval. For $n = 25$ plate appearances, $x = 5$ gives $\hat{p} = 5/25 = 0.2$ and gives


$1.96 \sqrt{\dfrac{0.2(1-0.2)}{25}} = 0.1568$

 

For $n = 10$ on-base events, this gives $\hat{p} = 0.4$ and 


$1.96 \sqrt{\dfrac{0.4(1-0.4)}{25}} = 0.19204$

 

The width of the margin of error of the confidence is nearly 15% higher for $\hat{p} = 0.4$ than for $\hat{p} = 0.2$! There is more uncertainty with a better result.

Going to a Bayesian framework does not fix this issue, with the possible exception of when heavily weighted priors are being used which would be not justifiable in practice. Suppose that the number of on-base events $x$ in $n$ plate appearances once again follows the (overly simplistic) binomial distribution with parameter $p$, and $p$ is assumed to have a $Beta(1,1)$ distribution, which is the simple uniform case.


$x \sim Bin(n, p)$

$p \sim Beta(1,1)$


For the case of $x = 5$ on-base events in $n = 25$ plate appearances, the posterior distribution has form , standard deviation, and 95% central credible interval


$p | x = 5, n = 25 \sim Beta(6, 21)$

$SD(p | x = 5, n = 25) = \sqrt{\dfrac{(6)(21)}{(6 + 21)^2 (6 + 21 + 1)}} = 0.0786$

95% Central CI: $(0.0897,0.3935)$


For the case of $x = 10$ on-base events in $n = 25$ plate appearances, the posterior distribution has form , standard deviation, and 95% central credible interval


$p | x = 10, n = 25 \sim Beta(11, 16)$

$SD(p | x = 10, n = 25) = \sqrt{\dfrac{(11)(16)}{(11 + 16)^2 (11 + 16 + 1)}} = 0.929$

95% Central CI:$(0.2335,0.5942)$ 


Once again, the scenario with worse performance ($x = 5$ on-base events) has a smaller standard deviation, implying there is less posterior uncertainty about the outcome. In addition, the width of the 95% central credible interval is smaller for $x = 5$ ($0.3038$) than for $x = 10$ (0.3608)$.

So how much information is in the $n$ trials? One way to define information, in a probabilistic sense, is with a concept called the observed information. Observed information is a statistic which measures a concept called the Fisher information. Fisher information measures the amount of information that a sample carries about an unknown parameter $\theta$. Unfortunately, calculating this requires knowing the parameter in question, and so it is usually estimated. The log-likelihood of a set of observations $\tilde{x} = \{x_1, x_2, \dots, x_n\}$ is defined as


$\displaystyle \ell (\theta | \tilde{x}) = \sum_{i = 1}^n \log[ f(x _i | \theta)]$

 

And the observed information is defined as the negative second derivative of the log-likelihood, taken with respect to $\theta$.

 

$I(\tilde{x}) = -\dfrac{d}{d \theta^2}  \ell (\theta | \tilde{x})$

 

Note that Bayesians may replace the log-likelihood with the log-posterior distribution of $\theta$.

 In general the observed information must be calculated for every model, but is known for certain models. For the binomial distribution, the observed information is

 

$I(\hat{p}) = \dfrac{n}{\hat{p}(1-\hat{p})}$


where $\hat{p} = x/n$. Hence, for the case of $x = 5$ on-base events in $n = 25$ plate appearances, $I(0.2) = 156.25$. For the case of $x = 10$ on-base events in $n = 25$ plate appearances, $I(0.4) = 104.1667$. There is quite literally more information in the case where the batter performed worse.

For pitchers, the opposite is the case. If we assume that the number of events in a fixed number of trials (such as runs allowed per 9 innings or walks plus hits per inning pitched), this most appropriate simple distribution is the Poisson distribution with parameter $\lambda$. For $n$ trials, the observed information is


$I(\hat{\lambda}) = \dfrac{n}{hat{\lambda}}$


where $\hat{\lambda} = \bar{x}$, the sample mean of observations. 

Imagine two pitchers: one has allowed $x = 30$ walks plus hits in $n = 25$ innings pitched, while the other has allowed $x = 20$ walks plus hits in $n = 25$ innings pitched. For which pitcher do we have more information about their abilities?

For the first pitcher, their sample WHIP is $\hat{\lambda} = 30/25 = 1.2$ and their observed information is $I(1.2) = 25/1.2 = 20.8333$. For the second pitcher, their sample WHIP is $\hat{\lambda} = 20/30 = 0.8$ and their observed information is $I(0.8) = 25/0.8 = 31.25$. Hence, we have more information about the pitcher who has performed better.

So the situation is reversed for batters and hitters. For batters, we tend to have more information when they perform poorly. For pitchers, we tend to have more information when the perform well. This suggests certain managerial strategies in small samples: it is justifiable to pull a poorly performing batter, but also perhaps justifiable to allow a poorly performing pitcher to have more innings. We just have more information about the bad hitter than we do about the bad pitcher, thanks to information theory.

06 April, 2023

2022 and 2023 Stabilization Points

Hello everyone! It's been another couple of years, and I'm ready to update stabilization points again. These are my estimated stabilization points for the 2022 and 2023 MLB seasons, once again using the maximum likelihood method on the totals that I used for previous years. This method is explained in my articles  Estimating Theoretical Stabilization Points and WHIP Stabilization by the Gamma-Poisson Model. As usual, all data and code I used for this post can be found on my github. I make no claims about the stability, efficiency, or optimality of my code.

I've included standard error estimates for 2022 and 2023, but these should not be used to perform any kinds of tests or intervals to compare to the values from previous years, as those values are estimates themselves with their own standard errors, and approximately 5/6 of the data is common between the two estimates. The calculations I performed for 2015 can be found here for batting statistics and here for pitching statistics. The calculations for 2016 can be found here. The 2017 calculations can be found here. The 2018 calculations can be found here. The 2019 calculations can be found here. I didn't do calculations in 2020 because of the pandemic in general. The 2021 calculations can be found here.


The cutoff values I picked were the minimum number of events (PA, AB, TBF, BIP, etc. - the denominators in the formulas) in order to be considered for a year. These cutoff values, and the choice of 6 years worth of data (2016-2021 for the 2022 stabilization points and 2017 - 2022 for the 2023 stabilization points) were picked fairly arbitrarily. This is consistent with my previous work, though I do have concerns about including rates from, for example, the covid year and juiced ball era. However, including fewer years means less accurate estimates. A tradeoff must be made, and I tried to go with what was reasonable (based on seeing what others were doing and my own knowledge of baseball) and what seemed to work well in practice.

Offensive Statistics

2022 Statistics


\begin{array}{| l | l | c | c | c | c |} \hline
\textrm{Stat}&\textrm{Formula}&2022\textrm{ }\hat{M}&2022\textrm{ }SE(\hat{M})&2022\textrm{ }\hat{\mu} & \textrm{Cutoff} \\ \hline
\textrm{OBP}&\textrm{(H + BB + HBP)/PA} & 316.48 & 19.72 & 0.331 & 300  \\
\textrm{BABIP}&\textrm{(H - HR)/(AB-SO-HR+SF)} & 459.44 &  50.10 & 0.304 & 300 \\
\textrm{BA}&\textrm{H/AB} & 473.86 & 38.69 & 0.263 & 300\\
\textrm{SO Rate}&\textrm{SO/PA} & 51.89 & 2.20  & 0.210 & 300  \\
\textrm{BB Rate}&\textrm{(BB-IBB)/(PA-IBB)} & 105.36 & 4.96 & 0.083 & 300 \\
\textrm{1B Rate}&\textrm{1B/PA} & 195.22 & 10.55 & 0.147 & 300  \\
\textrm{2B Rate}&\textrm{2B/PA} & 1197.83& 153.68 & 0.047 & 300 \\
\textrm{3B Rate}&\textrm{3B/PA} & 561.01 & 51.43 & 0.004 & 300  \\
\textrm{XBH Rate} & \textrm{(2B + 3B)/PA} & 1002.35 & 114.03 & 0.051 & 300 \\
\textrm{HR Rate} & \textrm{HR/PA} & 155.39 & 8.29 & 0.035 & 300 \\
\textrm{HBP Rate} & \textrm{HBP/PA} & 248.10 & 15.53 & 0.011 & 300  \\ \hline
\end{array}

2023 Statistics


\begin{array}{| l | l | c | c | c | c |} \hline
\textrm{Stat}&\textrm{Formula}&2023\textrm{ }\hat{M}&2023\textrm{ }SE(\hat{M})&2023\textrm{ }\hat{\mu} & \textrm{Cutoff} \\ \hline
\textrm{OBP}&\textrm{(H + BB + HBP)/PA} & 301.11 & 18.46 & 0.329 & 300  \\
\textrm{BABIP}&\textrm{(H - HR)/(AB-SO-HR+SF)} & 426.80 &  45.29 & 0.302 & 300 \\
\textrm{BA}&\textrm{H/AB} & 434.51 & 34.08 & 0.259 & 300\\
\textrm{SO Rate}&\textrm{SO/PA} & 53.16 & 2.25  & 0.213 & 300  \\
\textrm{BB Rate}&\textrm{(BB-IBB)/(PA-IBB)} & 107.36 & 5.06 & 0.083 & 300 \\
\textrm{1B Rate}&\textrm{1B/PA} & 196.97 & 10.65 & 0.145 & 300  \\
\textrm{2B Rate}&\textrm{2B/PA} & 1189.22 & 151.90 & 0.047 & 300 \\
\textrm{3B Rate}&\textrm{3B/PA} & 634.14 & 62.08 & 0.005 & 300  \\
\textrm{XBH Rate} & \textrm{(2B + 3B)/PA} & 1035.82 & 120.93 & 0.051 & 300 \\
\textrm{HR Rate} & \textrm{HR/PA} & 156.77 & 8.34 & 0.035 & 300 \\
\textrm{HBP Rate} & \textrm{HBP/PA} & 256.24 & 16.04 & 0.011 & 300  \\ \hline
\end{array}


In general, a larger stabilization point will be due to a decreased spread of talent levels - as talent levels get closer together, more extreme stats become less and less likely, and will be shrunk harder towards the mean. Consequently, it takes more observations to know that a player's high or low stats (relative to the rest of the league) are real and not just a fluke of randomness. Similarly, smaller stabilization points will point towards an increase in the spread of talent levels.

This is a good opportunity to compare the stabilization points I calculated for the 2016 season to the stabilization points for the 2023 season, as the 2023 season includes data from 2017-2022, so there is no crossover of information between them.


\begin{array}{| l | l | c | c |} \hline
\textrm{Stat}&\textrm{Formula}&2023\textrm{ }\hat{M}&2016\textrm{ }\hat{M} \\ \hline
\textrm{OBP}&\textrm{(H + BB + HBP)/PA} & 301.11 & 301.32 \\
\textrm{BABIP}&\textrm{(H - HR)/(AB-SO-HR+SF)} & 426.80 &  433.04 \\
\textrm{BA}&\textrm{H/AB} & 434.51 & 491.20\\
\textrm{SO Rate}&\textrm{SO/PA} & 53.16 & 49.23  \\
\textrm{BB Rate}&\textrm{(BB-IBB)/(PA-IBB)} & 107.36 & 112.44 \\
\textrm{1B Rate}&\textrm{1B/PA} & 196.97 & 223.86 \\
\textrm{2B Rate}&\textrm{2B/PA} & 1189.22 & 1169.75 \\
\textrm{3B Rate}&\textrm{3B/PA} & 634.14 & 365.06  \\
\textrm{XBH Rate} & \textrm{(2B + 3B)/PA} & 1035.82 & 1075.41 \\
\textrm{HR Rate} & \textrm{HR/PA} & 156.77 & 126.35  \\
\textrm{HBP Rate} & \textrm{HBP/PA} & 256.24 & 300.97\\ \hline
\end{array}

What is most apparent is the stability of most statistics. The stabilization point for OBP, BABIP, SO Rate, BB rate, 2B rate, and XBH rate are nearly identical, indicating that the spread of abilities within this distribution is roughly the same now as it is in 2016. Stabilization points for BA, 1B rate, HR Rate, and HBP rate are fairly close, indicating not much change. The big outlier is 3B rate, or the rate of triples. Though the estimated probability of a triple per PA is approximately 0.005 in both seasons, the stabilization rate has nearly doubled from 2016 to 2023. This is indicative that the spread in the ability to triples has increased - though the league average rate of triples has remained the same, there are fewer batters that have a "true" triples-hitting ability which is much higher or lower than the league average.


Pitching Statistics 

2022 Statistics


\begin{array}{| l | l | c | c | c | c  | c |} \hline
\textrm{Stat}&\textrm{Formula}&2022\textrm{ }\hat{M}&2022\textrm{ }SE(\hat{M})&2022\textrm{ }\hat{\mu} & \textrm{Cutoff} \\ \hline
\textrm{BABIP}&\textrm{(H-HR)/(GB + FB + LD)}& 929.31 & 165.62 & 0.284 &300 \\
\textrm{GB Rate}&\textrm{GB/(GB + FB + LD)}& 66.56 & 4.38 & 0.439 &3001\\
\textrm{FB Rate}&\textrm{FB/(GB + FB + LD)}& 61.79 & 4.03 & 0.351 &300 \\
\textrm{LD Rate}&\textrm{LD/(GB + FB + LD)}& 1692.45 & 467.98 & 0.210 &300  \\
\textrm{HR/FB Rate}&\textrm{HR/FB}& 715.15 & 226.83 & 0.135 & 100  \\
\textrm{SO Rate}&\textrm{SO/TBF}& 80.13 & 4.00 & 0.220 &400 \\
\textrm{HR Rate}&\textrm{HR/TBF}& 1102.12 & 175.15 & 0.032 &400 \\
\textrm{BB Rate}&\textrm{(BB-IBB)/(TBF-IBB)}& 256.28 & 20.37 & 0.074 & 400 \\
\textrm{HBP Rate}&\textrm{HBP/TBF}& 931.55 & 131.51 & 0.009 &400 \\
\textrm{Hit rate}&\textrm{H/TBF}& 414.03 & 33.46 & 0.230 &400  \\
\textrm{OBP}&\textrm{(H + BB + HBP)/TBF}& 395.83 & 35.75 & 0.312 &400\\
\textrm{WHIP}&\textrm{(H + BB)/IP*}& 58.49 & 4.40 & 1.28 &80 \\
\textrm{ER Rate}&\textrm{ER/IP*}& 54.50  & 4.07 & 0.465 &80 \\
\textrm{Extra BF}&\textrm{(TBF - 3IP*)/IP*}& 61.96 & 4.75 & 1.23 &80\\ \hline
\end{array}

* When dividing by IP, I corrected the 0.1 and 0.2 representations to 0.33 and 0.67, respectively. 

2023 Statistics


\begin{array}{| l | l | c | c | c | c  | c |} \hline
\textrm{Stat}&\textrm{Formula}&2023\textrm{ }\hat{M}&2023\textrm{ }SE(\hat{M})&2023\textrm{ }\hat{\mu} & \textrm{Cutoff} \\ \hline
\textrm{BABIP}&\textrm{(H-HR)/(GB + FB + LD)}& 809.54 & 134.29 & 0.282 &300 \\
\textrm{GB Rate}&\textrm{GB/(GB + FB + LD)}& 66.24 & 4.40 & 0.434 &3001\\
\textrm{FB Rate}&\textrm{FB/(GB + FB + LD)}& 59.40 & 3.90 & 0.357 &300 \\
\textrm{LD Rate}&\textrm{LD/(GB + FB + LD)}& 1596.98 & 429.07 & 0.209 &300  \\
\textrm{HR/FB Rate}&\textrm{HR/FB}& 386.34 & 77.01 & 0.133 & 100  \\
\textrm{SO Rate}&\textrm{SO/TBF}& 77.46 & 4.85 & 0.223 &400 \\
\textrm{HR Rate}&\textrm{HR/TBF}& 942.58 & 134.48 & 0.032 &400 \\
\textrm{BB Rate}&\textrm{(BB-IBB)/(TBF-IBB)}& 258.78 & 20.84 & 0.073 & 400 \\
\textrm{HBP Rate}&\textrm{HBP/TBF}& 766.40 & 98.75 & 0.009 &400 \\
\textrm{Hit rate}&\textrm{H/TBF}& 391.55 & 30.96 & 0.227 &400  \\
\textrm{OBP}&\textrm{(H + BB + HBP)/TBF}& 358.50 & 31.64 & 0.309 &400\\
\textrm{WHIP}&\textrm{(H + BB)/IP*}& 54.96 & 4.07& 1.27 &80 \\
\textrm{ER Rate}&\textrm{ER/IP*}& 50.33 & 3.68 & 0.459 &80 \\
\textrm{Extra BF}&\textrm{(TBF - 3IP*)/IP*}& 58.00 & 4.37 & 1.22 &80\\ \hline
\end{array}

* When dividing by IP, I corrected the 0.1 and 0.2 representations to 0.33 and 0.67, respectively. 

Once again, this is a good opportunity to compare the stabilization rates for 2016 to the stabilization rates for 2023.

\begin{array}{| l | l | c | c |} \hline
\textrm{Stat}&\textrm{Formula}&2023\textrm{ }\hat{M}&2016\textrm{ }\hat{M} \\ \hline
\textrm{BABIP}&\textrm{(H-HR)/(GB + FB + LD)}& 809.54 & 1408.72  \\
\textrm{GB Rate}&\textrm{GB/(GB + FB + LD)}& 66.24 & 65.52 \\
\textrm{FB Rate}&\textrm{FB/(GB + FB + LD)}& 59.40 & 61.96\\
\textrm{LD Rate}&\textrm{LD/(GB + FB + LD)}& 1596.98 & 768.42  \\
\textrm{HR/FB Rate}&\textrm{HR/FB}& 386.34 & 505.11 \\
\textrm{SO Rate}&\textrm{SO/TBF}& 77.46 & 90.94  \\
\textrm{HR Rate}&\textrm{HR/TBF}& 942.58 & 931.59  \\
\textrm{BB Rate}&\textrm{(BB-IBB)/(TBF-IBB)}& 258.78 & 221.25 \\
\textrm{HBP Rate}&\textrm{HBP/TBF}& 766.40 & 989.30\\
\textrm{Hit rate}&\textrm{H/TBF}& 391.55 & 623.35\\
\textrm{OBP}&\textrm{(H + BB + HBP)/TBF}& 358.50 & 524.73\\
\textrm{WHIP}&\textrm{(H + BB)/IP*}& 54.96 & 77.2\\
\textrm{ER Rate}&\textrm{ER/IP*}& 50.33 & 59.55\\
\textrm{Extra BF}&\textrm{(TBF - 3IP*)/IP*}& 58.00 & 75.79\\ \hline
\end{array}

Comparing 2023 to 2016, the outliers are obvious: the stabilization point for pitcher BABIP has nearly halved since then, while the stabilization point for line drive rate has nearly doubled (and similarly for hit rate). Given that the estimated mean pitcher BABIP and line drive rate are similar for the two years (0.284/0.210 for 2023 and 0.289/0.203 for 2016), this indicates a change in the spread of abilities. Simply put, there is a much lower spread of pitcher BABIP "true" abilities, and with it, a much higher spread of line drive rates. Simply put, teams appear to be willing to trade more or less line drives for less variance in the batting average when the ball is in play.

 

Usage

 

Aside from the obvious use of knowing approximately when results are half due to luck and half  skill, these stabilization points (along with league means) can be used to provide very basic confidence intervals and prediction intervals for estimates that have been shrunk towards the population mean, as demonstrated in my article From Stabilization to Interval Estimation.

For example, suppose that in the first half, a player has an on-base percentage of 0.380 in 300 plate appearances, corresponding to 114 on-base events. A 95% confidence interval using my empirical Bayesian techniques (based on a normal-normal model) is

$\dfrac{114 + 0.329*301.11}{300 + 301.11} \pm 1.96 \sqrt{\dfrac{0.329(1-0.329)}{301.11 + 300}} = (0.317,0.392)$

That is, we believe the player's true on-base percentage to be between 0.317 and 0.392 with 95% confidence. I used a normal distribution for talent levels with a normal approximation to the binomial for the distribution of observed OBP, but that is not the only possible choice - it just resulted in the simplest formulas for the intervals.

Suppose that the player will get an additional $\tilde{n} = 250$ PA in the second half of the season. A 95% prediction interval for his OBP over those PA is given by

$\dfrac{114 + 0.329*301.11}{300 + 301.11} \pm 1.96 \sqrt{\dfrac{0.329(1-0.329)}{301.11+ 300} + \dfrac{0.329(1-0.329)}{250}} = (0.285,0.424)$ 

That is, 95% of the time the player's OBP over the 250 PA in the second half of the season should be between 0.285 and 0.424. These intervals are overly optimistic and "dumb" in that they take only the league mean and variance and the player's own statistics into account, representing an advantage only over 95% "unshrunk" intervals, but when I tested them in my article "From Stabilization to Interval Estimation," they worked well for prediction.

As usual, all my data and code can be found on my github. I wrote a general function in $R$ to calculate the stabilization point for any basic counting stat, or unweighted sums of counting stats like OBP (I am still working on weighted sums so I can apply this to things like wOBA). The function returns the estimated league mean of the statistic and estimated stabilization point, a standard error for the stabilization point, and what model was used (I only have two programmed in - 1 for the beta-binomial and 2 for the gamma-Poisson). It also gives a plot of the estimated stabilization at different numbers of events, with 95% confidence bounds.

> stabilize(h$\$$H + h$\$$BB + h$\$$HBP, h$\$$PA, cutoff = 300, 1)  
$\$$Parameters
[1]   0.3287902 301.1076958

$\$$Standard.Error
[1] 18.45775

$\$$Model
[1] "Beta-Binomial"






The confidence bounds are created from the estimates $\hat{M}$ and $SE(\hat{M})$ above and the formula

$\left(\dfrac{n}{n+\hat{M}}\right) \pm 1.96 \left[\dfrac{n}{(n+\hat{M})^2}\right] SE(\hat{M})$

which is obtained from the applying the delta method to the function $p(\hat{M}) = n/(n + \hat{M})$. Note that the mean and prediction intervals I gave do not take $SE(\hat{M})$ into account (ignoring the uncertainty surrounding the correct shrinkage amount, which is indicated by the confidence bounds above), but this is not a huge problem - if you don't believe me, plug slightly different values of $M$ into the formulas yourself and see that the resulting intervals do not change much.

As always, feel free to post any comments or suggestions.