# My Baseball Century Experiment

Sometimes, I get an idea in my head that just won’t go away. It catches fire and for days at a time, it is all I can think about. This doesn’t happen often, but it happened last week while I was reading George F. Will’s book Men At Work, an excellent book about baseball. While reading it, I got to thinking about all of the data available for more than a century of baseball play. I thought about the whole science of sabermetrics that rose up around these statistics, and I began to think, would it be fun to play with this data? Of course, it is not easy data to get one’s hands on, but that is when I had my little flash of brilliance:

What if I put together a simulation of baseball beginning with a set of entirely made-up players, and simulated 100 seasons worth of play? I would end up with a data set almost as impressive as the real thing. And that data set might be very interesting to look at. I know that there are baseball simulations out there, but I have something a little different in mind. My simulation is just that–a simulation. There is no interface to it. You run it with a certain set of inputs and setting and when it finishes, it produces a database worth of results. This is not MLB 2013 for the XBox. This is something that sits on my machine and chunks away for minutes (or hours) running through game after game, season after season.

Why do this?

1. It sounds fun and that’s always a good reason in my book.
2. I am looking to learn more about the intricacy of baseball and this is a good way of exploring those intricacies experimentally.
3. I am looking to conduct some experiments with the simulations that might be interesting.
4. I am looking to learn a new platform–Objective C and Mathematica–both of which are useful in my day job.
5. I love baseball and this is a way to delve deep into it.

Let me explain about the experiments. I can think of several I’d like to conduct, but first and foremost in my mind is answering this question:

Who would be the record holder, and what would the big records be in a made-up league with made-up players, after 100 seasons of play based on 2 assumptions: (1) that the players, managers and umpires execute perfectly every time; (2) and that they use the accumulated data to make the best possible decision in any given situation?

I chose this as a first experiment because I wanted to ignore the human factor initially. Suppose everyone executed perfectly and suppose that in each game situation, you knew the percentages for each play you could make, always choose the move with the best chance of success: how would things look after 100 years? Would there be a trend toward lower scoring games? Would there be any perfect games? Who would be the home run king and what would that record look like? The fact that this simulation does NOT use past baseball data as a starting point makes it more interesting to me to see how the league evolves over time.

I played baseball as a kid and I love watching it today. I love the intricacy and nuances and by drilling deeper into it, I hope to learn more. But whenever I am learning a new programming language or programming style (and I’ve learned many over the years) I always learn it faster and better with a big project to which I can apply my knowledge. Then, too, I now have two decades of software development experience–much of which working with datasets–to apply to the task.

And the perfect play experiment isn’t the only one I have in mind. I wonder how close to reality such a model can get. My plans are to start very simply with just the basics, using a lot of calculation in place of transactional play. Given the input of 2 teams, I want to be able to simulate one game. Then a season of games. Then 100 seasons. Once that is done, I’ll go back and layer on complexity. Instead of a single calculation to determine whether a batter gets a hit, walk or makes an out off a given pitcher, I want to simulate every pitch. At each decision point, I want to use the gathering data to provide ranked moves for a given situation. I also want to allow the system to make random moves to see if it develops unique plays.

The output should be fascinating. Such a vast amount of data, organized correctly should be able to produce a wealth of fun stuff to dig into. I envision being able to generate a box score from the data for any game, but also a barebones play-by-play that you might get from listening to a game on the radio, without the color commentary.

I am still trying to decide the best platform for this all. It would be nice to learn Objective C, but Mathematica is more practical for my day job and I am intrigued by it. It also seems like the perfect tool for the kind of math used in these models, to say nothing of the incredible interactive output it can produce. I am taking a class in Mathematica this week, so we’ll see how things go. I’m not making any decisions about platform until that class is over.

I don’t expect this to be something I spent exhaustive amounts of time on. I have lots of other things to do. But I think it will be fun to work on in those moments when I don’t feel like writing, and need to step away from whatever it is I am reading, and the kids are sleeping. And, yes, it has been done before, I’m sure, but each endeavor brings its own unique nuances. And besides, I haven’t done it before and that alone makes it interesting. The research alone is fascinating.

So, you can probably expect updates from time-to-time. I’ll try not to overload you with it, but whenever I get some substantial piece working, I’ll post about it and perhaps include any interesting output produced. And you never know: there may even be a story idea buried in the resulting data.