Christopher Keyes

Talking Baseball: Run Scoring by Inning in 2021

(Originally published on July 10, 2022)

This is part of a series of posts on sabermetrics and the mathematics of baseball. You can find more here.

I have posted about run expectancy here before. The idea is that in order to evaluate the impact of an individual performance or team strategy on scoring runs, one must first have a baseline for how many runs one can expect to score in various situations (e.g. with a runner on first base and 1 out). To get this baseline, we take an average, counting up how many times each base-out situation occurred, summing up the runs scored in the inning thereafter, and dividing.

Until recently, I hadn't actually attempted these calculations myself, instead relying on data provided by others. So to get some practice manipulating raw play-by-play data --- and to play with other fun ways of breaking down run scoring --- I downloaded data describing each play of the 2021 MLB regular season from Retrosheet. This data is copyrighted by Retrosheet and available (along with past seasons going back decades!) free of charge on their website. Here's the run expectancy matrix I computed for the 2021 season:

Figure 1: Run Expectancy Matrix, 2021
Runners 0 out 1 out 2 out
000 0.508 0.266 0.102
100 0.917 0.533 0.229
020 1.127 0.691 0.326
120 1.528 0.919 0.448
003 1.369 0.956 0.380
103 1.740 1.128 0.490
023 2.117 1.395 0.587
123 2.448 1.676 0.824

The values above agree pretty closely with Greg Stoll's values for 2021. Some disagreement is to be expected, as I left in shortened games (including 7 inning doubleheaders) and extra inning games, but excluded the postseason.

One interesting point (which may come up again in a future post) is how to handle walk-offs. That is, if the home team scores the go-ahead run in the 9th inning or later, the game immediately ends, before three outs are made. Should we include these innings in our run expectancy calculations? After all, if the inning ends before three outs are made, the team could have possibly scored more runs, so our computed run expectancy values might be slightly too low. For now, I'll simply ignore this, arguing that these innings are few enough that their impact is small.

Now for a fun fact: the least common base-out situation is a runner on third with 0 outs. This occurred only 458 times in the 2021 season. (For comparison, no runners on and 0 outs occurred 44,308 times.) This isn't necessarily surprising, as I can think of only a triple or some combination of a no-out hit/walk/HBP and steals/wild pitches/passed balls/balks getting a runner to third with no outs.

Run expectancy inning-by-inning

With raw data at our fingertips, we can break down run expectancy in other interesting ways. Today I'll at innings, excluding extra innings for now. Below we plot the run expectancy --- equivalently, the average runs scored --- in each frame from the 1st through the 9th.

I was a bit surprised to see that the 1st inning was by far the highest scoring, followed by a sizeable dip in the 2nd. As it turns out, this phenomenon isn't unique to 2021, and has been well documented; see this article which includes AL/NL comparisons, this Fangraphs post which also looks at home/visitor splits, and this article from 2019, in which the 3rd inning was actually the highest scoring.

The most likely explanation seems to be that the first inning is the only one in which teams are guaranteed to have the top of their order batting. Baseball teams tend to put their best batters, who are more likely to get on base and bat each other in, near the top of the order. The second inning is then most likely to begin with the middle or bottom of the order, with batters who are comparatively more likely to get out than to get on base and score, resulting in the dip in run expectancy.

This evens out a bit in the middle innings (3rd - 6th), before taking dips in the 7th and 9th innings, which may be partially explained by teams replacing their tiring starters with their late-inning shutdown relief arms. In the 9th in particular, we might also consider that the bottom half isn't played if the home team leads. In these games, we're only including in our average the (losing) visiting team. Even if the home team bats, they may be limited in the number of runs they score: with the score tied in the bottom of the 9th, a single run ends the game. In this case, excluding the possibility of a walkoff home run, the home team isn't even able to score 2 or more runs.

To smooth out some of these issues, we can try asking "does the team score or not?" and compute the proportion of innings in which the batting team scored 1 or more runs.

Most of the same trends are present here. However, it appears that in some innings the scoring probabilities are similar, but the run expectancy differs. For example, the 7th and 8th inning have nearly identical scoring probabilities (26.7% and 26.8% respectively) but we only expect 0.492 runs in the 7th, compared to 0.513 runs in the 8th. On the other hand, the 9th inning had the lowest run expectancy at 0.449, but the second lowest scoring probability at 25.9% of the time. It was the 2nd inning with the lowest scoring probability (24.9%) and second lowest run expectancy (0.461).

I don't have a great explanation for these observations at the moment. One thought is that in late innings, the pitching team is either using their best arms to keep a tight game close, or content to let their weaker throwers allow some runs score if it's a blowout. This sort of dichotomy could explain late innings seeming to have a lower scoring probability but slightly elevated run expectancy, but this is probably worth following up on.

Measuring the leadoff batter effect

Let's try to test the theory that teams scored more in the 1st inning (in 2021 at least) because they started with the top of the order. Do teams tend to score more or less runs when certain batters lead off innings? The answer appears to be a resounding yes!

When the inning is led off by the 1st, 2nd, or 3rd hitter in the lineup, more runs tend to score than average. This drops off considerably when the inning starts with the middle of the order, and increases again as we reach the bottom of the lineup. This seems consistent with our proposed explanation earlier: MLB teams construct their lineups with the better hitters near the top of the order, so when an inning starts with the leadoff hitter (or even the 9th hitter with the leadoff man on deck), more runs are likely to be scored. Starting an inning with the middle of the order leaves the bottom of the order to drive in any baserunners, which results in fewer runs scored on average.

