Following Baseball with Mathematica
No sport places more importance on its statistics than does baseball. The late sportswriter Leonard Koppett wrote in his standout 1967 book The Thinking Fan’s Guide to Baseball that “statistics are the lifeblood” of the game.
In fact, statistics are so important to baseball that they have inspired their own field: sabermetrics. Derived from SABR, the abbreviation for the Society for American Baseball Research, sabermetrics were popularized by Bill James with the publication of his first Bill James Baseball Abstract in 1977.
Led by James’s charge, sabermetricians began to advance the argument that traditional baseball stats such as batting average (BA), home runs (HR), and runs batted in (RBI) did not accurately describe a player’s on-field performance. Instead, they created new stats like value over replacement player (VORP), win shares, and OPS, which is on-base percentage (OBP) plus slugging percentage (SLG).
Mathematica is, of course, the perfect tool for sabermetricians. By inputting game statistics, you can calculate formulas and graph players’ or teams’ progress over an entire season. Watching baseball is fun, but imagine how much better it will be when you use Mathematica to get more involved!
Using Carol Goodell and S.M. Blinder’s Baseball Batting Metrics Demonstration from the Wolfram Demonstrations Project, you can calculate your favorite players’ statistics—not just day by day, but inning by inning! Move the sliders in real time according to a player’s on-field accomplishments, and the Demonstration instantly calculates the player’s batting average (hits divided by at-bats), on-base percentage (hits + bases on balls + hit by pitch, divided by plate appearances), slugging percentage (total bases divided by at-bats), and OPS.
For instance, I’m a Cincinnati Reds fan, and my favorite current Red is first baseman Joey Votto, who had a terrific season in 2009.
When I adjust the sliders to plug in Votto’s at-bats, hits, doubles, triples, home runs, bases on balls, hit-by-pitches, and sacrifice flies from last season, the Demonstration instantly calculates his 2009 BA, OBP, SLG, and OPS. (There’s also a slider for RBIs, which has nothing to do with calculating Votto’s averages but is nice to have available.)
What’s really fun about the Baseball Batting Metrics Demonstration is that you can calculate the averages of any players at any time—even in real time during a game. Your favorite player comes to bat, add one at-bat. He gets a hit or a base on balls, add that too. You’ll know his BA, OBP, SLG, and OPS even before he makes it to first base!
With the Major League Baseball season getting underway, you can chart your favorite players’ progress from now to the World Series. You can even keep track of entire teams’ statistics; all the pertinent information is provided in each day’s box scores.
Better yet, you can use Mathematica to create your own baseball Demonstration. You’ll find out that Mathematica goes just as well with baseball as do hot dogs and peanuts.
I’ve been thinking Mathematica would be great for sabremetrics for a while now. Except I’m mostly thinking about Wolfram|Alpha’s use in sabremetrics research.
Imagine if baseball-reference or fangraph’s databases were searchable via Alpha…
sabremetrician’s heaven.
It would be fun if baseball statistics were provided as a curated data source.
Alternatively, is there any way that a third party could provide something like the curated data sources provided with Mathematica?
great article!
good job!
Good ideas for combining mathematics and baseball. Some are currently implemented using Retrosheet: http://kenlevasseur.org/index.php/exploring-retrosheet-with-mathematica