Tuesday, March 13, 2012

Draft Theory

Lately, I've decided I needed a programming side project, and so I'm trying to whip up a fantasy baseball draft "optimizer" that should be able to suggest the best player to take given your situation.  This, of course, relies on a whole host of variables, and being able to keep track of them all is impossible.  If it was possible, it probably would have been solved by now, and all drafts would look the same!  In this post, I'm going to try to work through how we should value players in a fantasy baseball draft.  As I design my program, I'm trying to first tackle the problem of the league I'm in (5x5 + OPS + Holds, one catcher, corner/middle infield, 5 OF, 9 pitching slots), so that's something to keep in mind.  This will probably devolve into a discussion of draft theory, so if you don't care about fantasy baseball at all, feel free to skip out.

First of all, you can't predict baseball.  There are projections, and they have a decent degree of accuracy, but they're far short of perfect.  They can try to predict injuries, breakouts, aging, regression, and minor league equivalencies, and they do a great job, but if you disagree with them, you could definitely be right.  Your draft should take into account your own opinions, so the best course of action is probably to take a projection system (or a conglomeration of them, there are a bunch) and then adjust according to what you think will happen.

Once a set of projections has been settled upon, the problem becomes deciding how these projections dictate the valuation (read: draft position) of a player.  How do we compare an outfielder with a .300 AVG, 30 homers, 90 runs, 102 RBIs, and 22 steals to a pitcher with a 2.41 ERA, 22 wins, 201 strikeouts, and a 1.050 WHIP (at the time of this post, Carlos Gonzalez and Roy Halladay have roughly the same average draft position)?  I came into last night with absolutely no idea and left with... not much better of one.

I began by thinking you could just rank the players in different categories and then combine those into a "composite ranking" that would appropriately value the player.  This doesn't account for positional scarcity, though!  (On average, you're going to get the most HRs out of 1B, the most SBs out of OF or SS, and so on.  The 12th catcher is probably worse than the 1st catcher by a larger margin than the 12th 1B is worse than the 1st 1B.  There's a lot to think about here.)  We can instead rank the players in the categories at their individual positions, but this doesn't accurately capture the information.  At 3B, ZiPS projects Brett Lawrie for 25 steals, David Wright for 18, and Chase Headley and Chone Figgins for 15.  The difference in SB ranking between Lawrie and Wright is equal to the difference in ranking between Wright and Headley/Figgins, but the difference in steals is definitely not equal.  How can we handle this correctly?

My most recent thought was comparable to how players are valued by WAR.  The goal is to find a replacement-level valuation for a player and then work from that.  I settled on doing this by grabbing the 13th best player in each category at each position (i.e. Mike Moustakas has the 13th most runs at 3B with 72, Kevin Youkilis has the 13th most HRs with 18, etc).  How does this compare to the 13th best player at each position by ADP?

Name Runs Homers RBIs SBs Average OPS
Replacement C 53 13 55 1 0.272 0.768
Yorvit Torrealba 35 5 38 2 0.280 0.724
Replacement 1B 76 23 78 2 0.268 0.806
Justin Morneau 73 16 78 0 0.269 0.790
Replacement 2B 74 16 65 12 0.270 0.766
Jemile Weeks 80 3 52 29 0.290 0.743
Replacement 3B 72 18 70 5 0.270 0.800
David Freese 69 13 70 1 0.288 0.771
Replacement SS 77 9 58 19 0.280 0.738
Alexei Ramirez 85 16 69 9 0.274 0.737
Replacement OF 63 13 57 7 0.257 0.752
Jason Bourgeois 31 1 28 31 0.300 0.693

Let's compare.  Yorvit Torrealba falls far short, but his ZiPS projection has limited playing time (and it's unclear to me why his ADP is so high to begin with).  1B, 2B, and 3B are reasonably close, Alexei Ramirez seems undervalued, and Jason Bourgeois has a very different skillset than our replacement OF and is also projected for limited playing time.  I'm satisfied with the results overall.

