FanPost

lineup simulator in C

This is probably only of interest to a very few select people here, but I've finished the first version of my lineup simulator that I mentioned in this diary. The code is here. See this post for some suggestions and requirements for compiling.

Right now it seems to give consistently low numbers, on the order of 1 to 1.2 runs lower per game than the run estimator developed by Ken Arneson that was adapted over at Baseball Musings. I'm not sure why it's so low, so if anyone wants to look over my code and see if I'm not doing something really stupid, that would be nice. It's reasonably well commented so it shouldn't be too hard to understand, but feel free to ask questions. (I'm testing it on the core lineup of the 2005 Astros. I'm using aggregated stats for the pitching staff as one player.)

As far as performance goes, on a G4-based Mac Mini or PowerBook, it takes a little under 2.5 days to run the simulator for all 9! lineups. For any one particular lineup, the mean runs per game is calculated every 1000 games and inserted into a 100 element array (both numbers are arbitrary). When the standard deviation of the numbers in the 100 element array falls lower than 0.002 (i.e, the mean has stabilized), it moves on to the next lineup. This generally happens somewhere between 150,000 and 250,000 games, translating to something like 72 billion games total. I've tweaked the code to run as fast as possible; the only way to get a major increase in speed at this point would be to parallelize the code.

Update [2006-3-23 14:1:50 by false cognate]: Two reasons I've thought of that might be why it's so much lower than the actual run total for the Astros last year - the Astros were near the top of the league in steals, which aren't accounted for in my simulator, and they also had some significant platooning - Lamb and Palmeiro both had significant at bats (322 and 204 vs. Burke's 318 who is in my lineup) and both have better pop than Burke. However, this doesn't account for the differential with the run estimator at Baseball Musings.

Trending Discussions

X
Log In Sign Up

forgot?
Log In Sign Up

Please choose a new SB Nation username and password

As part of the new SB Nation launch, prior users will need to choose a permanent username, along with a new password.

Your username will be used to login to SB Nation going forward.

I already have a Vox Media account!

Verify Vox Media account

Please login to your Vox Media account. This account will be linked to your previously existing Eater account.

Please choose a new SB Nation username and password

As part of the new SB Nation launch, prior MT authors will need to choose a new username and password.

Your username will be used to login to SB Nation going forward.

Forgot password?

We'll email you a reset link.

If you signed up using a 3rd party account like Facebook or Twitter, please login with it instead.

Forgot password?

Try another email?

Almost done,

By becoming a registered user, you are also agreeing to our Terms and confirming that you have read our Privacy Policy.

Join Beyond the Box Score

You must be a member of Beyond the Box Score to participate.

We have our own Community Guidelines at Beyond the Box Score. You should read them.

Join Beyond the Box Score

You must be a member of Beyond the Box Score to participate.

We have our own Community Guidelines at Beyond the Box Score. You should read them.

Spinner.vc97ec6e

Authenticating

Great!

Choose an available username to complete sign up.

In order to provide our users with a better overall experience, we ask for more information from Facebook when using it to login so that we can learn more about our audience and provide you with the best possible experience. We do not store specific user data and the sharing of it is not required to login with Facebook.

tracking_pixel_9351_tracker