This post is going to be a nitty gritty explanation of the intentional walk tool I wrote. If you are coming from HardBallTimes and want a detailed explanation you are in the right place. If you got here elsewhere and just want a quick rundown check my HardBallTimes article
here.
So the tool is actually two different programs put together. The first tool is a
Monte Carlo (MC) simulation of a baseball at bat. What it does it is runs 10,000,000 trials for each at bat for every possible baseball situation. There are eight possible runner situations (e.g. runners on second and third) and three out situations (no outs, one out, and two outs) and it does this for an OPS of 400, 500, 600, 700, 800, 900 and 1,000. The OPS here stands for the expected OPS the batter would put up against this pitcher and defense. This gives us 168 possible combinations. The program then calculates the probability of the at bat ending in every other situation (e.g. the chance that a runner on second with one out before the at bat ends with a runner on third with two outs, etc). For runner advancement, error rate, and other goodies it uses 2007 data and assumes all runners are league average. It then draws a best fit line through each situation given the OPS. This slope and y-intercept are then recorded to a lookup table.
To test that the MC is performing correctly we can run one batter for each situation and compare the resulting run expectancy to the 2007 run expectancy. I would expect that the MC should be close to the real run expectancy and it does appear close. It is hard to say how close it should be and how much variation in the run expectancy matrix is variation. Anyway, here are the numbers:

This lookup table then contains all the information you need to find the chance of a runner on second advances to third with one out if the batter has an OPS of say 761 (league average this year). These lookup tables take hours to create but once they are done accessing them is incredible quick. Now we are ready for the second part which is the program that puts all of the information together.
This program, which takes as input a web form, starts with a baseball situation. It then calculates every possible new situation after one at bat and the probability of that new situation. Do this three more times and you have a resulting matrix that holds what the game looks like four batters in the future, weighted by the probability of that situation. If the inning ended the opposing offense is allowed to bat and the game tree expands again weighing all the chances that team scored zero runs, or one run, etc... Once this is done each situation is multiplied by the WPA of that situation. Sum them all up and you get the new, corrected WPA of the original situation. If the game ended along the way the winning team is assigned a 100% WPA for that situation. The WPA values used are from Dave Studeman and Jon Daly's WPA calculator. My understanding is they used 2005 data to create their charts. If you put in a league average batters it should return their WPA but because of error in the MC and the difference between 2005 and 2007 data the MC tends to be off by less than 0.5%. There are a few instances when this rises to nearly a 1% difference though.
Obviously, this MC is not perfect. Hopefully it is a step forward though. Also note that I am planning on creating a better MC by using a more accurate input than OPS. I started with OPS because it was pretty easy to program and it would be easier to use for the general public but I a more accurate one will be coming soon.
Whew. Well hopefully that makes at least a little sense. If it doesn't please feel free to comment below or email me under my profile to the right. You can access the tool either at article at
THT or by following this
link.