Filed under:

# Gears of WAR, Part I: Linear Weights

If you buy something from an SB Nation link, Vox Media may earn a commission. See our ethics statement.

Originally, I wanted to make this first story one on error and uncertainty, but I quickly realized I first need to introduce statistics like wOBA and UZR... and before I can explain stats like wOBA or UZR I should first tell you what linear weights are... and before I tell you what linear weights are I should explain what a run expectancy matrix is. So let's start there... run expectancy. Take a look at the following table (taken from Tangotiger's site), which tells you the average runs scored in innings that occurred in the years 1999-2002, starting with given base/out states. The base/out states are a combination of the position of runners, here shown in different rows, and the number of outs in the inning, here shown in different columns. Look below the table for an example on how to use it.

 RE 99-02 0 1 2 Empty 0.555 0.297 0.117 1st 0.953 0.573 0.251 2nd 1.189 0.725 0.344 3rd 1.482 0.983 0.387 1st_2nd 1.573 0.971 0.466 1st_3rd 1.904 1.243 0.538 2nd_3rd 2.052 1.467 0.634 Loaded 2.417 1.65 0.815

Let's use the game state with a runner on second and nobody out as an example. If you want to know how many runs were scored (on average) from this game state to the end of the inning, go to the column labeled "0" (representing the number of outs) and look down to where it intersects the row labeled "2nd" (representing the presence of a runner on 2nd). There, you'll find the value "1.189." This means that, on average, teams scored 1.189 runs in the rest of an inning where there were 0 outs and a runner on 2nd. This particular calculation was for the years 1999-2002, but in principle one could calculate this for any given year or range of years, or even with models. (Professionally, I'm a modeler so this makes me smile.) If you assume that the run expectancy hasn't changed much since this table was calculated, this information is very useful. Every base/out combination is in here, so you can figure out how many runs a team is expected to score in the rest of an inning at any point in the game, assuming average production from that team the rest of the inning. Note that run expectancy doesn't take into account things like whether Derrek Lee or Neifi Perez is due up in the inning, or whether Carlos Zambrano or Aaron Heilman is on the mound. It just tells you how many runs a team would be expected to score the rest of the inning, based on what teams have done in the past starting from the same base/run state. It's an expectation based on precedent. Run expectancy is an important concept, as it's the foundation of a great deal of sabermetric products these days, including the (super-cool) win expectancy charts at fangraphs, their measurements of "leverage index," and some cool individual statistics such as "clutch." It's also at the heart of linear weights, a system that places run values on every type of play - singles, doubles, errors, wild pitches, walks, etc - and in so doing gives us the ability to translate a player's accumulated singles, doubles, stolen bases, etc. into runs created. Once we know the runs created, we can translate that to wins, and that'll give us WAR. But I'm saving that discussion for next time.

Linear weights uses another, larger table (again taken from Tango's site). This table is similar to the prior one, except the entire game states (including both where runners are on base AND the outs) are in now in the different rows and game events (single, double, strikeout, reached on error, etc.) are now in the different columns. The other difference in this table is that the numbers now represent a change in the average number of runs teams scored. This change is the result of the event in the column occurring, and is measured with respect to the game state in the row. Anyways, here's the table (if it doesn't make sense, look past the table for an example):

Base Outs HR 3B 2B 1B RBOE HBP NIBB IBB Bunt Out KO PB WP BK SB CS PO POE OA INT FoulE DefInd
Empty 0 1.04 0.93 0.62 0.39 0.48 0.4 0.4 --- 0.1 -0.26 -.27 --- --- --- --- --- --- --- --- ... -0.22 ---
Empty 1 1 0.65 0.4 0.27 0.31 0.34 0.28 ... 0.04 -0.18 -.19 --- --- --- --- --- --- --- --- ... ... ---
Empty 2 1 0.29 0.21 0.13 0.15 0.17 0.13 ... 0.06 -0.12 -.12 --- --- --- --- --- --- --- --- ... ... ---
Base Outs HR 3B 2B 1B RBOE HBP NIBB IBB Bunt Out KO PB WP BK SB CS PO POE OA INT FoulE DefInd
1st 0 1.67 1.44 1.06 0.68 0.81 0.87 0.59 ... -0.04 -0.47 -.45 0.32 0.31 0.36 0.27 -0.58 -0.34 ... ... ... ... 0.14
1st 1 1.72 1.28 0.95 0.47 0.62 0.43 0.42 ... -0.1 -0.37 -.33 0.07 0.19 0 0.2 -0.46 -0.24 --- -0.48 ... ... -0.14
1st 2 1.87 1.06 0.75 0.26 0.36 0.29 0.23 ... -0.09 -0.25 -.25 0.06 0.06 0.03 0.11 -0.25 -0.15 --- -0.25 ... ... 0.13
Base Outs HR 3B 2B 1B RBOE HBP NIBB IBB Bunt Out KO PB WP BK SB CS PO POE OA INT FoulE DefInd
2nd 0 1.3 1.4 0.97 0.72 0.65 0.38 0.48 -0.32 -0.02 -0.36 -.51 0.28 0.25 ... 0.32 ... -0.65 --- ... ... ... ---
2nd 1 1.6 1.45 1.01 0.68 0.64 0.31 0.24 0.18 -0.16 -0.36 -.39 0.25 0.16 0.28 0.38 -0.6 -0.21 --- ... ... ... ...
2nd 2 1.77 1.08 1.02 0.72 0.58 0.11 0.14 0.02 ... -0.34 -.34 0.14 0.07 ... 0.05 -0.34 -0.2 --- ... ... ... ...
Base Outs HR 3B 2B 1B RBOE HBP NIBB IBB Bunt Out KO PB WP BK SB CS PO POE OA INT FoulE DefInd
3rd 0 1.04 ... 0.78 0.52 0.28 0.24 0.38 ... ... -0.28 -.42 ... ... --- --- ... --- --- ... --- --- ---
3rd 1 1.3 0.83 0.69 0.56 0.55 0.15 0.24 0.21 0.12 -0.25 -.63 ... 0.35 ... ... ... ... --- ... ... ... ---
3rd 2 1.75 1.08 0.97 0.88 0.96 0.22 0.14 0.07 0.27 -0.39 -.38 ... 0.75 ... ... ... ... --- ... ... ... ---
Base Outs HR 3B 2B 1B RBOE HBP NIBB IBB Bunt Out KO PB WP BK SB CS PO POE OA INT FoulE DefInd
1st_2nd 0 1.84 1.89 1.45 0.94 1.03 0.79 0.87 --- 0.11 -0.63 -.66 0.31 0.48 ... 0.66 -0.75 -0.39 --- ... ... ... ...
1st_2nd 1 2.39 1.9 1.54 0.88 0.99 0.68 0.69 ... -0.12 -0.6 -.53 0.35 0.52 0.6 0.42 -0.64 -0.38 --- ... ... ... ...
1st_2nd 2 2.65 1.89 1.52 0.86 0.67 0.29 0.4 ... ... -0.46 -.46 0.01 0.21 ... 0.23 -0.42 -0.19 --- ... ... ... ...
Base Outs HR 3B 2B 1B RBOE HBP NIBB IBB Bunt Out KO PB WP BK SB CS PO POE OA INT FoulE DefInd
1st_3rd 0 1.65 ... 1.29 0.71 0.54 0.55 0.52 ... -0.17 -0.47 -.67 ... 0.2 ... 0.32 ... ... --- ... ... --- ...
1st_3rd 1 2.06 1.66 1.26 0.81 0.95 0.46 0.34 ... -0.16 -0.47 -.74 0.54 0.47 ... 0.28 -0.95 -0.46 --- ... ... ... ...
1st_3rd 2 2.61 1.96 1.46 0.92 1.11 0.24 0.28 ... ... -0.54 -.53 ... 0.61 ... 0.13 -0.43 -0.09 --- ... --- ... 0.02
Base Outs HR 3B 2B 1B RBOE HBP NIBB IBB Bunt Out KO PB WP BK SB CS PO POE OA INT FoulE DefInd
2nd_3rd 0 1.51 ... 0.92 0.85 ... 0.35 0.53 0.26 ... -0.44 -.66 ... ... --- --- --- ... --- --- --- --- ---
2nd_3rd 1 1.83 ... 1.36 0.92 0.76 0.36 0.23 0.14 ... -0.41 -.82 ... 0.63 ... --- ... ... --- ... --- ... ---
2nd_3rd 2 2.53 1.93 1.73 1.46 1.29 0.15 0.22 0.14 ... -0.63 -.63 ... 0.69 ... ... --- ... --- ... ... --- ---
Base Outs HR 3B 2B 1B RBOE HBP NIBB IBB Bunt Out KO PB WP BK SB CS PO POE OA INT FoulE DefInd
Loaded 0 2.12 ... 1.55 1.11 0.82 0.65 0.9 --- ... -0.63 -.72 ... 0.2 ... --- ... --- --- ... --- ... ---
Loaded 1 2.56 2.23 1.88 1.17 1.39 1.08 0.91 --- ... -0.7 -.89 ... 1.03 ... --- ... ... --- ... --- ... ---
Loaded 2 3.31 2.63 2.18 1.53 1.35 0.88 1.06 --- ... -0.81 -.81 ... 1 ... ... --- ... --- ... ... ... ---

#### DefInd

Average 1.409 1.063 0.764 0.474 0.546 0.385 0.33 0.102 -0.001 -.299 -.31 0.285 0.284 0.237 0.195 -.456 -.255 -.953 -.572 0.429 0.026 0.063

Let's continue from the previous example (a runner on 2nd and nobody out) and see the change in the expected runs scored if the next thing that happened was a double. Go to the row with "2nd" in the "Base" column and "0" in the "Outs" column. Now head across that row to the "2B" column. The number there is 0.97. This tells us that, on average, doubles that occurred when there was a runner on second and 0 outs increased the runs scored in the inning by 0.97 runs. This makes sense! Think about it with me for a moment. Most of the time, when there's a double hit with a runner on second, the runner scores. Thus, after the double the team will usually be left with the same situation we started with: a runner on second with nobody out. However, there's a huge difference... a run scored! They're still expected to score 1.189 more runs after the double, and have an extra run across the board. Thus, the increase in run expectancy of 0.97 runs (a number very close to 1) makes sense. This allows us to place a value on that double: in this game state, a double is worth 0.97 runs.

Now if you want to find out how many runs a player added to a team's totals, you could take all the doubles they got with runners on 2nd and nobody out, multiplied each double by its value, and summed the products... and then do that again for every game event in every game state, summing the totals. But there are two problems with that: 1.) it's tedious and 2.) it assumes players do better in certain game states than other game states. I'll show in a later post how there's no reason to believe 2.) is true case except for a couple minor exceptions. Besides, it would be nice to be able to go straight from the stats we'd usually find on player's stats page into runs and wins. Linear weights solves these problems by assigning values to each game event, independent of the game state. Basically, it answers the following question: how much is a generic double (or any other game event) worth, in terms of runs? The answer to that question will let us calculate a player's contributions much more easily, as we'll be able to simply sum up their doubles, singles, etc. all multiplied by the run value for each event type, and ignore all the permutations of game type with game state. We don't have to worry about game state, because we've made the doubles (etc.) all context-independent. In other words, linear weights gives us the bridge we need to get from game events that are easily found in a player's stat page (things like singles, doubles, stolen bases, etc.) to runs created. For pitching, defense, or Ryan Theriot's baserunning it gives us a similar bridge to runs prevented. That's pretty cool, if you ask me.

How does linear weights do this? It takes a weighted average of the value of each event over all the game states. The weighted average allows the game states that occur more often to count more often in the average. This is necessary because, for example, the game state "nobody on, nobody out" will occur much more often than the game state "bases loaded, 2 out." The former state is guaranteed to occur at least 17 times a game; any game in which the latter game state occurs 17 times would be long remembered for its excitement, (and perhaps as Carlos Marmol's longest career outing). The weighted average allows us to account for this discrepancy in how often the game states occur, by applying heavier weights to more common game states. Once we do that, we have the value of the average double... and every other game event. Look at the last row in the above table, which has these values for every game event.

If you understand this much, you've grasped a VERY important concept in sabermetrics. If you "get" how all these game events are valued in terms of runs, you'll be able to easily grasp other advanced stats like UZR and wOBA, two of the most important components in WAR. We'll return next week with a look at wOBA, which is the way we incorporate hitting into WAR; we'll also talk about going from the runs calculated in linear weights to wins. If you DON'T understand what I've said so far, then fire your questions away in the comments section!

Before I finish this piece, I'd like one last word and caveat. You can derive all of these numbers and tables using a variety of methods, even (woot!) models. I showed the number/tables above because they were readily available (thanks to Tangotiger), and because they're empirically derived. It would have taken a lot more text to introduce things like Markov chains. So, just realize there are other ways to derive these numbers, and some will result in "better" numbers than the ones here. Indeed, there are a few wonky numbers in the tables above. If you use Markov chains that wonkiness goes away, but the differences aren't huge and mostly show up in the last decimal place. More than anything else, my goal here is to help people understand what a run expectancy matrix is, and how linear weights allow us to put run values on individual events. Finally, if you're really into this stuff I strongly recommend grabbing a copy of "The Book: Playing the Percentages in Baseball" by Tom Tango (tangotiger), Mitchel Lichtman (mgl) and Andrew Dolphin (dolphin). That book is a great place to learn more about all this stuff, and will include many applications I may not get the chance to talk about here. So get the book - it's worth it!