More Fun with Markov: Custom Run Expectancies

Before the season, I put up a three-part series (1, 2, and 3) that explained how linearly-weighted stats like wOBA, while useful for comparing players to each other, don’t necessarily reflect each player’s true contribution to their team’s run scoring.  You see, the weights used to calculate wOBA are based on league averages.  So, for a team with league average breakdowns in walk rate, singles rate, home run rate, etc., wOBA (and its offspring, wRC+) ought to work very well in figuring out how valuable a player is (or would be) to an offense.  However, when it comes to particularly bad or good offenses, or to those with unusual breakdowns, wOBA will lose some of its efficacy.

Why?  There are synergistic effects in offenses to consider.  First of all, if a team gets on base a lot, there will be more team plate appearances to go around, which of course gives its batters more chances to contribute.  Second of all, if the team gets on base a lot, a batter’s hits are generally worth more, because they’ll tend to drive in more runs.  And, of course, once the batter gets on base in such a team, it will be likelier that there will be a hit (or series of hits) to drive him in.  The reverse of all three points is true in a team that rarely gets on base.

But it goes even beyond that.  Let’s say Team A gets on base 40% of the time, and Team B gets on only 20%, but their balances of the ways they get on base are equal (e.g. each hits 7x as many singles as they do HRs) .  A home run is going to be worth something like 14% more to Team A, due to more runners being on base.  However, to Team B, a home run is worth over ten times as much as a walk, whereas to Team A, it’s worth only about 5 times as much.  That’s because Team A has a much better chance of sustaining a rally that will eventually drive in that walked batter.  Team B will be much more reliant on home runs for scoring runs.

That’s where Tom Tango’s Markov comes into play.  It’s what I used to calculate the above values.  You can play with it on his site, or download the spreadsheet version I made, which will allow you to paste sheets of Standard Batting data from FanGraphs into it, so that you can analyze many teams at a time.  Today, I’ll be introducing a new spreadsheet that instead of spitting out linear weights like my last version, outputs the expanded run expectancy matrix introduced to Tango’s Markov by Bill Skelton (link).

Why should you care about run expectancy breakdowns?  Well, knowing the distributions of the runs scored is even more important than knowing the average runs scored, when it comes to your chances of winning a game in progress.  That’s why they’re the basis of win expectancies.  A spreadsheet aimed at that should be coming shortly, by the way.

With this version, you should actually be able to play with the spreadsheet right here in the browser.  As before, you can also download it via the green icon at the bottom of the Web App.

Other than the entire “Enter Data Here” sheet you can select near the bottom, the red-outlined boxes are the ones you should be manipulating.  When you encounter a drop-down list, you can select the desired value manually, or begin to type it to narrow down the list.

Besides the lack of linear weights (which require a lot of calculations), one difference from the last Markov I posted is that it’s now set up to adjust each team’s rate of taking extra bases by their BsR score, which you can find under the team’s dashboard.  My old system worked fine for typical teams, but when I tried to input Mike Trout’s stats (to simulate a team of 9 Trouts), it became pretty clear that the adjustments weren’t making sense there.

Moving on: what you’ll see on the featured Run Expectancy sheet above is not only the team’s theoretical run expectancy to the end of the inning starting from each of the 24 possible base-out states, but also the run frequency breakdown of each state.  For the default team, the 2013 Red Sox, we see in the top left corner output box that starting from the bases empty (xxx), zero-out state, the team should be expected to score no runs through the rest of the inning 68.77% of the time.  14.72% of the time, they should score exactly one run; 8.33% of the time, they should score exactly two runs, etc.  Under the Total Run Expectancy column, we see that they’re expected to score an average of 0.6288 runs from that state.  Since bases empty with none out is the starting state of any inning, we should expect the 2013 Red Sox to score 0.6288 runs in the average inning, or 5.6592 runs per 9-inning game, going by this. 

You may have noticed that doesn’t exactly match up with value in the Expected Runs per Game box you see at the top.  Well, if you set the Reduce PAs by GDP, CS, and OOB estimate option of the Results sheet to “N,” things should be back in sync.  That feature was my way of kind-of-but-not-really accounting for the double plays, caught stealings, and other outs on bases that the Markov doesn’t account for (legitimately accounting for them makes things a lot more complicated).  So keep in mind that all the run expectancies you’re seeing also don’t account for outs on bases at all.  They sort of account for stolen bases, due to the aforementioned BsR tweaks I instituted, but you can disable that via an option on the Results sheet, or you can instead manually adjust extra base rates for each team.

