at least 101 years
EPIC FAIL
EPIC FAIL
Back in 2006, I got it into my head to try my hand at writing a simulator for the express purpose of optimizing lineups. It would go through all 9! permutations of the lineup and actually play simulated games, and then output the average runs scored for each lineup. You can see the original post here and the follow-up using stats taken from the 2005 Astros here. I never did get around to updating the algorithm (although it's still on my to-do list), but since I finally got myself a new computer I decided to try something that my friend suggested, which was to run a set of projections through the program in order to predict what the optimum lineup would be for the forthcoming year.
The program finally finished the run (marginally faster - about 50 hours run time) using the 2008 ZiPS projections for the Cubs. I used the projections for the following eight players: Lee, Ramirez, Fukudome, Soto, Pie, DeRosa, Theriot, and Soriano; and then summed up the actual 2007 lines for the five pitchers with the most ABs (Z, Lilly, Hill, Marshall, Marquis) to make a sort of "average" pitcher. I'd like to reiterate that this algorithm doesn't take into account errors, steals, player speed, GIDP, handedness, sacrifice flies or sac bunts, and baserunning is strictly station-to-station. The algorithm also does not take into account any other strategy - i.e., it doesn't pitch around guys to get to the pitcher. In addition, ZiPS doesn't project hit-by-pitches.
That said, here are the results for the top 10 and bottom 10 lineups, as well as the results for the starting lineup from the March 18th spring training game.
Continue reading "lineup optimization using Cubs 2008 ZiPS projections" »
As anyone who knows me knows, I'm a Cubs fan, but I also follow the Astros simply by dint of living in Houston. So far, I haven't been too terribly impressed by Ed Wade (the new Astros GM's) and his deals.
Let's see:
What I want to know is, where does Ed Wade get his drugs, and how do I get some?
Well, that was brutal. Cubs get swept, grounding into 4 double plays and leaving 10 men on base in the final game alone. Depressing.
It felt a little weird rooting for the Cardinals, but if the Cubs can't do it themselves...
Go Padres! Beat the Brewers!
I finally got around to reading "Moneyball" by Michael Lewis. If you're a sports fan in general, you should read this book, but if you're a baseball fan, this is a must read. Even non-sports fans who have an analytical mind should consider reading this book; the principles Billy Beane brought to Major League Baseball are applicable in many fields, and Lewis has a breezy writing style that makes for an easy, engaging read. He shows us an insider's look into the workings of a major league ballclub.
"The Cheater's Guide To Baseball" by Derek Zumsteg (one of the proprietors of the U.S.S. Mariner website, and a contributor to Baseball Prospectus) is an in-depth look at the vast history of cheating in the game of baseball. Brawling, gambling, steroids, corking bats, the spitball, and other methods of cheating, both tacitly approved and patently illegal are examined. Zumsteg writes with an irreverent and humorous voice, and does a great job of illustrating where the line is drawn for most hardcore baseball fans with respect to cheating. All in all, a fun read, though probably less so for someone completely uninterested in baseball.
And one last thing - the Cubs are going to give me a coronary by the end of September:
Well, the baseball season is nearly halfway finished already, and the Cubs are 3 games under .500 and 7.5 back from the Brewers. Frankly, the entire NL Central is terrible, with the possible exception of Milwaukee. I didn't expect too much out of the Cubs, but I did expect them to be better than this. The bright spot has been that I have managed to get out to a few games here and there, and already this year have been to four different ballparks (Turner Field is pictured above) with a fifth (and maybe sixth) to come later in the year.
Anyway, check out my baseball photos, and if you're coming to Houston and want to catch a game, drop me a line.
Well, the 2007 baseball season is off to an unusual start, what with Cleveland being snowed under in April, resulting in the next series being played in Milwaukee. Neither the Cubs nor the Astros are doing particularly well, although the Astros are currently teeing off on Cubs pitchers. Anyway, in case you missed it, the New York Times ran an article last week about a college pitcher at Creighton who can pitch with both arms. It's an interesting read; and I'm somewhat surprised it hasn't happened more frequently. They're saying he make may the late rounds of the draft this year. I would love to be in the ballpark when he throws; that would be interesting to score...
Well, we're about two weeks away from the start of the major league baseball season. Now that I have a real income, I can actually afford to go to games. And now that it seems all my friends are busy getting married, I may be able to knock off a few more ballparks from the list. If you're coming into Houston and want to catch a ball game, let me know, I'm usually happy to go.
Currently, Baseball Tour 2007 looks like this:
Another one of my photos has been included into an electronic travel guide produced by Schmap, but this time it's for Houston. (The last three were from Chicago.) They've chosen a picture I took from the third base side of Minute Maid Park during the 9th inning of a Dodgers-Astros game earlier this year. Just prior to this picture, Kenny Lofton hit a triple off of Brad Lidge, who went on to blow the save.
And with this announcement, the Chicago Cubs 2007 season is probably flushed down the toilet. Lou Piniella is basically a whiter, older, louder, in-your-face version of Dusty Baker. They're even saying he might bring back much of the coaching staff, including Rothschild, which means our young pitchers continue to be doomed. The only good thing about this announcement that I can find is that A-Rod likes Lou, so maybe we'll be able to get him in a trade. That would fill the giant sucking sound you hear coming from the shortstop position.
Crap.
Today is the non-waiver trade deadline in baseball. The Cubs made two trades. Separately, they're not horrible, but taken together they suck. Todd Walker (good hitting, sub-par fielding 2B) went to the Padres for a 19-year old rookie league pitcher Jose Ceda. Not horrible; Walker's contract is up this year and it was unlikely he would be resigned due to the ridiculous abundance of cheap mediocre middle infielders with the Cubs both at the MLB and AAA levels (Perez, Cedeno, Theriot, Fontenot). Plus it would encourage Dusty to actually play the young players for evaluation purposes, as 2006 is a lost season.
The worse deal was Greg Maddux to the Dodgers for César Izturis (SS, Gold Glove winner, sub-par hitter), contingent on approval from the commissioner's office due to the amount of cash that is also trading hands. We already have defensive middle infielders - a lot of them (see above) and now it suggests playing Izturis at starting SS and Perez or Cedeno at 2B, negating the major plus of the Walker trade; namely, the chance at evaluating Theriot or Fontenot at the MLB level. Plus losing Maddux just sucks. I know that he's not the pitcher he used to be, but he's still a serviceable 4th or 5th starter, and the mentorship he provided for the rookies (Sean Marshall and Carlos Marmol both have been quoted many times this season as picking Maddux's brain while sitting on the bench together) is invaluable. He started his career in a Cubs uniform, and I would have liked to see him finish it in one.
I was in Boston over the weekend for business and got a chance to go catch a Red Sox game vs. the Nationals. Lots of actual baseball fans who know their stuff, as opposed to the casual viewer you get here in Houston. And some of the best ballpark food I've seen (at least, outside the ballpark). I'm steadily knocking ballparks off the list; hopefully I'll get to a couple more before the summer is over.
So far:
I have a long way to go; only 5 of 30 down...
The Rice Owls just beat Oklahoma 9-5 in the rubber match of the 3-game series. At least one baseball team I like is doing well.
I went to the ballpark twice this week to watch the Chicago Cubs take on the Houston Astros. On Monday, the Cubs dominated the Astros in an 8-0 victory, displaying a glimpse of the true potential of certain members of the team. Most notably, Carlos Zambrano pitched 8 innings, giving up only 2 walks with 8 strikeouts. He carried a perfect game through 4, and the no-hitter through 7 1/3. Ohman came in and finished with a perfect 9th inning. Zambrano even hit one out, making that the second home run I've seen him hit in Minute Maid Park. Before the game, I managed to get my ticket signed by Matt Murton, #19. Clicking on the photo above will take you to my pictures of the game.
Unfortunately, the Cubs turned around and dropped the next two to the Astros, wasting some great outings by some young pitchers. Carlos Marmol, called up from AA, pitched two solid innings in relief of Kerry Wood on Tuesday, striking out three, walking none, and giving up two hits with no runs; Sean Marshall, also called up this year from AA to slot into the starting rotation (as the Cubs #3!), went seven on Wednesday giving up four hits (one a solo shot by Ausmus; the only run scored all day) with five Ks and three walks; and Rice alumnus David Aardsma pitched 2/3 in relief with zeros across his line.
This has been the story of the 2006 season; taking games from good teams (2 of 3 vs. the Cardinals over the weekend, 6 of 9 so far this season) and blowing games against mediocre teams and rookie pitchers. The Cubs batters have a strong tendency to hack away with no plate discipline, a philosophy that is just as likely due to crappy management (Fire Dusty Baker!) as it is to having players with historically crappy OBP (see: Neifi Perez). I'm still rooting on the Cubs, and I'm still going to go to games, but 2005 Astros aside, I've pretty much written off the season. I just hope that the management sees it too and starts building for the future, rather than trying to put a finger into the hole in the dike when the whole foundation is crumbling.
As mentioned previously, I wrote a lineup simulator in C to run through all 9! permutations. I tested it against the 2005 Astros. The full results are here (6.8 MB gzipped text file), but here are the top 10 and bottom 10 lineups.
The classic lineup:
![]()
This lineup clocks in about 1 run per game lower than was actually scored last year. Part of this probably is due to not accounting for steals, defensive errors, or sacrifices.
In a true display of my extreme geekiness, I have written a baseball simulator to run through all 9! (9 factorial = 362,880) permutations of the lineup in order to determine which one is optimal. There was a bit of talk on some of the sabermetric sites about lineup optimization a few weeks ago, and someone suggested that the best way would be to write a simulator, so I did. It's been a pretty good opportunity to brush up on my programming skills.
It's basically a Monte Carlo simulator that generates a random number and compares it against a player's statistics to determine whether the result of that particular at bat should be a walk, single, double, etc. This simulator doesn't take into account sac flys, sac bunts, steals, or double plays, so it consistently underestimates the run totals, but it should provide a reasonable first order approximation. I've written in a hook for a possible routine for double plays, and it ought to be possible to take sacrifices and speed into account as well, but that would probably require a significant rewrite and consequently increase the run time. I've spent the last few days tweaking the code to get it to run as fast as possible, but for any sort of statistical validity it still takes about 2 1/2 days to run through all the permutations (at about 150,000 to 250,000 games per lineup, we're talking about 72 billion simulated games). Currently I'm testing it out against the 2005 Astros, using the aggregated stats for the pitchers in one slot.
The current version of the code is here; I compile it with the following command on Mac OS X running on a G4-based machine:
gcc -o simulator_gsl simulator_gsl_switch.c -lgsl -mdynamic-no-pic -fast -mcpu=7450 -g
It requires the GNU Scientific Library (hence the -lgsl option on the command line) because it uses the GSL random number generator library; the Mersenne Twister random number generator helped shave a few percent off the overall run time. I originally wrote the scoring function using if/else statements, but have rewritten the subroutine using the switch/case conditionals, which is also slightly faster. I'm trying to see if there are any other places I can eke out a little better performance, but I think the real project will be to rewrite the code so that it can run in parallel on multiple CPUs. Parallel processing should provide nearly linear acceleration (this problem is, as they say, "embarrasingly parallel"), and I have a few older computers around that could contribute CPU time...
Anyway, once I'm done running the program against the 2005 Astros lineup, I'll post the results here.
Update: For those who want to download and compile the program to run it themselves, feel free. It will ask you for a tab-delimited text file with the player statistics in it. It should have the extension .txt, and each player should be given their own line in the file with stats in this order: name, plate appearances, walks, hits, doubles, triples, homers, strikeouts, GIDP, hit by pitch.

Well, this year's World Series has already proven to be an exciting one. I'm not going to comment too much on it; it's a shame that the Astros are down 2-0 at this point. Both games could have gone the other way very easily. I expect to see this series go out to at least six games, and possibly seven. You may want to pop over to South Side Sox or Crawfish Boxes to read about what's going on, but basically, we're seeing some pretty exciting games that are coming right down to the wire. I won't be able to watch all of tonight's game due to my radio show, but I'll be following the action as best as possible.
Update (1:54 am): Well, that was depressing. A 14-inning game loss, after being up 4-0. Unless the Astros pull it together tomorrow (how many men were left in scoring position? Why can't anyone hit a goddamn sac fly?) they might get swept.
I was actually at Minute Maid Park on Sunday for the amazing 6 hour, 18 inning marathon of a baseball game between the Houston Astros and the Atlanta Braves. I've seen plenty of games at Minute Maid with the roof closed, but I have never heard the crowd that loud. It was definitely the most exciting game I've ever been privy to see.
Anyway, today the Astros face off against the hated Cards; it should be a good match. I'm afraid that the Astros will lose the series - their bats just aren't consistent enough - but I'd hate to be the Cardinals facing off against the big three (Pettitte, Clemens, and Oswalt). Even Backe is a pretty decent pitcher, and the Houston bullpen is very deep - Sunday's game illustrated that. We'll see what happens...

And congratulations to the Astros. I didn't get to see it, but it sounds like it was a hell of a win.
A Chicagoan dies and is sent to the great below. He had been a horrible man throughout life and even the devil wanted to punish him, so he puts him to work breaking up rocks with a sledgehammer. To make it worse he cranks up the temperature and the humidity. "Love my kingdom!" laughs the devil. After a couple of days the devil checks in on his victim to see if he is suffering adequately. The devil is aghast as he looks at the Chicagoan happily swinging his hammer and whistling a happy tune. The devil walks up to him and says, "I don't understand this. I've turned the heat way up, it's humid, you're crushing rocks; why are you so happy?" The Chicagoan, smiling big, looks at the devil and replies, "This is great! It reminds me of August in Chicago. Hot, humid, a good place to work. It reminds me of home. This is fantastic!" The devil, extremely perplexed, walks away to ponder the Chicagoan's remarks. Then he decides to drop the temperature, send down driving rain and torrential wind. Soon, hell is a wet, muddy mess. Walking in mud up to his knees with dust blowing into his eyes, the Chicagoan is happily slogging through the mud pushing a wheelbarrow full of crushed rocks. Again, the devil asks how he can be happy in such conditions. The Chicagoan replies, "This is great! Just like April in Chicago. It reminds me of working out in the fields with spring planting!" The devil is now completely baffled. Angry, and desperate to make things really awful, he tries one last ditch effort. He makes the temperature plummet. Suddenly the devil's lair is blanketed in snow and ice. Confident that this will surely make the Chicagoan unhappy, the devil checks in on the Chicagoan. He is aghast at what he sees. The Chicagoan is dancing, singing, and twirling his sledgehammer as he cavorts in glee. "How can you be so happy? Don't you know its 40 below zero?" screams the devil. Jumping up and down, the Chicagoan throws a snowball at the devil and yells, "Hell's frozen over!! This means the Cubs are in the World Series!!!