View Single Post
Old 05-05-2019, 10:46 PM   #790
stealofhome
Hall Of Famer
 
stealofhome's Avatar
 
Join Date: Apr 2014
Posts: 2,282
Blog Entries: 1
Run Expectancy Matrix

Okay I'm pretty pleased with this one - the first step to the hitter/pitcher interaction is to create a run expectancy table that is specific to my league. This requires play by play data (Very High Stats detail). I found an awesome article that walked me through the second half of this, but I still had to get the data in the right shape from OOTP.

I first had to order the data by event in the game instead of player_id and then calculate the number of runs after the event.

This table calculates the average run expectancy for each baserunner/out state in 1946 in my league. I'd say for the most part it lines up well with current MLB standards.

Name:  1946RunExpectancy.PNG
Views: 517
Size:  7.4 KB

The other two charts are the distributions of expected runs at each game state and the mean posterior estimates of observed samples in 1946.

I can give the code to anyone if they're interested. I may just start a GitHub page for all of this.
Attached Images
Image Image 

Last edited by stealofhome; 05-05-2019 at 11:08 PM.
stealofhome is offline   Reply With Quote