So, it’s not entirely perfect, but the Markov does have an extremely solid mathematical foundation, that can provide expected values for situations that rarely (or never) occur, such as those in unusual run environments.  Just to ground things a bit, here are some observed values.  You’ll notice the double play coming into effect in that chart.  An excerpt, looking at the chances of scoring exactly two runs from the various base-out states where only one runner is on base:

Runner on: Outs Chance of 2 Runs
1st 0 12.4%
2nd 0 14.0%
3rd 0 14.8%
1st 1 8.6%
2nd 1 9.6%
3rd 1 9.8%
1st 2 4.4%
2nd 2 4.6%
3rd 2 4.6%

If not for the threat of outs on the bases, then whether the runner is on first, second, or third wouldn’t matter in this situation (and this is how the Markov treats it).  It of course matters a lot when it comes to the chance of scoring one run, but for scoring two runs, what matters is whether a batter after the runner scores.  When we see the small difference between the different two-out situations, it’s because a double play isn’t possible there, and the threat is probably of the runner on first base being more aggressive and getting thrown out trying to take extra bases.  But otherwise, the differences are pretty significant.  I do question whether runner on third, no outs results are a bit fluky, though, as it’s the least common base-out state in the table, and therefore more affected by randomness and maybe even biases (certain types of teams may be likelier to encounter such a state).  Looking closer at the linked table, you’ll see some more results that I’m pretty sure are the result of flukes, such as more innings of 3+ runs starting from a two-out, runner on second state than from a two-out, runner on third.  If you tried to further break down the results by different run environments, there would be flukes galore, as the sample sizes dropped.

 Subtle Differences

Let me show you one example of how teams with the same overall run expectancies can have different run distributions.  Consider, if you will, the 2010 Tigers and the 2010 Blue Jays:

Team PA HR R AVG OBP SLG wOBA wRC+ BsR
Tigers 6312 152 751 0.268 0.335 0.415 0.33 102 7.8
Blue Jays 6072 257 755 0.248 0.312 0.454 0.334 105 -11.4

Very similar results in terms of runs, and pretty similar wOBA, but otherwise pretty different, right?  Making my spreadsheet consistent with Tango’s Markov by setting the options to “N” and “Uniform,” and by removing HBP from the equation, you’ll see that the Markov expects them to score about the same number of runs per inning, but with a different breakdown.  The following is for the bases empty, none out state:

Team  0 runs 1 run 2 runs 3 runs 4 runs 5 runs Total Run Expectancy
Blue Jays 71.23% 14.86% 7.70% 3.59% 1.56% 0.64% 0.5323
Tigers 72.22% 13.83% 7.40% 3.62% 1.67% 0.73% 0.5336

So, the Jays’ homers are expected to make them less likely to go scoreless in an inning, on average, but their lower OBP means they’re also less likely to have a big inning.

The differences become more dramatic with two out:

Team 0 runs 1 run 2 runs 3 runs 4 runs 5 runs Total Run Expectancy
Blue Jays 91.74% 5.72% 1.76% 0.54% 0.17% 0.05% 0.1192
Tigers 93.06% 4.63% 1.54% 0.51% 0.17% 0.06% 0.1041

Since it’s a lot harder to sustain a rally that starts with two out, we see that not only are the Jays less likely to get shut out in this situation, but their overall run expectancy is actually significantly higher as well.

Here’s where the Tigers have the biggest advantage over the Jays — bases loaded, none out:

Team 0 runs 1 run 2 runs 3 runs 4 runs 5 runs 6 runs 7 runs 8 runs Total Run Expectancy
Blue Jays 13.64% 25.70% 18.93% 12.97% 14.86% 7.70% 3.59% 1.56% 0.64% 2.4200
Tigers 12.11% 24.32% 20.48% 15.30% 13.83% 7.40% 3.62% 1.67% 0.73% 2.4789

Notice how the 4-8 run range here and the 1-5 range in the bases empty, no out situation are the same?  Makes sense, right?  Again, the Tigers’ greater ability to put the hurt on a team with a big rally shines through here.

So, there you have it.  Hope you enjoy!

 




Print This Post



Steve is a robot created for the purpose of writing about baseball statistics. One day, he may become self-aware, and...attempt to make money or something?

13 Responses to “More Fun with Markov: Custom Run Expectancies”

