Markov Chains and their Applications to the Baseball

Noah Lindsay

What is a Markov Chain?

  • Stochastic process where at each time the process is considered to be in one of n phases

  • Major aspect: probability of nth stage is solely dependent on (n-1)th stage

Transition Matrix

  • Probabilities of going from state i to state k represented by matrix

Chapman-Kolmogorov Equations

  • Markov chains are considered to be in the jth state, transitioning from the ith state at time n

  • Nth phase is computed by putting the initial transition matrix to the nth power

Recurrent vs Transient State

  • If a state can be re-entered again once it has left, it is called recurrent

  • If a state cannot be re-entered after having being left, it is considered transient

  • A state is absorbing if it can not travel to another state from itself

Long Term Proportions

  • If a chain is recurrent completely, there are long-run averages (pi) representing the probability over the entire duration of the chain of transferring to state i

Absorbing Markov Chains

  • Markov chain in which it has 1+ absorbing state
  • From every state it can enter the absorbing state [does not have to be directly]
  • With x transient states and y absorbing states there are a total of x+y states
  • Any state that is not absorbing for these Markov chains is considered “transient”

Canonical Form of an Absorbing Markov Chains

  • Transition Matrix for Absorbing Markov chain:
     [,1] [,2]
[1,] "Q"  "R" 
[2,] "0"  "Ia"
  • With t transient states and a absorbing states:

  • Q is a t * t matrix

  • 0 is a a * t matrix

  • R is a t * a matrix

  • Ia is the identity matrix a * a

Transition Matrix of Absorbing Markov at time N

     [,1]  [,2]
[1,] "Q^n" "*" 
[2,] "0"   "Ia"
  • (asterisk) is a t * a matrix with a mix of components from Q and R

Theorem of Absorption

  • Probability that the chain will eventually be absorbed is 1, since the limit of Q^n=0

Fundamental Matrix of Absorbing Matrix

  • Based on Matrix Q, I-Q has an inverse matrix with N=I + Q + Q^2 + …
  • Eventually through some calculation of expectations and manipulations of this equation, we get the fundamental matrix N=(I-Q)^-1
  • In this equation Q only consists of transition probabiltiies between transient states of P
  • Fundamental matrix tells us the expected number of times that the Markov chain will be transient state until absorption

Expected Number of Steps Until Absorption

Absorption Probabilities

  • bij is the probability that the absorbing chain will be absorbed in state sj, given that it starts in a random transient state si
  • B is going to be t*a matrix where B=NR

Ergodic Markov Chain

  • It is possible to reach every state from any one state, but not necessarily in one stop
  • Regular Markov chains are markov chains where its transition matrix has all of its entries greater than 0 for at least one power

Fixed Vectors

  • w is a fixed row vector if wP=w is satisfied for P, where P is the transition matrix for a Markov chain
  • c is a fixed column vector if xP=x is satisfied for P, where P is the transition matrix for a Markov chain

Fixed Vectors

Fixed Vectors

  • Based on the Fundamental Limit Theorem, we know that the limit of the matrix to the nth power is W, which is the fixed vector
  • If c is a fixed column vector and w is a fixed row vector, with v being a multiple of w and x being a multiple of c
  • Based on the limit, the fixed vector x is also a fixed column vector for P

Baseball At Bats as a Markov Chain

  • Thesis of the study: “Modeling and calculating expected number of runs that the team [Wooster College in this scenario] would score in a season. This method using the entire team’s statistics is useful and will yield fairly accurate results compared to actual number of runs scored by the team”

States of the Model

  • 24 possible states per at bat: 8 arrangements of any player on base, 3 arrangement of outs (0,1,2) [being that a player cannot bat with 3 outs]

  • 25th state: 3 outs, zero men left on base

  • 26,27,28th state(s): 3 outs, 1:2:3 men left on base

Classification of the States

  • Outs (0,1,2) and all events with those outcomes: transient
  • 3 out situations: absorbing

Transition Probabilities of the Model

  • Probabilities are based on events from outcomes of at bats (single, walk, HBP, double, triple, home-runs, single-out plays, double plays)
     Events             Occurrences Probabilities
[1,] "Single"           "355"       "0.197"      
[2,] "Walk/HBP"         "228"       "0.127"      
[3,] "Single/Walk/HBP"  "583"       "0.324"      
[4,] "Double"           "117"       "0.065"      
[5,] "Triple"           "14"        "0.008"      
[6,] "Home-Run"         "23"        "0.013"      
[7,] "Single Out Plays" "1062"      "0.59"       
[8,] "Double Play"      "26"        "0.014"      

Assumptions of the Model

  • Each batter transitions to the next batter (so not including stealing bases or passed balls)
  • Not considering triple plays, sacrifice at bats, errors, advances from 1st to 3rd base, plus any other rare at bats
  • Considers all players equal with their transition probabilities

