December 4, 2013

THT Essentials:
 Fangraphs Player Search:

And here's the full roster.

#### Get It Now!

The tenth Hardball Times Annual is now available. It's got 300 pages of articles, commentary and even a crossword puzzle. You can buy the Annual at Amazon, for your Kindle or on our own page (which helps us the most financially). However you buy it, enjoy!

## Search THT:

Or you can search by:

#### THT E-book

Third Base: The Crossroads is THT's e-book, available for \$3.99 from the Kindle store. The good news is that anyone can read a Kindle book, even on a PC. So enjoy the best from THT in a new format.

Get your very own THT merchandise from our CafePress store. We've got baseball caps, t-shirts, coffee mugs and even wall clocks with the classy THT logo prominently displayed. Also, check out the THT Bookstore. Please support your favorite baseball site by purchasing something today.

# Game theory and baseball, Part 5: Generalizing the pitch selection model

by Matt Swartz
December 21, 2012

For the past four articles, I have discussed various applications of game theory to baseball analysis. Last time, I developed a new framework for pitch selection wherein a pitcher named Chuck decides whether to throw a fastball or a curveball, after which a batter named Willie Bayes may get a noisy signal of whether a fastball has been thrown. Upon receiving the signal, Willie decides whether to swing.

The set-up is shown below as an extensive form game:

Figure 3A

Remember that “Nature” is not an agent with preferences, but a mechanism that acts after Chuck throws. It gives a signal of “fastball” with probability “x” when a fastball is thrown, but also gives a “fastball” signal when a curveball is thrown with a smaller probability “y.”

We assumed that the normal form of the game had the following structure:

Table 1

 Pitcher\Batter Swing Take Strike (Fastball) -1,1 1,-1 Ball (Curveball) 1,-1 -1,1

In the equilibrium to this game, the pitcher randomizes—he throws both fastballs and curveballs with positive probabilities. The batter swings if and only if he gets a signal of fastball. In fact, this is always the equilibrium structure if we assume that the batter is relatively better off when he swings at fastballs than taking them, and relatively better off when he takes curveballs than swinging at them.

Last time, we made two sets of assumptions about “x” and “y” and solved for the equilibria:

1) We assumed that x = 0.9 and y = 0.4. This led to an equilibrium where the pitcher threw a fastball 31 percent of the time, and the batter swung only if he received a signal.
2) We assumed that x = 0.9 and y = 0.5. This led to an equilibrium where the pitcher threw a fastball 36 percent of the time, and the batter swung only if he received a signal.

The surprising discovery here was that the pitcher with the better (harder to detect) curveball threw it less often an equilibrium, so as to entice the batter to swing more often.

More generally, the batter preferred to swing when receiving a signal (conditional on pitchers throwing fastballs with probability “p”) as long as:

px / [px + (1-p)y] > 0.5

He preferred to take when he did not receive a signal as long as:

p(1-x) / [p(1-x) + (1-p)(1-y)] < 0.5

### Chuck, the average pitcher

In the above pair of examples, I constructed a reasonable scenario where pitchers with better curveballs used them less frequently as out-pitches than pitchers with inferior curveballs. Now, let’s tweak the assumptions such that an average pitcher, “Chuck,” has a fastball that “looks like a fastball” just 60 percent of the time, while a mediocre curveball “looks like a fastball” just 10 percent of the time. Let’s solve for the equilibrium, borrowing from the formulas above.

To entice Willie to swing when he gets a signal (i.e. when the pitch “looks like a fastball”), we need 0.6p/(0.6p + 0.1(1-p)) > 0.5, which is when p > .14.

To entice Willie to take when he gets no signal, we need 0.4p/(0.4p + 0.9(1-p)) < 0.5, which is when p < .69.

Therefore, any equilibrium will require Chuck to throw a fastball between 14 percent and 69 percent of the time. What will Chuck want to do within these limits? His strategy consists of solving a “p” such that:

MAX [ p*(-1*0.6+1*0.4) + (1-p)*(1*0.1+-1*0.9) ]

which simplifies to

MAX [0.6p – 0.8].
Subject to .14 < p < .69

Therefore, Chuck wants to throw the highest percentage of fastballs that the equilibrium will allow—which is 69 percent.

### Charlie, the good pitcher

Now suppose that Charlie has a dominant curveball that actually looks like a fastball 20 percent of the time, while having the same fastball as Chuck that looks like a fastball 60 percent of the time.

To entice Willie to swing when he gets a signal, we need “p” such that 0.6p/(0.6p + 0.2(1-p)) > 0.5, which is when p > 0.25.

To prevent Willie from swinging when he gets no signal, we need “p” such that 0.4p/(0.4p + 0.8(1-p)) < 0.5, which is when p < 0.67.

Therefore, Charlie will need to throw between 25 percent and 67 percent fastballs to entice Willie to swing only when he gets a signal. He will solve:

MAX [ p*(-1*0.6+1*0.4) + (1-p)*(1*0.2+-1*0.8) ]

which simplifies to

MAX [ 0.4p – 0.6 ].
Subject to .25 < p < .67

Charlie also wants to throw as many fastballs as possible: so he throws 67 percent fastballs and 33 percent curveballs. Chuck, who had an inferior curveball, actually threw 31 percent curveballs. So now we have the opposite outcome from yesterday: The pitcher with the superior curveball throws it more often as an out-pitch.

### More generally

What was different about the second pair of pitchers? Why was Charlie less likely to throw curveballs as an out-pitch than Chuck under the first set of assumptions, and more likely to throw curveballs as an out-pitch under the second set of assumptions? This can be derived simply by looking at the variables more generally. Once we do that, we can figure out what type of assumptions makes more sense as a realistic description of the major leagues.

As long as we have the set-up of payoffs above, we know that any equilibrium requires:

y/(x+y) < p < (1-y)/(2-y-x)

And then we need the pitcher to maximize:

MAX [ p*(-1*x + 1*(1-x) + (1-p)*(1*y – 1*(1-y)) ]

which simplifies to

MAX [ 2p*(1-x-y) + (2y-1) ].

This structure makes it clearer—the maximand is always linear with respect to “p,” which means that whenever x+y > 1, the pitcher responds by setting “p” as low as possible, which is y/(x+y). This term increases with respect to “y,” the variable that describes how often a curveball looks like a fastball (i.e. how good it is). So the better the pitcher’s curveball is, the less he throws it.

When x+y < 1, the pitcher responds by setting “p” is high as possible, which is (1-y)/(2-y-x). This term gets smaller as “y” gets bigger (i.e. when the curveball gets better), so the pitcher throws more curveballs when his curveball is better.

### When the fastball is as mistakable as the curveball

The borderline case is when x+y=1. As an illustration, let’s consider when x = 0.7 and y = 0.3. In this case, we know that Willie will swing when:

y/(x+y) < p < (1-y)/(2-y-x)
0.3 < p < 0.7

So anything between 30% and 70% will work, but what will the pitcher prefer? He will find the maximizer of:

MAX [ p*(-1*x + 1*(1-x) + (1-p)*(1*y – 1*(1-y)) ]

which cancels out all of the “p”s when you simplify and get:

MAX [ -0.4 ].

In other words, any “p” that the pitcher chooses will give him the same expected value, as long as “p” is between 30% and 70%. Therefore, we have multiple equilibria (in fact, infinitely many equilibria), and no general rule could be established.

### The key assumption

So, does my surprise equilibrium accurately describe the world of major league baseball? Does x+y exceed 1? If so, then the surprising result that pitchers with great out-pitches should be showing them less often in two-strike counts than pitchers with mediocre out-pitches will hold. To me, it seems like a logical statement that x+y exceeds 1, which means that hitters are more likely to mistake a curveball for a fastball than mistake a fastball for a curveball.

### One last wrinkle

Another assumption that I made in the equilibrium above was to suppose that the difference between the gap in payoffs between strike/swing and strike/take is equal to the gap between ball/take and ball/swing. Let’s relax this assumption. This will allow us to compare the value of pitches in different counts relative to each other.

Here is a generalization of this payoff table:

Table 2

 Pitcher\Batter Swing Take Strike (Fastball) -0.5,0.5 0.5z,-0.5z Ball (Curveball) 0.5,-0.5 -0.5z,0.5z

In this case, Willie’s value of swinging, conditional on Chuck’s strategy of throwing “p” fastballs is:

V(s) = 0.5*(xp/(xp+y(1-p))

His value of taking when getting a signal is:

V(t) = 0.5*z*(y(1-p)/(xp+y(1-p))

Therefore, to entice Willie to swing when he gets a signal, we need V(s) > V(t), which is when:

p > zy/(x+zy).

A batter’s value of taking when he gets no signal is:

V(s) = 0.5*((1-x)p/((1-x)p+(1-y)(1-p)))

And his value of taking when he gets no signal is

V(t) = 0.5*z*((1-y)(1-p)/((1-x)p+(1-y)(1-p)))

A batter won’t swing with no signal when V(s) < V(t), which is when:

p < z(1-y) /(z(1-y)+(1-x)).

Knowing this, Chuck selects “p” to maximize:

MAX(p*(-0.5x+0.5z(1-x)) + (1-p)*((0.5y – 0.5z(1-y)))

which simplifies to:

MAX(0.5*(y-z(1-y) + p*(z(2-x-y)-(x+y)))).

Therefore, the more general version of the hypothesis is that the pitcher should throw a greater out-pitch less often when:

x+y > z(2-x-y)

He throws a greater out-pitch more often when:

x+y < z(2-x-y)

Therefore, we get the following general solution:

• When x>0.5 and y>0.5, we know that x+y > z(2-x-y) definitely holds, which means that the pitcher minimizes fastballs. However, the higher "z" gets, the more fastballs the pitcher has to throw to entice the batter to swing.
• When x<0.5 and y<0.5, we know that x+y < z(2-x-y) definitely holds, which means that the pitcher maximizes fastballs. However, the lower "z" gets, the more curveballs the pitcher has to throw and still entice the batter to take.
• When x>0.5 and y<0.5, we know that x+y > z(2-x-y), only holds when "z" is small enough. When "z" is sufficiently small, the pitcher minimizes fastballs, but the smaller that "z" gets, the more fastball the pitcher has to throw fastballs to entice the batter to swing. On the other hand, if "z" is large enough, the pitcher maximizes fastballs, but the higher that "z" gets, the more the pitcher has to throw curveballs to still entice the batter to take.

Verbally, this says that:

• When most fastballs look like fastballs and most curveballs look like fastballs, then the bigger the benefit the pitcher gets from throwing a strike when the batter is taking (relatively to when he throws a ball and the batter is taking), the pitcher minimizes the amount of fastballs he throws. However, for the largest gaps, he must throw fastballs more frequently to entice the batter to swing.
• When most fastballs look like curveballs and most curveballs look like curveballs, then the smaller the benefit the pitcher gets from throwing a strike when the batter is taking (relatively to when he throws a ball and the batter is taking), the pitcher maximizes the amount of fastballs he will throws. However, for the smallest gaps, he must throw curveballs more frequently to entice the batter to take.
• When most fastballs look like fastballs and most curveballs look like curveballs, then the smaller the benefit the pitcher gets from throwing a strike when the batter is taking (relatively to when he throws a ball and the pitcher is taking), the pitcher minimizes the amount of fastballs he throws. However, for the smallest gaps, the more he has to throw fastballs to entice the batter to swing. When the gap is large enough, however, the pitcher wants to throw as many fastballs as he can, but the larger that gap, the more he must throw curveballs to entice the batter to take.

Of course, this is only the tip of the iceberg in how we can vary these payoffs, and more general rules could be found with sufficient variation.

### Going forward

These articles have only served to develop a framework. Going forward, analysts could use FanGraphs’ o-swing and z-swing statistics to actually calculate some more exact payoffs. Variation in pitch usage by count could be explored differently, too, using these payoffs. Additionally, discussions with players could determine ability to detect pitches. Variations in counts could be used to adjusted x+y and z frameworks. Other pitches could be added to complicate the equilibrium for pitchers with more than two pitches, too.

The goal of these last four articles on pitch selection (and on these last five articles on game theory in general) was not to issue a final word on the proper way to play perfect baseball, but to instead talk about how much teams could improve their chances by thinking about strategy like real strategists do. There is no reason to assume that typical mechanisms of “free markets” to ensure efficiency would emerge in a baseball setting, simply because there are so few people on the planet with the skills to make it onto the diamond. Now, the opportunity is there for whoever wants to add strategy on top of talent.

Similarly to yesterday's article, the above examples are not true Nash Equilibria, because the pitcher is not indifferent between the fastball and the curveball. However, the results are similarly equivalent like yesterday, whereby the batter randomizes in some situations to make the pitcher actually indifferent. The batter will take occasionally when getting a signal of fastball in those examples above where the pitcher would otherwise minimize fastballs (i.e. making the hitter indifferent between swinging and taking when getting a signal), and he will swing occasionally when getting no signal of fastball in those examples above where the pitcher is maximizing fastballs (i.e. making the hitter indifferent between swinging and taking when getting no signal).

The batter would set q(s) = p[z(2-x-y) + (x+y)] / [2(x+y)] when q(n) = 0, and would set q(n) = [z(2-x-y) - (x+y)] / [2z(2-x-y)] when q(s) = 1.

Matt Swartz finished his Ph.D. in Economics at Penn in 2009, and now applies his degree to the serious topic of baseball. Matt also writes regularly for FanGraphs, and has published at MLB Trade Rumors and Baseball Prospectus. He can be reached at matthewTswartz at gmail, or on Twitter @Matt_Swa.

dcs said...

—-” Now, the opportunity is there for whoever wants to add strategy on top of talent.”

Do you really think there is anyone on the planet with 1) the physical talent to play in MLB, 2) the mental talent to understand all this stuff, and 3) the desire and ability to figure out how to apply this stuff to real life 90mph baseball?

Posted 12/21  at  08:55 AM
Matt Swartz said...

Pitchers and catchers don’t need to pick their pitches themselves, and hitters get guidance from coaches too. It’s not hard to imagine a manager telling his pitcher that the front office has noticed that he can sneak a lot of fastballs into 2-strike counts because no one seems to be swinging at them, nor is it hard to imagine a manager telling a hitter that the guy on the mound relies too much on his breaking ball with 2-strikes and you can usually take. Guiding them on randomization strategies doesn’t seem that improbable either. No one needs to be writing out Lagrangians on the mound. They just need to know that the front office says that this inning they need to throw a fastball in a 0-2 count to this batter, and a curveball in a 1-0 count to the next batter.

Kirk Gibson said that advanced scouts told him that Eckersley usually threw backdoor sliders on full counts, and used it to hit that home run in ‘89. There’s plenty of room for better strategy when it comes to being less predictable.

Posted 12/21  at  09:32 AM
Alan Nathan said...

Matt…I spent some time today going through all five articles very carefully, working out all of the arithmetic myself and generally convincing myself that I understand it.  You did an excellent job developing the topic, progressing from the simple to the more difficult, gradually making the treatment more general as additional complexity is put in.  And most importantly, you provided interpretations of what the numbers are actually telling you about the game of baseball.  Very nice piece of writing!

Posted 12/24  at  06:09 PM
Page 1 of 1
Commenting is not available in this weblog entry.

<<Previous Article:  AL East and parity in 2013