While I wait for Basim code to run, I thought I'd write what will be the first of many pieces on ethics and doing what's right. I'll get to more applied stuff later, but as a foundation I'm going to write a series of pieces on utilitarianism.
I am a utilitarian. Basically, this means that I believe the right action is the one that maximizes total "utility" in the world (you can think of that as total happiness minus total pain). Specifically, I am a total, act, hedonistic/one level (as opposed to high and low pleasure), classical (as opposed to negative) utilitarian; in short, I'm a Benthamite. In future posts I'll argue for all of those choices; I'll also try to respond to the Repugnant Conclusion and the Utility Monster, and argue that Decision Theories are silly.
Before I delve into all of that, though, are there any particular arguments people want me to respond to--either well known attacks, or just things you've thought of? Arguing for utilitarianism inevitably degenerates more into defending it from attacks and attacking other philosophies than actually articulating utilitarianism, partially because of how self evident of a philosophy it is. So, if you have any questions, comments, complaints, arguments, or expressions of agreement, post them in the comments or send me an email, and I'll address them either in the comments or in a future post.
SBF
p.s.--If you're interested in checking out utilitarianism more, I highly recommend http://felicifia.org/.
Friday, July 13, 2012
Improving Basim and feedback
I'm working on improving Basim and eWAR (some new content and some bug fixes), but it's going to take time to run the new calculations. (I'm also going to run them on more data points, i.e. multiple seasons.) While that happens, is there anything you think it would be cool for me to research/write about? Is there any improvement you'd suggest to Basim? Anything whose value in time and dollars I should compare to voting and donating to a campaign? If so, leave suggestions here in the comments (or drop me an email).
Also, I've spent a lot of time trying to decide how to integrate into eWAR the fact that lineups aren't totally irrelevant; my new approach is to take an average lineup (i.e. average 1st hitter, average 2nd hitter, etc.), and look at the run differential between replacing a test player for a given slot and replacing the league average player for that slot; this approach isn't perfect, though, because it is at risk of delegating all less than average players to ninth so that they total plate appearances in which they're batting, relative to the league average player, is minimized (and shove all better than average players to leadoff). Suggestions?
Also, as always, feel free to sign up for the RSS feed (widget on right), follow us on twitter, and spread the blog around.
SBF
Also, I've spent a lot of time trying to decide how to integrate into eWAR the fact that lineups aren't totally irrelevant; my new approach is to take an average lineup (i.e. average 1st hitter, average 2nd hitter, etc.), and look at the run differential between replacing a test player for a given slot and replacing the league average player for that slot; this approach isn't perfect, though, because it is at risk of delegating all less than average players to ninth so that they total plate appearances in which they're batting, relative to the league average player, is minimized (and shove all better than average players to leadoff). Suggestions?
Also, as always, feel free to sign up for the RSS feed (widget on right), follow us on twitter, and spread the blog around.
SBF
Tuesday, July 10, 2012
Introducing eWAR: Empirical (offensive) Wins Above Replacement
This is continuing a series of posts about a baseball game simulator I made. For the introductory post, look here. For a revised look at the 2012 SF Giants lineup, look here, and for a description of how the simulator works, look here. Also, I've grown tired of referring to the simulator as such, so from here on out I'll refer to it as Basim (short for baseball simulator).
________________________________________
The short version of this article is that I've constructed a new stat, eRAA (empirical runs above average), that seems to correlate more with the number of runs a team scores than does traditional RAA, even accounting for ballpark corrections. This leads me to believe that eRAA may be a "better" stat than RAA, in that it better predicts how good a player is than RAA does. This leads to the definition of eWAR, empirical runs above replacement on offense, as 0.1*eRAA (using the canonical value of 10 runs/win).
I originally built Basim, a python script that simulates baseball games for a given lineup, with the intention of seeing which permutation of nine players produces the best results. It soon occurred to me, though, that there was something else I could use it for: I could use Basim to evaluate players. The idea was simple: put a given player in a lineup with eight average players and see how many runs above (or below) average that lineup scores by running hundreds of thousands of simulations of that lineup and recording the average runs per game; multiply it by amount they play, and you get eRAA--a measure of how good a player is, relative to average
The way to test whether eRAA is a "better" or "worse" stat than RAA, the basis for WAR, is to see which, when aggregated for a team, better predicts the number of runs that the team scores. I decided to run the test on the 2011 baseball season. My procedure was pretty simple:
1) I took aggregate batting stats for 2011 to find the "average" player, avePlayer*.
2) I ran 10,000,000 simulations of a lineup of nine of that player to find the baseline runs per game (brpg); I found that, for 2011, brpg = 4.1267312.
3) I also recorded the number of plate appearances per game that the test player (batting fifth) would have in the baseline simulation; I got paPerGame = 4.2913712999999998.
4) For each of the ~1,500 2011 major league baseball players, I ran 100,000 Basim simulations with them batting fifth and every other player being avePlayer. I recorded the number of runs scored per game on average by that lineup, playerRPG. I then computed eRAA = (playerRPG-brpg)*playerPA/paPerGame, the number of runs above the average player that they produced during the season.
5) For each team, I totaled up the eRAA of each hitter on their team to get their teamRAA. I added that to the average number of runs scored by a team aveTeamRuns = 693.36, to get eRuns, the number of runs my model would predict them to score in a season.
6) For each team, I also added up Rbat, Rbaser, and Rdp, the three offensive stats contributing to RAA. All statistics were taken from baseball-reference.com. However, I believe that Rbat attempts to correct for the park that the hitter plays in. In order to get an apples-to-apples comparison, I reversed that by multiplying the predicted runs (total, not above average) by the team's ballpark adjustment factor. (It's possible I messed this step up; my understanding is that this factor should be applied multiplicative to a player's runs created.) This got me the version of RAA I tested eRuns against; I'll call it RAAproduced.
7) I also recorded the total runs scored above average runsScoredaboveAverage by each team that season, and looked for correlations between that number, RAAproduced, and eRAA**.
The results: RAAproduced, the classic building block of WAR, had a correlation coefficient of 0.9459 with runsScoredAboveAverage, missing by an average absolute value of 28.6. eRAA had a correlation coefficient with runsScoredAboveAverage of 0.9592, missing by an average of 19.3 runs per team.
So, while both RAAproduced and eRAA correlated very well with the number of runs a team scored, eRAA correlated slightly stronger, leading me to believe that eRAA better predicted a player's value to a team than did RAA.
The results: RAAproduced, the classic building block of WAR, had a correlation coefficient of 0.9459 with runsScoredAboveAverage, missing by an average absolute value of 28.6. eRAA had a correlation coefficient with runsScoredAboveAverage of 0.9592, missing by an average of 19.3 runs per team.
So, while both RAAproduced and eRAA correlated very well with the number of runs a team scored, eRAA correlated slightly stronger, leading me to believe that eRAA better predicted a player's value to a team than did RAA.
In order to see what eRAA said about individual players, I found the 2011 hitters with the highest eWAA, empirical offensive wins above average (eRAA/10):
Name
|
eWAR
|
Jose Bautista
|
9.41
|
Matt Kemp
|
8.38
|
Miguel Cabrera
|
7.83
|
Ryan Braun
|
6.85
|
Prince Fielder
|
6.58
|
Jacoby Ellsbury
|
5.61
|
Lance Berkman
|
5.38
|
Joey Votto
|
5.34
|
Adrian Gonzalez
|
5.23
|
Justin Upton
|
4.94
|
Curtis Granderson
|
4.61
|
Mike Napoli
|
4.41
|
Jose Reyes
|
4.24
|
Albert Pujols
|
4.15
|
Troy Tulowitzki
|
4.14
|
There are of course a number of claims in this article with which one could take issue. Not everything is quite an apples to apples comparison; I tried to turn WAR into the form most apt to compare to eWAR, but WAR still attempts to correct for managerial decisions (e.g. intentional walks) in a way mine doesn't. Also, WAR also has already developed adjustments for ballpark, position, and fielding that eWAR hasn't. I didn't tweak my formula at all after looking at the 2011 data set, but I should still run it in a truly out of sample year; I'll run it on 2010 and see how it performs there. Also, there is still a lot of work to be done on Basim. In particular, it makes arbitrary decision with runners on first and other bases at the same time, and doesn't have much granularity on taking extra bases. It also doesn't handle pitchers particularly well, and arbitrarily bats the test player 5th in the lineup. But those are all the more reason to believe that with more tuning eWAR could be a potential complement, or even supplement, for oWAR.
_____________________
*I summed up the stats of every player in the league in 2011 to create the averagePlayer::
PA:185245
BB + IBB + HBP:15018+1554+1231
Hits: 42267
Doubles: 8399
Triples: 898
Home Runs: 4552
Stolen Bases: 3279
Caught Stealing: 1261
Strikeouts: 34488
Ground into Double Play Rate: .1
Stolen Base Opportunities: 67623
Reached on Error: 1816
Extra Bases Taken Percentage: .41
**For reference, a list of (eRAA,RAAproduced,runsScoredAboveAverage) for each team in alphabetical order fo 2011 team abbreviation: [(45.200205677844551, 21.785200000000032, 37.259999999999991), (-44.774112414835749, -92.267200000000003, -51.840000000000032), (-5.1114567038280354, -49.814399999999978, 14.580000000000041), (179.73419545402641, 160.32159999999999, 181.44000000000005), (-38.23559280456594, -60.374400000000037, -38.879999999999995), (-51.724434797799972, -91.083600000000047, -38.879999999999995), (45.215654725565059, 42.115200000000073, 42.120000000000005), (-37.44421849491345, -46.934399999999982, 11.339999999999918), (54.75322142365065, 20.457599999999957, 42.120000000000005), (75.629775964620023, 81.570800000000077, 93.960000000000036), (-40.913050474099116, -62.37360000000001, -68.040000000000077), (-110.38232860437888, -66.712800000000016, -77.759999999999991), (20.932611680559809, 25.113600000000019, 37.259999999999991), (-3.4382776433257294, -30.865199999999959, -25.919999999999959), (-18.522117860088237, -56.98720000000003, -45.360000000000014), (58.721202940421378, 49.368000000000052, 27.539999999999964), (-96.570937732654357, -132.51800000000003, -74.520000000000095), (24.467027544318942, 21.412799999999947, 24.299999999999955), (118.53137657885713, 112.70880000000011, 173.33999999999992), (-103.13524462448632, -101.31079999999997, -48.600000000000023), (27.872957718666616, 26.268000000000029, 19.440000000000055), (-125.28292385233611, -117.97440000000006, -82.620000000000005), (-122.5675836066669, -137.34879999999998, -100.43999999999994), (-150.53768491204667, -156.28160000000003, -137.69999999999993), (-103.57234010489849, -132.33960000000002, -123.12), (79.896154919058134, 22.331999999999994, 68.039999999999964), (30.389992028888202, 0.6512000000000171, 12.960000000000036), (175.26261892090292, 236.04119999999989, 162.0), (41.654865473886879, -8.6655999999999267, 50.219999999999914), (-64.042960207148923, -77.0, -64.800000000000068)]
Doubles: 8399
Triples: 898
Home Runs: 4552
Stolen Bases: 3279
Caught Stealing: 1261
Strikeouts: 34488
Ground into Double Play Rate: .1
Stolen Base Opportunities: 67623
Reached on Error: 1816
Extra Bases Taken Percentage: .41
**For reference, a list of (eRAA,RAAproduced,runsScoredAboveAverage) for each team in alphabetical order fo 2011 team abbreviation: [(45.200205677844551, 21.785200000000032, 37.259999999999991), (-44.774112414835749, -92.267200000000003, -51.840000000000032), (-5.1114567038280354, -49.814399999999978, 14.580000000000041), (179.73419545402641, 160.32159999999999, 181.44000000000005), (-38.23559280456594, -60.374400000000037, -38.879999999999995), (-51.724434797799972, -91.083600000000047, -38.879999999999995), (45.215654725565059, 42.115200000000073, 42.120000000000005), (-37.44421849491345, -46.934399999999982, 11.339999999999918), (54.75322142365065, 20.457599999999957, 42.120000000000005), (75.629775964620023, 81.570800000000077, 93.960000000000036), (-40.913050474099116, -62.37360000000001, -68.040000000000077), (-110.38232860437888, -66.712800000000016, -77.759999999999991), (20.932611680559809, 25.113600000000019, 37.259999999999991), (-3.4382776433257294, -30.865199999999959, -25.919999999999959), (-18.522117860088237, -56.98720000000003, -45.360000000000014), (58.721202940421378, 49.368000000000052, 27.539999999999964), (-96.570937732654357, -132.51800000000003, -74.520000000000095), (24.467027544318942, 21.412799999999947, 24.299999999999955), (118.53137657885713, 112.70880000000011, 173.33999999999992), (-103.13524462448632, -101.31079999999997, -48.600000000000023), (27.872957718666616, 26.268000000000029, 19.440000000000055), (-125.28292385233611, -117.97440000000006, -82.620000000000005), (-122.5675836066669, -137.34879999999998, -100.43999999999994), (-150.53768491204667, -156.28160000000003, -137.69999999999993), (-103.57234010489849, -132.33960000000002, -123.12), (79.896154919058134, 22.331999999999994, 68.039999999999964), (30.389992028888202, 0.6512000000000171, 12.960000000000036), (175.26261892090292, 236.04119999999989, 162.0), (41.654865473886879, -8.6655999999999267, 50.219999999999914), (-64.042960207148923, -77.0, -64.800000000000068)]
Saturday, July 7, 2012
How much is a vote worth? How about a dollar?
This is the first in a series of posts where I'll examine the relative value of a vote for a candidate, a dollar donated to a candidate, and later a dollar spent on other goods--charitable or self-serving.
First, in order to address the election-centered questions, it's important to know what the likelihood that an individual voter will swing an election (and by extension, the number of voters per election swing), a version of Nate Silver's return on investment index. He probably has more thoroughly calculated numbers for presidential elections that I do, but I'm going to start off looking at congressional elections. Also, everything here is going to be an estimate; I'm more interested in getting the right order of magnitude than the exact number.
So, what are the odds that a voter, or a percent of voters, will swing an election? I looked at Nate Silver's projections for the 2010 midterm elections, and recorded the projected and actual margin of victories for all races projected to be within 3 points*, on the theory that if one were to give money to a campaign, it would be hard to do better than to just pick the races Silver says are the closest. Plotting the distribution, it seems like there is an error of roughly +- 5% on the margin. Again, this is just an estimate, but for an order of magnitude calculation it'll do. However, if you're looking not that the margin of the two votes but the absolute Democratic (or Republican) share of the two-party vote, this is a margin of +- 2.5%. So, if you take a given election that Silver projects to be close (within 3% margin), the odds of a 1% boost in the Democratic (or Republican) vote deciding the election are roughly 20% (+=2.5% means a total range of 5%). I'll use that number from here on out.
So, what to do with this number? Well, first, the average congressional district is going to have turnout of about 41%; let's say that a competitive district is closer to 50%. Given that there are 435 voting congressmen and about 217,000,000 eligible voters, there are about 250,000 votes cast in an average swing district. So buying 1% of the vote gets 20% of a congressman; voting yourself (or getting someone else to) in a swing district buys about 8*10^(-5) of a congressman.
So, how much do you have to donate to give a candidate an extra 1% of the vote? It seems that the jury's still out on this one, and different papers I've looked at have given different answers. One paper that looks cool, by Steven D. Levitt, looks at repeat match-ups between congressional candidates, and claims that $100,000 of 1992 money (or about 160,000 current dollars), donated to a challenger (i.e. non-incumbent), gives the challenger an extra ~0.3% of the vote. If this number is taken at face value, then that would imply that it takes roughly $2,600,000 to buy a congressional election.
Below I've started a table which summarizes this. The Equivalent Cost (dollars) tab adds the cost in dollars with $25*(hours), assuming time is worth $25/hour. I'm also assuming it takes one hour to vote; costs are scaled up to the size of the effect (in this case, swinging one election). I put a question mark next to the campaign donations row to indicate the large error associated with the money-to-votes calculation (done using Levitt's paper). I'll add to this table later as I expand on these calculations.
*Differences between projections and actual votes: [7.0, 0.29999999999999999, 0.5, 6.0, -4.0, 1.5, 8.0, -1.0, 0.0, -10.800000000000001, -6.5, 13.0, -1.0, -1.0, 5.0, 8.0, 8.0, 3.0, 5.0, 2.0, 4.0, 4.4000000000000004, 1.8, -3.5, -3.0, 2.0, -3.0, 6.4000000000000004, 2.6000000000000001, 9.9000000000000004, 0.5, -4.0, -6.0, -4.0, -5.0]. Positive means actual vote was more Democratic than projection.
First, in order to address the election-centered questions, it's important to know what the likelihood that an individual voter will swing an election (and by extension, the number of voters per election swing), a version of Nate Silver's return on investment index. He probably has more thoroughly calculated numbers for presidential elections that I do, but I'm going to start off looking at congressional elections. Also, everything here is going to be an estimate; I'm more interested in getting the right order of magnitude than the exact number.
So, what are the odds that a voter, or a percent of voters, will swing an election? I looked at Nate Silver's projections for the 2010 midterm elections, and recorded the projected and actual margin of victories for all races projected to be within 3 points*, on the theory that if one were to give money to a campaign, it would be hard to do better than to just pick the races Silver says are the closest. Plotting the distribution, it seems like there is an error of roughly +- 5% on the margin. Again, this is just an estimate, but for an order of magnitude calculation it'll do. However, if you're looking not that the margin of the two votes but the absolute Democratic (or Republican) share of the two-party vote, this is a margin of +- 2.5%. So, if you take a given election that Silver projects to be close (within 3% margin), the odds of a 1% boost in the Democratic (or Republican) vote deciding the election are roughly 20% (+=2.5% means a total range of 5%). I'll use that number from here on out.
So, what to do with this number? Well, first, the average congressional district is going to have turnout of about 41%; let's say that a competitive district is closer to 50%. Given that there are 435 voting congressmen and about 217,000,000 eligible voters, there are about 250,000 votes cast in an average swing district. So buying 1% of the vote gets 20% of a congressman; voting yourself (or getting someone else to) in a swing district buys about 8*10^(-5) of a congressman.
So, how much do you have to donate to give a candidate an extra 1% of the vote? It seems that the jury's still out on this one, and different papers I've looked at have given different answers. One paper that looks cool, by Steven D. Levitt, looks at repeat match-ups between congressional candidates, and claims that $100,000 of 1992 money (or about 160,000 current dollars), donated to a challenger (i.e. non-incumbent), gives the challenger an extra ~0.3% of the vote. If this number is taken at face value, then that would imply that it takes roughly $2,600,000 to buy a congressional election.
Below I've started a table which summarizes this. The Equivalent Cost (dollars) tab adds the cost in dollars with $25*(hours), assuming time is worth $25/hour. I'm also assuming it takes one hour to vote; costs are scaled up to the size of the effect (in this case, swinging one election). I put a question mark next to the campaign donations row to indicate the large error associated with the money-to-votes calculation (done using Levitt's paper). I'll add to this table later as I expand on these calculations.
Action
|
Cost (hours)
|
Cost (dollars)
|
Effective Cost (dollars)
|
Effect
|
Notes (?=sketchy)
|
Voting
|
12,500
|
0
|
$312,500
|
Swings congressional election
|
|
Donating to non-incumbent congressional campaign
|
0
|
$2,600,000
|
$2,6000,000
|
Swings congressional election
|
? (Relies on Levitt)
|
*Differences between projections and actual votes: [7.0, 0.29999999999999999, 0.5, 6.0, -4.0, 1.5, 8.0, -1.0, 0.0, -10.800000000000001, -6.5, 13.0, -1.0, -1.0, 5.0, 8.0, 8.0, 3.0, 5.0, 2.0, 4.0, 4.4000000000000004, 1.8, -3.5, -3.0, 2.0, -3.0, 6.4000000000000004, 2.6000000000000001, 9.9000000000000004, 0.5, -4.0, -6.0, -4.0, -5.0]. Positive means actual vote was more Democratic than projection.
Thursday, July 5, 2012
Baseball Game Simulation details
Earlier I wrote some early results from a baseball game simulator I wrote. Here I'll describe exactly how the simulator works.
As an input the simulator takes a lineup of nine players, along with the following stats for each player: plate appearances, walks+IBB+hit by pitch, singles, doubles, triples, homers, strikeouts, ground into double play rate, stolen base opportunities, stolen bases, caught stealing, number of times reached on error, and extra bases taken percentage; all stats were taken from baseball-reference.com.
The simulator then simulates an entire (offensive) game from that lineup.
Each time a batter steps to the plate, the following things are simulated:
1) The play that the batter creates is randomly chosen based on how frequently they hit into that type of play. The options are single, double, triple, home run, walk, strikeout, ground into double play opportunity, other out. Reached on error is treated as a single, and intentional walks and hit by pitches are treated as walks.
2) Baserunners (sometimes) try to advance. Each baserunner other than the batter attempts to take an extra base with probability governed by their extra bases taken percentage, and if they try to advance they are thrown out with 3% probability. Baserunners try to advance on all base hits and all outs other than strikeouts.
3) If it was a ground into double play opportunity, then if there was a runner on first a double play is executed. Otherwise it's just a normal groundout.
4) After each plate appearance, if there are runners on base with the next base empty they attempt to steal with probability (sb+cs)/sbo, and are thrown out with the appropriate frequency. Runners do not try to steal third with zero or two outs, and they do not try to steal home.
Using this method an inning is simulated, and the runs scored, along with the next batter up, are returned; the simulator then clears all bases and outs, and starts simulating the next inning.
Thoughts on how to improve it? Right now the frequent bunting of pitchers is only implicitly counter for in their high number of outs but low number of strikeouts and ground into double plays, which will advance runners a good deal (but not as much as they should).
As an input the simulator takes a lineup of nine players, along with the following stats for each player: plate appearances, walks+IBB+hit by pitch, singles, doubles, triples, homers, strikeouts, ground into double play rate, stolen base opportunities, stolen bases, caught stealing, number of times reached on error, and extra bases taken percentage; all stats were taken from baseball-reference.com.
The simulator then simulates an entire (offensive) game from that lineup.
Each time a batter steps to the plate, the following things are simulated:
1) The play that the batter creates is randomly chosen based on how frequently they hit into that type of play. The options are single, double, triple, home run, walk, strikeout, ground into double play opportunity, other out. Reached on error is treated as a single, and intentional walks and hit by pitches are treated as walks.
2) Baserunners (sometimes) try to advance. Each baserunner other than the batter attempts to take an extra base with probability governed by their extra bases taken percentage, and if they try to advance they are thrown out with 3% probability. Baserunners try to advance on all base hits and all outs other than strikeouts.
3) If it was a ground into double play opportunity, then if there was a runner on first a double play is executed. Otherwise it's just a normal groundout.
4) After each plate appearance, if there are runners on base with the next base empty they attempt to steal with probability (sb+cs)/sbo, and are thrown out with the appropriate frequency. Runners do not try to steal third with zero or two outs, and they do not try to steal home.
Using this method an inning is simulated, and the runs scored, along with the next batter up, are returned; the simulator then clears all bases and outs, and starts simulating the next inning.
Thoughts on how to improve it? Right now the frequent bunting of pitchers is only implicitly counter for in their high number of outs but low number of strikeouts and ground into double plays, which will advance runners a good deal (but not as much as they should).
Wednesday, July 4, 2012
More Giants Lineup comments
For the previous post in this series, click here.
First of all, I found a bug in the stealing bases section of my lineup code. I've re-run the simulations; new findings:
1) A random lineup of the giants players scores, on average, 4.06 runs/game.
2) The current Giants lineup scores, on average, 4.13 runs/game
3) The top lineup this time was: Buster Posey, Brandon Belt, Melkey Cabrera, Pablo Sandoval, Gregor Blanco, Angel Pagan, Brandon Crawford, Ryan Theriot, Barry Zito, scoring 4.29 runs/game on average.
4) The old best lineup (with the buggy code) scored 4.22 runs/game on average.
So, it still looks like the Giants could get another ~.16 runs/game out of their lineup, translating to ~2.56 more wins in a season.
Also, I decided to see what effect stealing bases had on the runs scored by a lineup; the answer, essentially, was none: without allowing stolen bases a random lineup scored ~4.05 runs/game, just .01 less than with stolen bases. So it looks like stealing bases is close to a wash (note that the Giants have pretty good base stealers this year in Blanco, Pagan, and Cabrera).
It occurs to me, though, that by using a half season of one team I have some sample size issues. There are also some oddities surroundings pitchers (i.e. the high frequency of bunts, which my program only half accounts for). So, I'll next look at many different AL teams.
FWIW, here were the ten best lineups, along with their average runs scored: [([Brandon Belt, Angel Pagan, Gregor Blanco, Pablo Sandoval, Buster Posey, Melkey Cabrera, Brandon Crawford, Barry Zito, Ryan Theriot], 4.2150850000000002), ([Gregor Blanco, Melkey Cabrera, Pablo Sandoval, Brandon Belt, Angel Pagan, Brandon Crawford, Buster Posey, Ryan Theriot, Barry Zito], 4.2343450000000002), ([Gregor Blanco, Brandon Belt, Angel Pagan, Pablo Sandoval, Melkey Cabrera, Buster Posey, Ryan Theriot, Barry Zito, Brandon Crawford], 4.2404599999999997), ([Angel Pagan, Gregor Blanco, Brandon Belt, Pablo Sandoval, Melkey Cabrera, Brandon Crawford, Ryan Theriot, Buster Posey, Barry Zito], 4.2502000000000004), ([Gregor Blanco, Brandon Belt, Angel Pagan, Melkey Cabrera, Pablo Sandoval, Brandon Crawford, Ryan Theriot, Barry Zito, Buster Posey], 4.2520499999999997), ([Brandon Belt, Gregor Blanco, Angel Pagan, Melkey Cabrera, Pablo Sandoval, Ryan Theriot, Barry Zito, Brandon Crawford, Buster Posey], 4.2529050000000002), ([Gregor Blanco, Pablo Sandoval, Brandon Belt, Melkey Cabrera, Angel Pagan, Buster Posey, Brandon Crawford, Ryan Theriot, Barry Zito], 4.2606700000000002), ([Buster Posey, Gregor Blanco, Brandon Belt, Pablo Sandoval, Melkey Cabrera, Angel Pagan, Ryan Theriot, Brandon Crawford, Barry Zito], 4.2787699999999997), ([Buster Posey, Brandon Belt, Gregor Blanco, Pablo Sandoval, Melkey Cabrera, Angel Pagan, Ryan Theriot, Brandon Crawford, Barry Zito], 4.2844249999999997), ([Buster Posey, Brandon Belt, Melkey Cabrera, Pablo Sandoval, Gregor Blanco, Angel Pagan, Brandon Crawford, Ryan Theriot, Barry Zito], 4.2864449999999996)]. Why are these lineups the best? I'm not completely sure. Thoughts?
First of all, I found a bug in the stealing bases section of my lineup code. I've re-run the simulations; new findings:
1) A random lineup of the giants players scores, on average, 4.06 runs/game.
2) The current Giants lineup scores, on average, 4.13 runs/game
3) The top lineup this time was: Buster Posey, Brandon Belt, Melkey Cabrera, Pablo Sandoval, Gregor Blanco, Angel Pagan, Brandon Crawford, Ryan Theriot, Barry Zito, scoring 4.29 runs/game on average.
4) The old best lineup (with the buggy code) scored 4.22 runs/game on average.
So, it still looks like the Giants could get another ~.16 runs/game out of their lineup, translating to ~2.56 more wins in a season.
Also, I decided to see what effect stealing bases had on the runs scored by a lineup; the answer, essentially, was none: without allowing stolen bases a random lineup scored ~4.05 runs/game, just .01 less than with stolen bases. So it looks like stealing bases is close to a wash (note that the Giants have pretty good base stealers this year in Blanco, Pagan, and Cabrera).
It occurs to me, though, that by using a half season of one team I have some sample size issues. There are also some oddities surroundings pitchers (i.e. the high frequency of bunts, which my program only half accounts for). So, I'll next look at many different AL teams.
FWIW, here were the ten best lineups, along with their average runs scored: [([Brandon Belt, Angel Pagan, Gregor Blanco, Pablo Sandoval, Buster Posey, Melkey Cabrera, Brandon Crawford, Barry Zito, Ryan Theriot], 4.2150850000000002), ([Gregor Blanco, Melkey Cabrera, Pablo Sandoval, Brandon Belt, Angel Pagan, Brandon Crawford, Buster Posey, Ryan Theriot, Barry Zito], 4.2343450000000002), ([Gregor Blanco, Brandon Belt, Angel Pagan, Pablo Sandoval, Melkey Cabrera, Buster Posey, Ryan Theriot, Barry Zito, Brandon Crawford], 4.2404599999999997), ([Angel Pagan, Gregor Blanco, Brandon Belt, Pablo Sandoval, Melkey Cabrera, Brandon Crawford, Ryan Theriot, Buster Posey, Barry Zito], 4.2502000000000004), ([Gregor Blanco, Brandon Belt, Angel Pagan, Melkey Cabrera, Pablo Sandoval, Brandon Crawford, Ryan Theriot, Barry Zito, Buster Posey], 4.2520499999999997), ([Brandon Belt, Gregor Blanco, Angel Pagan, Melkey Cabrera, Pablo Sandoval, Ryan Theriot, Barry Zito, Brandon Crawford, Buster Posey], 4.2529050000000002), ([Gregor Blanco, Pablo Sandoval, Brandon Belt, Melkey Cabrera, Angel Pagan, Buster Posey, Brandon Crawford, Ryan Theriot, Barry Zito], 4.2606700000000002), ([Buster Posey, Gregor Blanco, Brandon Belt, Pablo Sandoval, Melkey Cabrera, Angel Pagan, Ryan Theriot, Brandon Crawford, Barry Zito], 4.2787699999999997), ([Buster Posey, Brandon Belt, Gregor Blanco, Pablo Sandoval, Melkey Cabrera, Angel Pagan, Ryan Theriot, Brandon Crawford, Barry Zito], 4.2844249999999997), ([Buster Posey, Brandon Belt, Melkey Cabrera, Pablo Sandoval, Gregor Blanco, Angel Pagan, Brandon Crawford, Ryan Theriot, Barry Zito], 4.2864449999999996)]. Why are these lineups the best? I'm not completely sure. Thoughts?
Tuesday, July 3, 2012
Jewish Poker
“For quite a while the two of us sat at our table, wordlessly stirring our coffee. Ervinke was bored. ‘All right,’ he said. ‘Let's play poker.’
‘No,’ I answered. ‘I hate cards. I always lose.’
‘Who's talking about cards?’ thus Ervinke. ‘I was thinking of Jewish poker.’
He then briefly explained the rules of the game. Jewish poker is played without cards, in your head, as befits the People of the Book.
‘You think of a number, I also think of a number,’ Ervinke said. ‘Whoever thinks of a higher number wins. This sounds easy, but it has a hundred pitfalls. Nu!’”
Jewish Poker is one of “those” games, games that both players play as a joke, smirks on their faces as they announce numbers like “negative four” and “square root of pi” and “Ackermann function of one billion, one billion.” The rules are really no more complicated than Ervinke made them out to be: each player thinks of a (finite!) number, and whoever thought of the higher number wins. Players can reveal their numbers simultaneously, or one after the other, whichever they prefer.
“We plunked down five piasters each, and, leaning back in our chairs began to think of numbers. After a while Ervinke signaled that he had one. I said I was ready.”
The game is stupid. (That’s what I meant when I said it was one of “those” games.) It’s stupid no matter how you play it, but it becomes even more stupid when the numbers are not revealed simultaneously, because the second player can just add one to the number that the first player revealed.
“‘All right,’ thus Ervinke. ‘Let's hear your number.’
‘Eleven,’ I said.
‘Twelve,’ Ervinke said, and took the money.”
It makes sense that there should be a second-player advantage in a game like this, but somehow it seems a little strange, doesn’t it? Because, well, eleven loses to twelve, so why not pick a number higher than twelve? That’s a number that beats all the numbers eleven would have beaten, and would have had the additional advantage of not losing to twelve. Maybe it wasn’t going first that sunk him; maybe our narrator just played badly.
“I could have kicked myself, because originally I had thought of Fourteen, and only at the last moment had I climbed down to Eleven, I really don't know why. ‘Listen.’ I turned to Ervinke. ‘What would have happened had I said Fourteen?’
‘What a question! I'd have lost. Now, that is just the charm of poker: you never know how things will turn out. But if your nerves cannot stand a little gambling, perhaps we had better call it off.’”
Of course this logic doesn’t make any sense. If the narrator had said fourteen, then Ervinke, the clever bastard, would have said fifteen. No matter how colossal the number you pick, it’s always going to be smaller than your opponent’s could be.
“Without saying another word, I put down ten piasters on the table. Ervinke did likewise. I pondered my number carefully and opened with Eighteen.
‘Damn!’ Ervinke said. ‘I have only Seventeen!’
I swept the money into my pocket and quietly guffawed. Ervinke had certainly not dreamed that I would master the tricks of Jewish poker so quickly. He had probably counted on my opening with Fifteen or Sixteen, but certainly not with Eighteen. Ervinke, his brow in angry furrows, proposed to double the stakes.”
So, what if we try playing simultaneous Jewish Poker, each player writing down their number before revealing? Something’s still wrong. Depending on your level of mathematical sophistication, you’ll cram your paper with nines, or you’ll search the Internet for the fastest-growing function you can find, and call it on a trillion. (In fact, it’s probably better to cram your paper with ones; you can fit more in.)
Now this is starting to look like a weird version of Rock-Paper-Scissors. In fact, it looks a lot like Rock-Paper-Scissors, doesn’t it? In Rock-Paper-Scissors, each strategy loses to and beats one other strategy. In Jewish Poker, each strategy loses to and beats an infinite number of other strategies…
“‘As you like,’ I sneered, and could hardly keep back my jubilant laughter. In the meantime a fantastic number had occurred to me: Thirty-five!
‘Lead!’ said Ervinke.
‘Thirty-five!’
‘Forty-three!’
With that he pocketed the forty piasters. I could feel the blood rushing into my brain.”
So are all strategies equivalent here, like in Rock-Paper-Scissors? Can we pick “at random”? (Whatever that means…) That doesn’t seem right. Some strategies just dominate others. Surely “Ackermann of one billion, one billion” isn’t equivalent to “Negative one times Ackermann of one billion, one billion.” Yes, they’re both much smaller than infinity, but from experience, I can tell you: one will win you more games of Jewish Poker than the other.
Of course, maybe your opponent doesn’t know fancy concepts like the Ackermann function; maybe you’re just better at writing small. But those seem like silly constraints, independent of the game itself, forced upon us by our sad, physical existence. One could conceive of deities playing this game, deities that could conceive of any, any, number they wanted, unconstrained by the finite bounds of our universe, and somehow even they seem to have problems with this game. Every number is an infinitesimal grain of sand on the vast beach of infinity; every number is so, so much smaller than what could have been said.
And yet a winner must be declared…
“‘Listen,’ I hissed. ‘Then why didn't you say Forty-three the last time?’
‘Because I had thought of Seventeen!’ Ervinke retorted indignantly. ‘Don't you see, that is the fun in poker: you never know what will happen next.’
‘A pound,’ I remarked dryly, and, my lips curled in scorn, I threw a note on the table. Ervinke extracted a similar note from his pocket and with maddening slowness placed it next to mine. The tension was unbearable. I opened with Fifty-four.
‘Oh, damn it!’ Ervinke fumed. ‘I also thought of Fifty-four! Draw! Another game!’”
It’s possible to make versions of Rock-Paper-Scissors with more strategies, with each strategy losing to half of the other strategies and beating the other half. See Rock-Paper-Scissors-Lizard-Spock, for instance. (Like the original, except Lizard beats Paper and Spock and loses to Rock and Scissors; Spock beats Rock and Scissors but loses to Paper and Lizard.) There’s even a version with 25 elements. So is that what Jewish Poker is? The limit of these games, approaching infinity?
Well, no, because you can make games of Rock-Paper-Scissors with infinite elements and not suffer from Jewish Poker’s bizarre defects. Take, for instance, the following game:
-Each player says a number simultaneously.
-The number must be positive.
-If the difference between the two numbers is greater than one, the player who said the smaller number wins. Otherwise, the player who said the larger number wins.
-If the difference between the two numbers is greater than one, the player who said the smaller number wins. Otherwise, the player who said the larger number wins.
After a bit of thought, it becomes clear that saying numbers greater than 2 is pointless: You might as well have said the number you just said, but minus 2. (For example, don’t say 2.7; say 0.7. That beats everything 2.7 would have beaten, but avoids losing to 0 through 0.7 and 2.7 through 3.7.) And now we have a kind of “cycle,” looping back to 0 when it reaches 2, of an uncountably infinite number of different plays, each one beating and losing to half of the other plays. That’s what we really wanted to see, when we talked about Rock-Paper-Scissors with infinite elements.
“My brain worked with lightning speed. ‘Now you think I'll again call Eleven, my boy,’ I reasoned. ‘But you'll get the surprise of your life.’ I chose the sure-fire Sixty-nine.
‘You know what, Ervinke’- I turned to Ervinke –‘you lead.’
‘As you like,’ he agreed. ‘It's all the same with me. Seventy!’
Everything went black before my eyes. I had not felt such panic since the siege of Jerusalem.”
So what’s Jewish Poker then? Well, I don’t really know, but I’d say it’s probably a game best left to the deities.
“‘Nu?’ Ervinke urged. ‘What number did you think of?’
‘What do you know?’ I whispered with downcast eyes. ‘I have forgotten.’”
Subscribe to:
Posts (Atom)