You can follow any responses to this entry through the RSS 2.0 feed.
  1. Adam says:

    This is very interesting. I wonder if the difference in how the runs scored affects the overall wins a team will have in a season. Is it better to have big innings or just one run at a time? I would assume that since they score the same amount of runs it doesn’t matter, but I would like to know for certain.

    Vote -1 Vote +1

    • Adam says:

      Assuming of course that both teams have the same number of runs allowed.

      Vote -1 Vote +1

    • Thanks! Good idea. Yeah, I definitely think it could make a difference. I think it of course depends a lot on the quality of their pitching and its consistency (relevant: http://www.fangraphs.com/blogs/simulating-the-impact-of-pitcher-inconsistency/). I think if a team has consistently bad pitching, and their offense tends to score considerably fewer runs than their defense allows, they’ll win more games if they have the offense more likely to put up big numbers every once in a while (the high-OBP type). However, if their pitching is solid, they might be better off with the greater consistency a more HR-centered offense should bring.

      Would anybody be interested in a simulator of that?

      Vote -1 Vote +1

      • Paul Thomas says:

        I want to say that there was a study a few years ago that showed that high-SLG, low-OBP teams (your “solo HR” specialists) tended to outperform their Pythagorean win/loss percentage by a game or two per season, and vice versa for low-SLG, high-OBP teams (which depend more on rallies).

        Vote -1 Vote +1

        • channelclemente says:

          Then there’s Bochy and the Giants teams. They usually beat the Pythagorean mean as well.

          Vote -1 Vote +1

        • Brandon says:

          Interesting. This would make sense, since scoring runs in bunches would mean you’d be more likely to have more meaningless runs. I doubt the effect would be large (these things usually have small run/win differentials), but I bet it’s there.

          Vote -1 Vote +1

  2. Clarence in Austin TX says:

    Great work. I always look forward to Steve’s articles.

    Vote -1 Vote +1

  3. channelclemente says:

    Paragraph 5, above Table I addresses the feature of analysis almost everyone misses, the shape of the distribution. Interesting, and very thought provoking arguments.

    Vote -1 Vote +1

  4. japem says:

    First of all, fantastic as always. You have become one of my favorite writers on this site.

    Secondly, I would say that you should write more articles, but I realize that it probably takes an immense amount of research for each one, so instead I’ll say that you should keep prioritizing quality over quantity.

    Thirdly, how the hell do you do a Markov chain?

    Vote -1 Vote +1

    • Connor says:

      A basic Markov Chain is very simple. For an process to be modeled with a Markov Chain, the next ‘state’ has to rely SOLELY on the state preceding it.

      For example, if there is a 50% chance of rain tomorrow given that it rained today, and a 10% chance of rain if it was dry today, that could be modeled by a Markov Chain. This is because the next day’s weather can be predicted based on the weather today, and ALL YOU NEED TO KNOW is the weather today. You would write it like this:

      S = [0,1] ~ The State Space, or possible outcomes. 0=Dry, 1=Rain

      P = 0 1
      0 [.9 .1]
      1 [.5 .5]

      This is called the Probability Transition Matrix. The vertical 0,1 represents the weather today, the horizontal 0,1 represents the weather tomorrow. This tells you if it is dry today (vertical 0), it will be dry tomorrow (horizontal 0) with probability .9, and rain tomorrow with probability .1. If it is raining today (vertical 1) is will be dry tomorrow (horizontal 0) with probability .5 and rain tomorrow with probability .5.

      Feel free to ask any more questions! I hope my formatting comes out.

      Vote -1 Vote +1

    • Thanks japem! And thanks for the explanation, Connor. I’d been busy working on a project for THT’s annual, but I think I should get some good work in this offseason.

      As for how this particular Markov works, viewing the source code of this page will give you the best understanding: http://www.tangotiger.net/markov.html (right click, select “View Source”). But the gist of it is this:
      1) Begin with the basic probabilities of singles, doubles, walks, etc. (per PA)
      2) Start with the bases loaded, 2 out state — the probability of you not scoring more in the inning is equal to the chance that you’ll make an out. Next comes the runner on 3rd, 2 out, with one open base situation: now it’s possible that the batter will walk, which will not result in a score, or that he will make an out, so the chances of not scoring are a little higher. If the only runner is on 3rd, then there can be two walks without scoring, so you multiply the chance of a walk with the chance of not scoring in the previously mentioned (2 runners) state, and again add the chance of making an out. It gets more and more complex as you go on, figuring in the chances of taking extra bases on hits or outs, and chaining off of one or more of the simpler states.
      3) Find the chance of the runner scoring from a particular base by calculating 1 minus the average of the applicable states (you have to convert from the chance of not scoring, which is something I believe Tango did to make the calculations more efficient).
      4) Apply these chances to the chances of a batter getting on the applicable bases.
      5) Find total runs per game by adding up the chances in step 4 (plus the chance of a HR) and multiplying by the team’s expected PA per game.

      Hopefully that makes some sense. It’s not simple, as you can see in the Calculations sheet.

      Vote -1 Vote +1

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Current day month ye@r *