A Perl version of Tango’s Markov Model
September 28, 2010Posted by in Markov models,Perl
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).
May 25th, 2013 at 10:39 pm
Car shopping is stressful. Now that there are hundreds
of makes and models to choose from, not to mention promotions and
payment options, it’s easy to become frustrated and stressed out. The information here will help make buying a car as easy and stress-free as possible.
October 27th, 2013 at 4:29 pm
Hi there, I log on to your new stuff on a regular basis.
Your humoristic style is witty, keep doing
what you’re doing!