Baseball win expectancy and expected runs per inning calculators
This is the source for the win expectancy calculator and expected runs in an inning calculator.
The main scripts are main.rs
(in Rust) and parseretrosheet.py
(in Python), both of which parse play-by-play files in the Retrosheet format. The scripts are designed to work identically; presumably the Rust version will run faster. To run the script you should download the files from Retrosheet and put them in a data
directory.
Other interesting files:
getcumulativestats.py
- the CGI script that the web page callsprocessstats.py
- puts the Retrosheet data in theprobs.txt
file. See Phil Birnbaum's description of the data file.
See the HOWTO
file for how to update everything after adding more data.
This article talks about the process of porting the script from Python to Rust.
The information used here was obtained free of charge from and is copyrighted by Retrosheet. Interested parties may contact Retrosheet at 20 Sunset Rd., Newark, DE 19711.