Finding Expected Runs Scored

  • Batters (B) are either left on base (L), score (R), or make an out (3)
  • B=3+R+L <=> R=B-3-L
  • E(R)= E(B)-E(L)-3

Finding Expected Runs Scored

  • Based on fundamental Matrix N, the one for this matrix is a 24*24 matrix
  • Expected number of steps from transient state si until absorption is sum of ith row of N matrix
  • In the terms of the matrix, the sum of the ith row is the expected number of batters that will come to bat before the inning is ended [absorbed]

Finding Expected Runs Scored

  • E(B) is going to be the sum of first row of N matrix [since we are only looking at batters to come from the start of the inning]
  • E(B)=5.051 based on the calculations

Finding Expected Runs Scored

  • E(L) is derived from matrix B=NR
  • Based on our module, the ith row of the B matrix is the probabilities of absorption occurring when there are 0,1,2,3 matrix starting from a specific state si
  • E(L) is going to be equal to 0* P(0 left) + 1 * P(1 left) + 2 * P(2 left) + 3 * P(3 left)
  • Based on our model E(L)= 1.267

Finding Expected Runs Scored

  • E(R)= E(B)- E(L) - 3
  • 5.051 - 1.267 - 3= .784=E(R)
  • This model projects was .784 which multiplied by the amount of inning (375) predicts that the team would score 294 runs.
  • Which is 81 less than the actual runs scored, this flaw can be based on the assumptions of the model that restricted the matrices.

Player Value

  • Testing if this matrix helps predict individual statistics

  • Using the expected amount of runs from the total team from the model was 375, this matrix clearly over-predicts individual statistics.

Sacrifice Bunt Strategy

  • Sacrifice bunt: a direct at bats where the batter attempts to bunt themselves out in order to move a base runner over to another base

  • Despite the fact that this may be helpful, it may also be detrimental to the inning as well by taking away one of your outs

     Number.of.Outs.Base.Occuppied zero.out one.out two.out
[1,] "xxx"                         "0.784"  "0.413" "0.145"
[2,] "1xx"                         "1.265"  "0.736" "0.297"
[3,] "x2x"                         "1.48"   "0.959" "0.471"
[4,] "xx3"                         "1.481"  "0.959" "0.471"
[5,] "12x"                         "1.975"  "1.294" "0.632"
[6,] "1x3"                         "1.984"  "1.294" "0.632"
[7,] "x23"                         "2.196"  "1.521" "0.806"
[8,] "123"                         "2.771"  "1.94"  "1.042"
  • Based on this table, it seems like it should never make sense to sacrifice bunt because it lowers run expectancy [especially early in the game]

Sacrifice Bunt Strategy

  • Despite the fact it may not seem statistically plausible to sacrifice bunt, it may make sense later in the game if a team needs to put a runner in scoring position
     League    Bunt.Attempt.Prob No.Bunt.Attempt.Prob
[1,] "Wooster" "0.476"           "0.37"              
[2,] "MLB"     "0.37"            "0.348"             
  • Teams have a higher chance of scoring 1 run with a bunt attempt, although the expected number of runs decreases

Stolen Base Strategy

  • Stolen base: when a runner on base tries to advance to the next base while a pitcher throws a pitch and the catcher attempts to throw him out
  • Same strategy from the sacrifice bunt strategy, find the probability of scoring at least one run given a successful and unsuccessful stolen base and then multiplying by the probabilities of a successful and unsuccessful steal
  • Does not take into consideration the speed of the runner and the arm strength of the catcher

Stolen Base Strategy

     Situation               Wooster MLB    
[1,] "Man on First, No Outs" "0.558" "0.46" 
[2,] "Man on First, 1 Out"   "0.416" "0.335"
[3,] "Man on First, 2 Outs"  "0.234" "0.182"
     Situation               Wooster MLB    
[1,] "Man on First, No Outs" "0.486" "0.348"
[2,] "Man on First, 1 Out"   "0.326" "0.224"
[3,] "Man on First, 2 Outs"  "0.151" "0.102"

Stolen Base Strategy

  • Best to steal when the expected number of runs with a steal is greater than the expected number of runs without a steal

Stolen Base Strategy

  • Also is important to know how good of a base stealer a runner is in order to maximize the probability of scoring at least one run
  • Simply, whether the sum of the probability of scoring at least one run given a successful times the weight of the steal + probability of scoring at least one run with a failed steal attempt * weight of a failed steal attempt has to be greater than probability of scoring at least one run without an attempt at a stolen base

Stolen Base Strategy

     Situation                Expected.Runs Prob.One.Run
[1,] "Man on First, No Outs"  "0.7985"      "0.5704"    
[2,] "Man on First, One Out"  "0.7265"      "0.5211"    
[3,] "Man on First, Two Outs" "0.6301"      "0.4649"    

Sources

  • Introduction to Probability Model, Sheldon Ross, 12th edition
  • Markov Chain Theory with Applications to Baseball, Cal D. Thomay, 2014, The College of Wooster