Wolfram Blog
Marty McKee

Following Baseball with Mathematica

April 1, 2010 — Marty McKee, Copywriter

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.

Baseball Batting Metrics

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.

Leave a Comment

6 Comments


Jack Kohoutek

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.

Posted by Jack Kohoutek    April 1, 2010 at 2:34 pm
David Brown

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?

Posted by David Brown    April 1, 2010 at 2:57 pm
7798.cn

great article!

good job!

Posted by 7798.cn    April 5, 2010 at 10:32 am
Ken Levasseur

Good ideas for combining mathematics and baseball. Some are currently implemented using Retrosheet: http://homepage.mac.com/klevasseur/erm/

Posted by Ken Levasseur    April 11, 2010 at 7:56 am
satellite tv for pc

I’ve got to say, this is a great post and a great blog alltogether. wty1d8

Posted by satellite tv for pc    May 28, 2010 at 10:08 pm
scientific research

Thank you for this good topic, I was really needed it, so thank for you again And I know more information about this topic , you can found it in this file

Posted by scientific research    May 30, 2010 at 5:01 am


Leave a comment

Loading...

Or continue as a guest (your comment will be held for moderation):