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.

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.
Last edited by stealofhome; 05-05-2019 at 11:08 PM.
|