Archive for September, 2010

A Perl version of Tango’s Markov Model

Tuesday, September 28th, 2010

I have created a Perl version of Tangotiger’s excellent Markov run modeler. Tango’s original HTML/Javascript version can be found here, with further discussion here.

This is just a basic adaptation – I have not added any new features, though I hope to in the future (at the very least I would like to make a Perl version of Bill Skelton’s modification of Tango’s original).

To use my version, first download the zip file (markov.zip), extract the Perl script (markov.pl) and the example input file (input.csv), and place them in the same directory. Change the values in the input.csv file to alter the batting line and the chances of taking an extra base (but make sure not to alter the formatting of the file). Then just run the Perl script, which will produce a file named output.txt that is tab-delimited. If you open that in Excel you should be able to view all the results in table form. For simplicity’s sake I didn’t include any command line arguments to specify the names of the input or output files, so if you want to run the script multiple times and save your results you’ll either have to rename/copy the output file or alter the Perl script (note that the output file does include the input values inside it).

For those unfamiliar with Markov models of baseball, there are a lot of great resources on the web. Outside of Tango’s site, I recommend work by Mark Pankin, Joel Sokol (includes Matlab code), Bruce Bukiet (scroll down for “A Markov Chain Approach to Baseball”), Carl Morris, John Beamer (includes Excel spreadsheet with purchase), Tom Ruane, and Berselius (includes Matlab code, though link appears to be down).

Adjusted Plus-Minus in Hockey

Sunday, September 26th, 2010

Though plus-minus originated in hockey and has been tracked by the NHL since 1968, development of the stat really picked up when it was adopted for use in basketball in the last decade. In 2000 Wayne Winston and Jeff Sagarin developed their WINVAL system for basketball, which starts with basic plus-minus but then uses linear regression to control for the quality of the player’s teammates and opponents. The methodology behind this has been public since Dan Rosenbaum wrote about his NBA version of adjusted plus-minus in 2004, but surprisingly, until earlier this year there had been no public examples of using regression to adjust plus-minus for hockey players (Vic Ferrari came the closest here). So I was excited to see Brian Macdonald’s paper “A Regression-based Adjusted Plus-Minus Statistic for NHL Players” become available in June. It hasn’t gotten much pub around the net (no mention on any of the hockey blogs as far as I can tell), but hopefully more people will become aware of it.

The Beginnings of Base Runs

Sunday, September 26th, 2010

I recently came across the from December of 1999 where David Smyth introduced his run estimator Base Runs. I also found archived versions of the summary he posted a few months later on James Fraser’s site, and a primer he posted on Fanhome several years later (follow-up discussion here).

For more on Base Runs I highly recommend articles by Patriot and Tangotiger.