Game theory and baseball, part 4: if batters were Bayesians

This article will continue my applications of game theory to baseball, continuing with the trend of exploring pitch selection. In the previous two articles, we broke down a series of payoffs and found some surprising results. Perhaps the most surprising was that pitchers with better out-pitches should be throwing them less frequently in two-strike counts than pitchers with mediocre out-pitches. This followed basic game theory, whereby players who would only succeed when their opponent could not predict their actions must select strategies that keep their opponents indifferent.

We considered the following pair of games structured below, where batters are always better off when the actions by the pitcher and batter are strike/swing or ball/take, and pitchers are always better off when the actions are strike/take and ball/swing. The two examples differed in that a pitcher who had a great curveball had an even higher expected payoff to ball/swing.

Table 1

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


Table 2

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

In Table 1, the pitcher threw a strike 50 percent of the time and the batter swung 50 percent of the time. In Table 2, the pitcher threw a strike 56 percent of the time and the batter swung 44 percent of the time. The pitchers with better out-pitches threw more fastballs to encourage the batters to actually swing at their out-pitches when they do throw them.

The most obvious objection to this set-up is that the batter usually has some sense of whether a pitch will land in the strike zone when he sees it thrown. While a batter is often misled by a good pitcher, he at least has some idea what’s coming once it’s been released.

Bayes at the plate

To put this into a proper game theoretic framework, we allow the batter to observe a “signal” after the pitcher throws the ball. The signal will basically imply “this looks like a fastball for a strike”; absence of a signal will basically imply “this looks like a curveball for a ball.” Of course, the signal does not mean that there is a 100 percent chance of a strike; its absence does not imply that there is a zero percent chance of a strike. Instead, let’s call the probability of observing an accurate signal when the pitcher throws “fastball-for-strike” as “x” and the probability of observing an inaccurate signal when the pitcher throws “curveball-for-ball” as “y.” Without loss of generality, we can assume x > y.

So the set-up is that the pitcher must first select a strategy “p,” which represents his probability of throwing a fastball (a strike). The batter must have a two-pronged strategy: q(s) and q(n), depicting his probability of swinging with probability q(s) as a function of receiving a signal, and swinging with probability q(n) as a function of receiving no signal. Unlike the games from the previous article, there is no reason for q(s) to be equal to q(n). Presumably, our batter will set q(s) > q(n), and potentially set q(s)=1 and q(n)=0. This would mean that he swings when he gets a signal that the pitch looks like as a strike.

The batter will behave like a Bayesian, so let’s call him “Willie Bayes.” We’ll call our hurler “Chuck.”

Since this game is sequential, it will require using the extensive form to visualize, which is shown below. The first player to make a decision is Chuck, the pitcher. Decision Node I, at the top, is circled. Chuck must select either a fastball or a curveball to throw.

At this point, the next mover is not the batter, because after Chuck throws a fastball or a curveball, something else must happen. Willie Bayes needs to know whether he has observed a signal or not, something Chuck can’t control. It is typical to write out the next move as being made by “Nature” at this point. Nature is not an agent with preferences—she just follows rules. When Chuck has thrown a fastball, she sends a signal with probability “x” and fails to send a signal with probability “1-x.” When Chuck has thrown a curveball, she sends a signal with probability “y” and fails to send a signal with probability “1-y.”

At this point, Willie Bayes has to formulate two strategies: q(s) for when he gets a signal, and q(n) for when he does not. Decision Node II occurred when he gets a signal, but Willie does not know if this is because Chuck has thrown a fastball and Nature has sent a correct signal, or if Chuck has thrown a curveball and Nature has sent an incorrect signal. Decision Node III, occurs after no signal has been received.

Figure 3A

.image

Batter’s strategy

Fortunately, Willie knows Bayes’ Theorem and constructs probabilities that he is seeing a fastball or a curveball, conditional on receiving a signal. Since we are using backwards induction to solve this problem, we will first develop responses by Willie conditional on Chuck’s strategy “p” and then move backwards to decide how Chuck will respond knowing this.

Willie knows the following probabilities exist:

Fastball and signal: p*x
Curveball and signal: (1-p)*y
Fastball and no signal: p*(1-x)
Curveball and no signal: (1-p)*(1-y)

Therefore, he knows that the probability that Chuck has thrown a fastball when he observes a signal is simply:

Pr(fastball|signal) = px / [px + (1-p)y]

He also knows the probability that Chuck has thrown a fastball when he does not observe a signal:

Pr(fastball|no signal) = p(1-x) / [p(1-x) + (1-p)(1-y)]

He can also construct his payoffs to swinging and not swinging in these scenarios as well:

His payoff to swinging when he receives a signal is equal to the inferred signal-based probability of each pitch multiplied by the value of swinging in each case:

V(s) = { px / [ px + (1-p)y ] } * (1) + { 1 – px / [ px + (1-p)y ] } * (-1)

His value of taking is:

V(t) = { px / [ px + (1-p)y ] } * (-1) + { 1 – px / [ px + (1-p)y ] } * (1)

He swings when the value of swinging, V(s), exceeds the value of taking, V(t). Mathematically, he swings when:

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

(As a check, we can remember that the original non-signal scenario is just a generalization of this set-up where x=y, which yields the p>0.5 rule we found before.)

We can also do the same math to determine when the batter swings if he receives no signal. His value of swinging is the probability of getting a fastball when no signal has been received (calculated above) times the payoff of getting a curveball when no signal has been received times the value of swinging in that case:

V(s) = { p(1-x) / [ p(1-x) + (1-p)(1-y) ] } * (1) + { 1 – { p(1-x) / [ p(1-x) + (1-p)(1-y) ] }} * (-1)

His value of taking is:

V(t) = { p(1-x) / [ p(1-x) + (1-p)(1-y) ] } * (-1) + { 1 – { p(1-x) / [ p(1-x) + (1-p)(1-y) ] }} * (1)

He swings when V(s) > V(t), which is equivalent to saying when:

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

Pitcher’s Strategy

To solve the whole equilibrium, we want to figure out what strategy “p” is optimal for Chuck the pitcher. We know Willie Bayes will set q(s) = 1 when the term { px / [ px + (1-p)y ] } is greater than 0.5, will set q(s)=0 when the term is smaller than 0.5, and will be indifferent between all q(s) values when receiving a signal when the term is equal to 0.5. We also know that Willie Bayes is going to set q(n)=1 when the term { p(1-x) / [ p(1-x) + (1-p)(1-y) ] } is greater than 0.5, will set q(n)=0 when the term is less than 0.5, and will be indifferent between all q(n) values when the term is equal to 0.5.

We know that if Chuck has a strict preference for throwing a fastball when q(s)=q(n)=0 and we know that Chuck has a strict preference for throwing a curveball when q(s)=q(n)=1. In other words, if Willie never swings, Chuck would just always throw fastballs—in which case Willie would always swing, and if Willie always swings, Chuck would always throw curveballs—in which case Willie would never swing. So any equilibrium is going to require Willie swinging at least some of the time and taking at least some of the time. It’s only natural that we need him to prefer swinging when he gets a signal (or at least being indifferent between swinging and taking), and we need him to prefer taking when he gets no signal (or being indifferent).

Knowing this, Chuck will pick a strategy “p” between 0 and 1, reflecting the probability that he throws a fastball, and p will need to be low enough that q(n)=0 is optimal for Willie and high enough such that q(s)=1 is optimal for Willie.

The outcomes could look like any of the following:

Figure 3B

image

We’ll ignore mixed strategies by Willie conditional on signals because they are not necessary here.

Let’s play with some numbers. Let’s set x=0.9 and y=0.4. In other words, let’s assume that the batter is more likely to fail to notice spin on a curveball than he is to mistakenly notice spin on a fastball. This assumption is important to yield the answers below (and will later be generalized).

For Willie to actually prefer to swing when he gets a “signal” that a pitch is a fastball, we need:

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

When x = 0.9 and y = 0.4, this is equivalent to saying p > .31.

For Willie to prefer to take when he gets no signal, we need:

p(1-x) / [p(1-x) + (1-p)(1-y)] < 0.5 which is when p < .86. Therefore, whenever p is between 31 percent and 86 percent, Willie will respond by swinging if and only if he receives a signal. No slouch with Bayes Theorem himself, Chuck must determine his best response to this, having done the requisite backwards induction. Chuck knows that he has to select fastball at least 31 percent of the time and no more than 86 percent of the time. Chuck also know that if he throws a fastball, Willie will swing 90 percent of the time (giving Chuck a payoff of -1), and will take 10 percent of the time (giving Chuck a payoff of 1). Chuck knows that if he throws a curveball, Willie will swing 40 percent of the time (giving Chuck payoff of 1), and will take 60 percent of the time (giving him a payoff of -1). Therefore he must select a strategy “p” that maximizes his expected value: MAX [ (p) * (-1*.9 + 1*.1) + (1-p) * (1*.4 + -1*.6) ] Simplifying this, we know he selects “p” to maximize: MAX [ -0.2 – p ]
Subject to .31 < p < .86. Therefore is must pick “p” that maximizes -0.2 - p, constrained to choosing between 31 percent and 86 percent. Obviously, that’s 31 percent. Therefore, we have solved the game! Chuck throws 31 percent fastballs, and Willie swings when he observes a signal and takes when he does not observe a signal.

Sneakier curveballs

In the last article, we interpreted a better curveball as one that gives the batter a very low payoff when he swings at it—we changed that -1 into a -1.5. In today’s article, let’s re-interpret a better curveball as “looking more like a fastball” but keep with the -1 payoff to swing/ball.

So, in the previous example, we found out what would happen if Willie observes signals after 90 percent of fastballs and 40 percent of curveballs. Now, let’s make 50 percent of curveballs look like fastballs. How will Willie respond to this sneaky pitcher? In the spirit of having a very good curveball, let’s call this pitcher “Uncle Charlie”; or maybe, let’s just call him Charlie.

When Charlie’s on the mound, Willie must still want to swing when he gets a signal, so he requires that px / [px + (1-p)y] > 0.5, which is when p > .36.

To get Willie not to swing when he gets no signal, we require that p(1-x) / [p(1-x) + (1-p)(1-y)] < 0.5, which is when p < .83. Therefore, we need Charlie to throw a fastball with probability “p” such that “p” is between 36 percent and 83 percent. We want Charlie to optimize “p” conditional on that constraint. Using the same approach as above, we can find his goal to be picking the best “p” such that: MAX [ p*(-1*.9 + 1*.1) + (1-p)*(-1*.5 + 1*.5) ]
Subject to .36 < p < .83 This is equivalent to finding: MAX [-0.8p]
Subject to .36 < p < .83 In other words, Charlie must pick the optimal condition “p” such that he maximizes -0.8p, which means the smallest “p” possible as long as p is between .36 and .83. Obviously, that means he chooses p=0.36, which means he throws 36 percent fastballs. Recall that the weaker-curveball-throwing Chuck above threw 69 percent curveballs, while Charlie throws his superior curveball only 64 percent of the time. As we found yesterday in the simpler example, the pitcher with a better curve should throw his curveball less often. This will actually entice batters to swing at it more often, making it more potent when it does come, all the while taking advantage of the batter’s reluctance to swing by throwing more fastballs over the plate for strike three. This result is pretty generalizable, but as we will see tomorrow, there was important assumption that we had to make along the way. I will show what that assumption was, relax it to find exceptions, and also begin to make a more general solution to the pitch selection problem. If nothing else, however, the above should clearly demonstrate that batters and pitchers both could gain an edge by improving their approaches.

Addendum for the advanced reader

It is worth noting that the solution above is not quite a Nash Equilibrium, because the pitcher will strictly prefer to throw curveballs, conditional on the batter’s strategy. The actual Nash Equilibrium is very similar, though, and the results are qualitatively the same.

For the pitcher to be indifferent between throwing a fastball and a curveball, the batter must have a mixed strategy when he gets a signal of fastball. This requires that the pitcher actually selects a strategy that keeps the batter indifferent between swinging and taking when getting a signal, which is the same px / [px + (1-p)y ] = 0.5 condition above.

The solutions of 31 percent and 33 percent above hold for the pitcher’s strategy. Setting the pitcher’s value of throwing a fastball to a curveball, the batters achieves this when = 1/(x+y). Therefore, the batter actually does swing a little bit less often when getting a signal from the superior pitcher (77 percent vs. 71 percent).

Tomorrow: Generalizing the pitch selection model


Matt writes for FanGraphs and The Hardball Times, and models arbitration salaries for MLB Trade Rumors. Follow him on Twitter @Matt_Swa.

Comments are closed.