Wednesday, April 19, 2017

Game Theory and Baseball

Introduction

As we all know, game theory is the study of strategic decision making between intelligent rational individuals. Game theory, surprisingly enough, can lend itself very useful to the game of baseball. The players, managers, and individuals in the front office all make decisions based on beliefs about expected actions of others. All of these decisions can be better understood using game theory.

Strategies, Nash Equilibrium, and Best Responses

An important part of game theory is that it incorporates other people's actions in determining one's own. Let's review some basic definitions so that we can better understand how game theory relates to baseball.

Strategy: An option that any player, manager, or individual within the organization can make at any time, conditional on the information that he/she has at the time.

Simultaneous Move: The two teams choose their actions without knowledge of the actions chosen by the other team. An example in baseball would be choosing lineups at the beginning of the game.

Sequential Move: One team chooses their actions before the other teams chooses theirs. The later team must have some information of the first's actions, otherwise there wouldn't be a strategic advantage. An example in baseball would be using a strategic substitution in the middle of the game.

Nash Equilibrium: An outcome to a game where each team has "best responded" to each other's strategies. Neither team can improve their outcome by changing their strategy.

Example of Game Theory Applied to the MLB Draft

Let's look at an example that involves drafting players. For this example, let's assume that all contracts are worked out in advance and that all decisions are simultaneous.













The above table shows the expected payoffs for each team if they draft a college player or a high school player. To figure out what each team will do, we need to figure out what the best response would be to each pick. Note that this is a real life example of the prisoner's dilemma which we looked at last week. From our learning of nash equilibriums and the prisoner's dilemma, we should know that the only nash equilibrium in this example is (3, 3) where both teams draft a high school player. Since drafting a high school player always leads to a better payoff, it is considered a dominant strategy for both teams.

The above table is an example of how this game can be displayed using "normal" form. Now let's look at the same example using "extensive" form. We can see that the tree below is useful for sequential games because it shows the order of decision making. So, let's assume here that we are playing a sequential game where the Red Sox pick first and the Yankees pick after observing the Red Sox choice.


In the tree above, there are three decisions that can be made.

• The Red Sox pick high school or college
• The Yankees observe the Red Sox pick of high school and pick high school or college
• The Yankees observe the Red Sox pick of college and pick high school or college

If the Red Sox choose high school, then the Yankees will see this and choose high school because 3 is a better payoff for them than 1. Similarly, if the Red Sox choose college, then the Yankees will see this and choose high school because 7 is a better payoff for them than 5. So, either way, the Yankees will pick high school.

Now, let's use backward induction to figure out what the Red Sox will do with the first pick. The Red Sox know that they will end up with a payoff of 3 if they pick high school because they know the Yankees will choose high school. They also know that they will end up with a payoff of 1 if they pick college because they know they Yankees will choose high school. Therefore, the Red Sox will choose high school because a payoff of 3 is greater than a payoff of 1. Hence, we arrive at our nash equilibrium of 3, 3.

Alright, enough of this draft stuff. Let's talk about how game theory is actually applied during games.

Pitch Selection/Optimization and Batter Response

Pitch selection is arguably the most important use of game theory in baseball. The timeless struggle between pitcher and batter is one of dominance. It is the players' job to adapt to each other's strategies in order to gain an advantage and ultimately win the game. In the case of pitching, game theory can be used to predict pitch optimization for strategic purposes.

Dominant Strategies:

For the following example, let's consider pitch selection as a simultaneous move game between the pitcher and the batter. In this example, we will show why it may be better for batters to take on a 3-0 count.

* taking is just another term for not swinging
* the count is the number of strikes vs. the number of balls

There are four outcomes after a ball is pitched.

• Pitcher throws a ball and batter takes
• Pitcher throws a strike and batter takes
• Pitcher throws a strike and the batter swings
• Pitcher throws a ball and the batter swings













In the above payoff matrix, we call the payoffs to the hitter 4, 3, 2, and 1 and call the payoffs to the pitcher the negatives of these numbers.

Can anyone figure out if the batter or the pitcher has a dominant strategy here? What is the nash equilibrium is in this example? What should the pitcher prefer? Keep in mind that pitch selection is a simultaneous move game between the pitcher and the batter.

Mixed Strategies:

It turns out that in most cases, pitch selection and batter response are best solved by mixed strategies. A mixed strategy entails a player selecting two or more strategies with probabilities between 0 and 1. The nash equilibrium requires the player be indifferent between two or more strategies conditional of his opponent's (potentially mixed) strategy.

Let's suppose that the batter is up and is deciding whether to swing or take on a 3-2 count. Let's also suppose that the pitcher is deciding whether to throw a strike or a ball. Again, there are four outcomes after a ball is pitched.