Of course, teams don't have the same lineups every day (or within a game with pinch hitters). Managers often move players up or down in the lineup from game to game, depending on how they are playing, and may well be doing so with different strategies in mind! Still, averaging across MLB in 2021 seems to show that lineup composition does indeed have an impact on run scoring, with the most runs scored when the inning begins with the top of the lineup.

But maybe there's something else going on in the 1st inning contributing to the spike. Pitchers are nervous or not warmed up enough, hitters are fresh out of batting practice before getting fatigued. Perhaps this just makes it look like leadoff hitters do best when starting an inning. In fact, if we look at all 4109 times a leadoff hitter was the first batter of an inning other than the 1st inning, the average runs scored is even higher, at 0.603! This leads me to believe that lineup construction contributes more than those other possibile explanations of a 1st inning spike.

So who is actually leading off in each inning after the 1st? The second inning --- with its huge drop in average runs scored --- is most likely to begin with the 4th, 5th, or 6th hitter. From there things start to even out, until by the 8th and 9th, the inning is almost equally likely to be led off by any spot in the batting order. The data for all innings is depicted in the colorful chart below.

Since we know how often each lineup spot leads off each inning, and the average runs scored when each batter leads off an inning, we can attempt to feed these into a model that predicts the (average) runs scored by inning using a weighted average. Then we can compare to the actual values, to see how close we got. Explicitly, if \(\mathrm{RE}_{\mathrm{inn}}^{\mathrm{pred}}(i)\) is our prediction for the i-th inning, we take \[\mathrm{RE}_{\mathrm{inn}}^{\mathrm{pred}}(i) = \sum_{j=1}^9 P(i,j) \cdot \mathrm{RE}_{\mathrm{LH}}(j),\] where \(P(i,j)\) is the proportion of i-th innings led off by the j-th spot in the order (i.e. the data in Figure 5) and \(\mathrm{RE}_{\mathrm{LH}}(j)\) is the expected runs for an inning led off by the j-th hitter in the lineup (i.e. the data from Figure 4). Overlaying these predictions with the actual run expectancy by inning data from Figure 2, we see they are reasonably close.

Our prediction in green has an explained variance of about 0.50, which may suggest that following statement holds water: "the leadoff batter's position in the lineup explains about half of the variability in inning-by-inning run expectancy." Other factors, including closers coming in for the 9th inning, nervous pitchers in the 1st, and hitters having more success the second and third time facing a starting pitcher may all contribute to explaining the other half of the variability.

I repeated these calculations with scoring probability instead of run expectancy, achieving similar results which I won't include here. The explained variance was comparable at 0.49.

Other base-out situations

We could further break down inning-by-inning run scoring by base-out situation, to make a full run expectancy matrix for each inning. This is a little much to include here, but the data and some visuals are available at this spreadsheet. Note that there is considerably less data available in certain situations (namely with a runner at 3rd with 0 outs) and in late innings, so these should be used with a grain of salt.

Let's highlight two situations here and contrast them with the trends we observed earlier. Below we have plotted the run expectancy with the bases empty and no outs (in blue) and that with the bases loaded and 2 outs (in green).

The blue bars are almost identical to the inning-by-inning chart above, as one should expect, since each inning starts in this situation. In particular, we have the same 2nd inning dip, followed by a middle inning rebound, and a late inning dip.

The green bars however, reveal a different trend. They are lowest in the 1st inning and peak in the 2nd, before bouncing around a bit and tailing off in the late innings. From the 1st to 2nd innings, this is the opposite trend! To explain why this is consistent, consider that with 2 outs and the bases loaded, at least 5 batters have come to the plate in the inning so far. Thus if this happens in the 1st, we are likely to have the 6, 7, or 8 hitter up to bat resulting in a lower run expectancy.

If this were to happen in the 2nd inning, assuming 4 or 5 batters hit in the 1st inning (average is 4.3 batters), then it's likely that the top of the order is back, ready to drive in the runs! So even though the trend has reversed, it seems likely to me that this is again influenced by lineup composition. (I'll leave it to you to figure out which positions in the batting order produce the greatest run expectancy in each base-out situation!) The observed decline in the late innings could again be explained by dominant relief arms coming in, or possibly even specialists tasked with facing a single batter to get their team out of the tight spot!

What's next?

All of this is specific to the context of the 2021 MLB season, reflecting how MLB managers constructed their lineups in 2021 season. The patterns we observed and conclusions we might try to draw may not be consistent year-to-year (though this is something that could be investigated in Retrosheet!) and a similar investigation into other seasons or eras might reveal interesting trends.

Another fun follow up might be to see if MLB managers are constructing their lineups optimally. Put another way, if given an "average" MLB lineup of hitters, what batting order is expected to produce the most runs? With some way to simulate innings and games with different lineups, one could try scrambling around a lineup in different ways to see which are most effective. Who knows? Perhaps isn't in fact optimal to stack your best hitters at the top of the batting order, but instead to spread them throughout the lineup.

A more immediately answerable question to end on: how does this all change in extra innings? The data here is more limited, as only 432 regular season 10th (half) innings were played (along with 124 11ths and only 32 12ths). With the designated runner starting on second base, more than half of these innings result in one or more run.

A better comparison might be the probability of scoring with 0 outs and a runner on second base, across all innings.

It looks like scoring probabilities in the 10th and 11th are on the lower side, but both are higher than the 9th. But the sample sizes here are small enough that I'm unwilling to attempt to draw any real conclusions. With more data and thought, I hope to better understand the conditions that affect run scoring in these crucial innings, and ultimately reveal potential strategies.