The 13th best player in each category should absolutely going to be better than the 13th best player you can draft - that's pretty clear off the bat by logic.  Our valuation system does seem to provide a good baseline at each position that we can compare to, and I'll stick with it in the first implementation of the program.  How, though, do we work off of the baseline?  As an exercise, here are the top five shortstops by ADP in comparison to our baseline SS.

Name Runs Homers RBIs SBs Average OPS
Troy Tulowitzki +16 +20 +49 -10 +0.023 +0.181
Hanley Ramirez +9 +10 +21 +13 +0.001 +0.075
Jose Reyes +10 0 -2 +16 +0.021 +0.068
Starlin Castro +12 0 +16 +2 +0.024 +0.037
Elvis Andrus +9 -5 +2 +20 +0.005 -0.021

Is it immediately clear that these rankings are correct?  (These ADPs are in standard 5x5 leagues where OPS is not used, so we can ignore that at this point.)  By virtue of the +20 homers and +49 RBIs, Tulowitzki rightly claims the top spot, and Hanley seems like the right choice for second.  Over the course of a season, a team will accumulate many more RBIs than steals (2nd place in standard leagues for RBIs is ~1091, for SBs is ~200), so +16 in SBs would be valued much more than +16 in RBIs, justifying Reyes over Castro.  (In the implementation, I will probably somehow measure the value provided over replacement as a percentage dent made in progress towards a statistical target.)  But why not Andrus over Castro?  And why not Andrus over Reyes, especially considering that we're ignoring OPS?  Batting average can fluctuate highly from year to year, so that projection should be the one we're most skeptical about, and Reyes is a much greater injury risk than Andrus, so what justifies the difference in ADP?  Either the drafters do not agree with the projections, do not use the projections, or have internalized different valuations of the players than the projections would suggest.  In any case this brings us to a more game-theoretical problem in drafting - how other drafters value players - but we'll get to that in a sec.

How do we value players across different positions?  I've got another chart!

Name Runs Homers RBIs SBs Average OPS
Kemp (OF) +35 +19 +46 +24 +0.020 +0.169
Cabrera (3B) +41 +14 +48 -2 +0.053 +0.199
Pujols (1B) +32 +15 +26 +7 +0.040 +0.154
Cano (2B) +19 +10 +48 -8 +0.030 +0.063
Tulowitzki (SS) +16 +20 +49 -10 +0.023 +0.181

Maybe it's only because the position is shallow in 5-OF leagues, but Kemp looks like he's head and shoulders above the competition.  In terms of positional adjustment, Tulowitzki looks to be a little more than marginally better than Cano overall, but Cano projects to put up comparable stats overall in each category (besides OPS).  Thus, positional adjustment can explain why Tulo is a mid 1st-rounder while Cano is a late 1st-rounder.  We might be on to something here!

Alright, back to that game-theoretical part.  We shouldn't change the program's valuation of players based on where other people will draft that player, but we should adjust where we are willing to draft him.  If we have a guy that is valued in the first round, but there is no way anyone else will draft him before the fourth, maybe we can wait for the third round to grab him.  This allows us to look not only for the best player available, but the best value available.  The suggestion engine has to be able to figure out how long we can wait, though.  In the early rounds, players are likely only going to be valued incorrectly by a few slots (barring some grand surprises by the valuation system), but in the later rounds, if other drafters feel great about a player in the 23rd round, they'll probably just grab him.  In this case, we should probably be looking at numbers on the highest slot in which a player has been drafted.

Another thing that will adjust valuations is if we are targeting certain categories.  In head-to-head leagues, it may be better to draft in an attempt to dominate 6/10 or 7/12 categories rather than do reasonably well in all of them.  How much higher can we be willing to draft a player if we absolutely can't win homers without him (homers probably aren't as scarce as, say, steals, but you get it)? 

Some of these questions I don't really know how to answer, but I think I've made some progress here.  If anyone wants to give me feedback in the comments, I'd definitely appreciate it.  And I'll keep this place updated with how the program is going.