The payoff matrix for the outcomes is below.













We can see that this game requires mixed strategies to find the nash equilibrium. The way to view this game is to define strategies by "p" and "q" such that the pitcher will throw a strike with probability "p" and the batter will swing with probability "q". We can see the payoff matrix for this below.













In the end, the only strategies that will work will be when the batter swings 50 percent of the time and takes 50 percent of the time, and the pitcher throws a strike 50 percent of the time and throws a ball 50 percent of the time. They will each win half of the time, and neither player could be any better off by selecting a different strategy.

Conclusion

This blog covers the strategic decision-making process in the game of baseball by looking at examples of simultaneous and sequential game play. We have seen examples of the MLB draft and examples of pitch selection and batter response. While there is so much that can be talked about when looking at the game theory behind baseball, it is impossible to cover it all. One area of further research that I think could be interesting would be looking at how a combination of pitches could be more effective than any other combination. As we've seen, mixed strategies are usually the best way to beat your opponent. Further, the use of sabermetrics (the application of statistical analysis to baseball records) and big data are heavily used nowadays to analyze every aspect of the game. One concept that I found particularly interesting was the Nash Score which is used to predict which pitcher should throw which pitches in order to beat his opponent. However, that could be a topic all by itself so I am going to keep that for further research.

Can anyone think of any other strategies that might be used in baseball?

Finally, we will also see that game theory can be applied to many other sports.



Sources

"How Game Theory Is Applied to Pitch Optimization." Baseball Statistics and Analysis. Accessed April 19, 2017. http://www.fangraphs.com/community/how-game-theory-is-applied-to-pitch-optimization/.

Swartz, Matt, About Matt SwartzMatt Writes for FanGraphs and The Hardball Times, and Models Arbitration Salaries for MLB Trade Rumors. Follow Him on Twitter @Matt_Swa., and Alan Nathan Said... "Game theory and baseball, part 1: concepts." The Hardball Times. December 17, 2012. Accessed April 19, 2017. http://www.hardballtimes.com/game-theory-and-baseball-part-1-concepts/.

Swartz, Matt, About Matt SwartzMatt Writes for FanGraphs and The Hardball Times, and Models Arbitration Salaries for MLB Trade Rumors. Follow Him on Twitter @Matt_Swa., Philosofool Said..., Matt Swartz Said..., and James MacKay Said... "Game theory and baseball, part 2: introduction to pitch selection." The Hardball Times. December 18, 2012. Accessed April 19, 2017. http://www.hardballtimes.com/game-theory-and-baseball-part-2-introduction-to-pitch-selection/.



7 comments:

  1. In your example for the pitch selection/optimization and batter response would there only be one Nash equilibrium? I think it would be -3, 3 because for the batter, the best payoff for him if the pitcher throws a strike is to take (3 > 2) and the best payoff for the pitcher if he knows the batter will take will be to throw a strike (-3 > -4). I left out the other cases but I think the only Nash equilibrium is -3,3.

    ReplyDelete
  2. I actually had a question about the extensive game above. I think there might also be a Nash equilibrium for both teams choosing colleges. For example, if the Red Sox pick college, then the Yankees get a payout of 5 if they pick college, vs. 1 for picking high school. And if Red Sox pick high school, then the Yankees get 7 for picking college, vs. 3 for also picking high school. So isn't there also an equilibrium at (5,5)?

    ReplyDelete
    Replies
    1. In my extensive form example, the Red Sox payoff is the number on the left and the Yankees payoff is the number of the right. Sorry if I didn't make this clear! Hopefully that clears things up.

      Delete
  3. The Nash equilibrium from the above question should be at (-3,3). The Batter should take and the Pitcher should throw a strike. This way, no player benefits more from changing strategies.

    ReplyDelete
  4. To answer your first question about dominant strategy....

    As easy as baseball is to conceptualize, it is also one of the most complicated sports to play WELL. In your example, I do not believe there is a dominant strategy.

    3 options:

    1. Either the batter strikes out
    2. Batter gets a hit (no foul)
    3. Pitcher throws 4 balls.

    However! There are some cases where the pitcher purposely throws 4 balls, and WALKS the batter. This could be for a number of different reasons, such as...

    "This guy is a really good batter and there is currently a runner on third, the chances of him getting a hit off my pitch is very high, so i will give him first base and instead try to strike out the next/worser batter."

    but it works out for both teams because one guy gets to take a base, and the other avoids a potentially detrimental hit.


    I'll explain again in class...but this could be really interesting.

    ReplyDelete

Note: Only a member of this blog may post a comment.