I couldn’t help myself. I decided to start writing a baseball simulation program. Oh, there are already some programs available, some free, some for sale. But it’s always more fun to do things on your own. Plus, it was really quick and easy to do.

For the purposes of this question, I just did a quick simulation program with just a few features. Each batter only has the following properties: walks per thousand plate appearances (PTPA), singles PTPA, doubles PTPA, triples PTPA, and home runs PTPA. Everything else is an out (and an unproductive one at that). As for baserunning, each player has the following properties: how often they go from second to home on a single, how often they go from first to third on a single, and how often they go from first to home on a double. Everything else is station-to-station baseball. So, there’s a lot I don’t take into account — bunts, sacrifice flies, steals, double plays, errors, the list goes on and on. But it’s a decent approximation for our purposes.

So, as an example, I created a team filled with hitters that approximate the 2009 San Francisco Giants: 67 walks PTPA, 165 singles PTPA, 47 doubles PTPA, 7 triples PTPA, and 21 home runs PTPA. I filled in some guesses as to baserunning percentages. Then I ran the simulation for 100,000 innings. The result was an average of 3.82 runs per game, which is very close to the Giants’ actual RBI average of 3.78 per game (and under their runs per game of 4.05). So that was validation to me that my simulation was fairly accurate. I did the same thing with the 2009 Phillies, and it resulted in 4.96 runs per game, very close to their actual RBI average of 4.86 per game (and under their runs per game of 5.06).

I then ran the same simulations but with each inning starting with 1 out, and then again where each inning started with 2 outs. For the Giants, the opposing ERA went from 3.82 for normal innings to 3.10 for innings that started with 1 out, and 2.34 for innings that started with 2 outs. For the Phillies, the numbers were 4.96, 4.15, and 3.26.

So, ERA for normal innings is about 1.2 times more than ERA for innings starting with 1 out, and about 1.6 times the ERA for innings starting with 2 outs.

So, to calculate someone’s adjusted ERA, let’s define the following:

- R = number of earned runs allowed
- I0 = innings pitched after entering with 0 outs
- I1 = innings pitched after entering with 1 out
- I2 = innings pitched after entering with 2 outs
- Note, for example, if a relief pitcher enters with 2 outs, then finishes that inning and then starts the next, then I2 = 1/3 and the remaining innings are attributed to I0.

Then the adjusted ERA = 9 * R / (I0 + I1/1.2 + I2/1.6)

So, what does this mean in practice? Well, I am ashamed to say that I spent an hour of my life analyzing the 2009 statistics for Brandon Medders (a Giants reliever). Why Medders? I had to pick a reliever, and I just figured guys like Jeremy Affeldt and Brian Wilson mostly started innings. So, Brandon Medders appeared 61 times, giving up 23 earned runs in 68 2/3 innings for an ERA of 3.01. Of those innings, 57 2/3 innings were pitched after starting the inning (or entering with 0 outs), 8 2/3 were pitched after entering with 1 out, and 2 1/3 were pitched after entering with 2 outs.

So Brandon Medders’ adjusted ERA = 9 * 23 / (57.67 + 8.67/1.2 + 2.33/1.6) = 3.12

So, just to summarize, his normal ERA was 3.01 and his adjusted ERA was 3.12. Not a big difference, really. If he had simply given up one more earned run, his ERA would have been 3.15.

So, in practice, it’s not much to worry about, but it was fun figuring it all out. And now I have a baseball simulation program which I will probably refine and expand and use to answer other odd questions, like if a single player hits 30 home runs instead of 20, how many more wins does that translate into?