Results filed under: “math”

@ February 8, 2013


This season, I made weekly predictions of Super Bowl, conference, and division odds for all 32 teams. Now that the season is over, I can evaluate how these predictions performed.

pred vs act occurrence.JPG

The predictions did reasonably well, but in general I tended to be overconfident in my predictions - that is, events were less likely to occur at the high end, and more likely to occur at the low end. There is no single bad-luck event I can point to. Baltimore winning the Super Bowl (and the AFC, for that matter), Washington winning the NFC East, and Denver winning the AFC West were all events which I viewed as highly unlikely either on (and other than Denver, I kept on viewing it skeptically right up until it happened). A further analysis points to exactly where the pain was.

pred vs error.JPG

Almost all of my error was concentrated in events which I predicted would occur between 0-5% of the time. Some of these I was quick to correct (preseason I predicted Atlanta would win the NFC South only 4.8% of the time, but that was up to 92% by week 4). Others it took me awhile to correct (my preseason odds for Washington winning the NFC East were 2.2%, but this was still as low as 3.8% after Week 12). Others I never corrected (in my final simulation after Wild Card weekend, out of 500 runs, Baltimore won the Super Bowl exactly zero times - my computer really hated Baltimore). Despite this late season error, I did get more accurate as the year wore on.

season quarter vs error.JPG

This data will be useful for calibrating my model. It also means that, next season, I should be more accurate. Or maybe next year a mediocre 3-6 team won't suddenly finish the season 7-0 and take the NFC East. (Sorry, still bitter.) (Go Giants.)



@ November 20, 2012


Up until two weeks ago, this space had been reserved for a weekly posting of fake LVH SuperContest picks and an update on Super Bowl standings. A run of... let's say poor performance took me out of the fake running, so I took a week to recharge and come back strong with some updated standings. Let's take a look.

week 11.JPG


What strikes me most since the last update is the disappearance of one-time runaway favorite, the Chicago Bears. The reasons for this are pretty straightforward: after spending 4 straight weeks atop the standings, they lost two in a row to the Texans and San Francisco, the last one via blowout. Green Bay, meanwhile, has gone on a 5-game winning streak to pull into a tie for the division lead. Not only is Chicago no longer the Super Bowl favorite, I now have them as a 2-1 underdog to win their division.

That leaves Houston as a narrow favorite, just edging out San Fransisco, for the Super Bowl lead. Houston just keeps winning and winning and winning, and any AFC team looking to knock them off is now likely to have to do it at Reliant Stadium. This stranglehold on the division, home-field advantage, and a first-round bye are what is currently keeping them separate from the rest of the pack of AFC contenders.

Denver, for their part, continue to be a study in how Bayesian statistics works. At the beginning of the season, I rated their chances of winning the Super Bowl at something not exactly equal to, but very close to, 0%. This initial position (bias, if you prefer) against Denver means that it took 8 weeks before I even start considering them as a contender. They have now finally reached a point where they can no longer be ignored.

@ October 17, 2012


Okay, I'm being coy, this is really just a hedge of a hedge. But here is where we stand.

We started with a freeroll $10 bet on the Yankees to win the World Series at 7/1. When the decisive game between Baltimore and New York came in round 1, I hedged my bet with a $8.83 play on Baltimore that lost. Then, before the ALCS started, I further hedged with a $19.29 play on Detroit at +105 to win the series.

With three consecutive losses, the value of my Yankees World Series proposition has significantly deteriorated, while my Detroit play looks smart. I currently calculate that the Yankees, from their current position, have a 4.5% chance of winning the World Series. Detroit, for their part, as a 91.5% chance of winning the ALCS.

(If you think that my odds are too high... well, they might be. The team leading a 4-game series 3-0 has won 30 out of 31 times, and yes I know what the one goddamn exception is jesus christ. That means the team down 3-0 has only won 3.2% of the time, yet I have them at a 4.5% chance to not only win this series, but the one after that as well. In all likelihood, the Yankees will lose this series, but I think that in general they are of a better caliber than the typical team that goes down 3-0 in a playoff series. Moving on.)

If the Yankees win tonight, those numbers change. The Yankees World Series odds improve to 8.3%, and Detroit's ALCS odds degrade to 84.3%. Now, keep in mind that I already hedged this Yankees bet with a $8.83 play on Baltimore, so some of the value has already been soaked up. With all that in mind... how much should I bet on the Yankees tonight?

Current value of my Yankees World Series ticket: ($70 x 4.5%) - $19.29 - $8.83 = -$24.96

Value if the Yankees win tonight: ($70 x 8.3%) - $19.29 - $8.83 = -$22.31

Current value of Tigers wager: ($19.29 x (105/100) x 91.5%) - $8.83 = $9.70
Value if the Yankees win tonight: ($19.29 x (105/100) x 84.3%) - $8.83 = $7.43

If I bet $Z on the Yankees at current price of -118, and they win, the total value of that win is:

(post-win WS value - current WS value) + wager winnings - (post-win ALCS value - current ALCS value) = -$22.31 - (-$24.96) + $Z x (100/118) + $7.43 - $9.70 = 0.85Z + $0.38

If they lose, then I am done and cash out with:

Detroit ALCS winnings - Baltimore hedge losses - Yankees hedge losses = $19.29 x (105/100) - $8.83 - $Z = $11.42 - Z

Finally, I have to take into account what I think the odds of the Yankees winning tonight is. I have them at 55% odds to win tonight. Let's bring it on home:

.55 x (0.85Z + 0.38) = 0.45 (11.42 - Z)
Z = $5.36

I should bet $5.36 on the Yankees tonight to maximize my potential profit.

If the Yankees win, I'll have the chance to do the same thing tomorrow night. I'm going to save the math until then, because I'm an optimist (yes, this means I'm optimistic about getting to do more math).

@ October 13, 2012


So the Yankees won last night. And it was awesome. CC finally had a big game for the Yankees in the playoffs, and it was wonderful to watch. More importantly, my Yankees World Series bet is still alive.

Yesterday, I talked about how I had $10 on the Yankees at 7/1 to win the World Series (I should have mentioned that this was actually a freeroll bet, so I didn't actually RISK the $10 - this would have changed the math). I hedged this bet with a $8.83 play on the Orioles at +180. Now we come to the ALCS.

To win my world series bet, two things need to happen:

- The Yankees have to win the ALCS against the Tigers

- The Yankees have to win the World Series against the national league opponent

The odds of the Yankees beating the Tigers are, in my opinion, 56%. The odds of them beating their national league opponent have gone up slightly since yesterday because the Nationals were a more formidable opponent than the Cards, so those odds are up to 53% (from 52% yesterday). That puts their World Series odds right now at 29%.

The Tigers, on the other hand, have a 44% chance of beating the Yankees. The odds were posted this morning for the ALCS as Tigers +105.

As I did yesterday, I have to figure out how much the value of my Yankee bet increases if they beat the Tigers. Since I figure they have a 53% chance of beating the national league representative, the Yankees World Series bet is worth (0.53) x $70 - $8.83 = $28.27, conditional upon them beating the Tigers.

Now let's put it all together. If the Yankees beat the Tigers, AND I have hedged my Yankees bet with a wager of Y, the value of my Yankees world series bet is $28.27-Y. There is a 56% chance of this happening, or 0.56 x (28.27 - Y). Conversely, if the Tigers win, I will pick up 1.04 x Y. In this case I also need to cover for my lost Baltimore hedge. There is a 44% chance of this happening. This side of the wager is worth 0.44 x (1.04 Y - 8.83). Solving for Y yields a proper hedge of $19.29 on the Tigers.

Let's take a moment to look ahead to the World Series. If the Yankees are in it, I will have spent $28.12 hedging my bet. There is still plenty of value in my $70 bet to come out with a positive advantage.

There may also be some additional opportunities to hedge later in the series once one team or the other reaches a 3 game lead in the series. Basically, at that point I will be making a sports credit default swap. 

@ October 12, 2012


Before the baseball season started, I made a purely emotional bet: $10 at the Yankees at 7:1 to win the World Series. Staring down an elimination game for the Yankees against Baltimore tonight, I have an important decision to make: how do I hedge my bet?

The idea about hedging is to have two bets that, together, have a positive outcome - a no-lose situation. Imagine that one sports book had the Yankees at +150, and another had Baltimore at +150. If you made both bets, you would guarantee 0.50 BU of profit no matter who won. The idea is roughly the same.

However, we can refine this by taking into account the odds of each outcome. Currently, I have a bet that pays me $70 if the Yankees win the World Series. However, to get there, three things have to happen:

- they have to beat the Orioles tonight

- they have to beat the Tigers in the ALCS

- they have to beat the national league team in the World Series

If we roughly figured that the odds of each event happening was 50/50, then the odds of them currently winning the world series would be 1/8 (1/2 x 1/2 x 1/2 = 1/8). My computer model that I use to guide my sports betting tells a slightly different story for each of those events:

- Yankees beat the Orioles tonight 58% of the time

- Yankees beat the Tigers 56% of the time

- Yankees beat the national league team 52% of the time (to do this one, I have to run through the odds of each national league team making the World Series, and then compare each one against the Yankees - spreadsheets are fun)

Taken together, this represents a 17% chance that the Yankees win the World Series from where things stand right now. A 17% chance of winning $70 is worth $11.90. In other words, if somebody offered me $11.90 or more in exchange for my Yankees 7/1 ticket, I should take it - if they offered me less, I should tell them to shove it (quick tangent: this is basically how that game show Deal or No Deal works - they have rednecks on because they can't possibly do this much math).

So how much do I bet on Baltimore tonight to hedge my bet? It's a little bit complicated by the fact that it's not a perfect hedge: the Yankees could win tonight but then lose in the ALCS or World Series, leaving both bets as losers. However, those future contests will also represent future chances to hedge and cover this loss as well.

Since I said that the Yankees have a 58% of winning tonight, that implies Baltimore has a 42% chance of winning tonight. The current moneyline is Baltimore +180. If I bet on Baltimore and the win, I get 1.8X (X being my bet size). If the Yankees win, then I need to deduct X from the expected value of my World Series bet. However, that also implies that they have already won tonight, so the odds of the ticket winning and that point increase to 29%, and the value of my World Series ticket becomes $20.40 - X. Still with me? 

So, I have a 42% chance of winning 1.8X, and a 58% chance of holding a ticket worth $20.40 - X. The expected value of the first position is 1.8X x 0.42 = 0.756X. The expected value of the second position is (20.40 - X) x 0.58 = 11.8 - 0.58X. My position is maximized when these two positions are equal, i.e. 11.8 - 0.58X = 0.756X. Solving for X tells me I should bet $8.83 on the Orioles tonight.

Now, lets say the Yankees win. Can I continue to hedge? I sure can. There is no line yet because the team to face them hasn't won, but let's say the Tigers are +100 to win a series against the Yankees. I already said I thought the Yankees would win that series 56% of the time. I can essentially do the same exercise, except now I have to take into account that my Yankees position is worth slightly less because of the hedge against the Orioles. Here's hoping I get a chance to do that math after tonight.  

@ October 11, 2012


I think I'm doing pretty darn good at this fake Supercontest thing. In fact, after another solid week, I tried to explain to Suzi how good I was doing. In doing so, I made the mistake of noting that you have to finish in the top 20 before indicating my current standing.

Then I said: "And out of 745, I would currently be tied for 50th! That's in the top 7% of all entries!"

Blank stare, followed by: "so you AREN'T in the top 20."


Last week: 3-2 (60%), Overall: 15-9-1 (64.6%), Fake rank: 50 (out of 745)

This week's picks:

IND +3
KC +3.5
NYG +4.5
OAK +8.5
BUF +4.5

week 5.JPG

New England retains the top spot after taking care of business in Denver. Philly loses to Pittsburgh, but still leapfrogs San Diego after their loss to New Orleans. And Atlanta finally appears on the list after a 5-0 start.

After running this model for a month now, I'm noticing that it takes some pretty wild changes week to week on Super Bowl odds. This is because it is a highly dynamic model that is sensitive to changes in the initial conditions.

The way each model run starts is by simulating each game of the season, and predicting winners and losers. It then seeds everybody based on NFL playoff tiebreaker rules and plays out the playoff brackets to determine a Super Bowl winner. So not only does this model tell me Super Bowl winner odds, but season win totals, division winners, and conference winners as well. Let's look at how our front runner, New England, has changed over the course of the season in each of these categories.

new england week 5.JPG


Starting with our win predictions, we see that in the preseason the model thought New England would win an average of 13.7 games this year. After 5 games and a 3-2 start, this has dropped to 11.8. However, their division odds have actually INCREASED from the preseason. They started at 91%, and have gone up to 95%. Why have they gone up if their expected win total has dropped?

This is where the importance of a dynamic model comes in. Division odds are not just a function of New England's performance, but the performance of the three other teams in the division as well. Pre-season, I was very bullish on Miami: the model predicted 10.7 wins for them. Now, they still figure to finish in 2nd place in the division, but their expected win total is down to 7.6. This drop by their nearest competitor has allowed New England to stay strong in the division.

This dynamic plays out on a larger scale at the conference and Super Bowl level. Relatively small changes in the initial conditions week to week play out as significant swings at the Super Bowl level.

The second part of judging a forecast is to look back at how it has done. At the end of the season, I will have made 18 predictions for each team (1 per week plus 1 preseason) that can be tested. However, because there are many more results than predictions, it may take a few years before I can have any confidence that this method is accurate predicting outcomes - and more importantly, how that level of confidence changes as we get closer and closer to the end of the season.

@ September 27, 2012


This week's fake SuperContest picks:

NO +7.5

TEN +12

CLE +12

WAS +3

MIN +6.5

Last week: 3-2, Overall: 8-6-1, Fake rank: 120 (out of 745), top 17%


First, an updated Super Bowl odds graph.

week 3.JPG

For starters, Philly and New Orleans have fallen out of the top 5, to be replaced by Baltimore and San Diego. Second, this is a good opportunity to revisit some pre-season bets..

Before the season, I proposed some futures bets for super bowl, conference, and division winners. As the season progresses, books will update some of these lines. This gives us the opportunity to revisit these lines and perhaps take advantage of some additional value.

In our original strategy, it was not enough for a line by itself to have positive outcome value, because these bets are all mutually exclusive - since only one team can win the super bowl, a winning bet on Pittsburgh also implies losing bets on San Francisco, New Orleans, et al. (Also implying a losing bet on New Orleans? Betting on New Orleans, apparently.) That is still true. This means that any new bets we make must meet that same standard - a winning bet must have a positive expected value even after all other bets are losers. With that said, here's some additional super bowl plays after Week 3.

Original bets: PIT 14/1 (4.06 BU), MIA 75/1 (0.54 BU), SF 9/1 (1.64 BU), NO 18/1 (1.12 BU), 7.36 BU total.

San Diego Chargers (25/1): 2.7 BU
Pittsburgh Steelers (20/1): 2.8 BU
Seattle Seahawks (30/1): 1.8 BU

Before we made these bets, a total of 7.36 BU had been wagered on the Super Bowl. This brings the total to 14.66 BU. The consequences of these additions is that some of our pre-season bets have become less valuable. Specifically, if SF and NO were to win, they are still positive, but just barely. The threshold for adding additional teams from this point forward will be that much higher as a result, i.e. it will need to make up for the fact that some pre-season bets become losers even if they win. You will also notice that we are putting additional money on Pittsburgh at 20/1. This is because additional Pittsburgh money does not cancel out our original Pittsburgh bet, so its easier to have a positive outcome. The second reason is that the odds have gotten longer, so even with the Steelers at 1-2 right now this looks like a chance to grab some more value.

We can run the same exercise on our conference wagers (new division lines have not been posted).

Original conference bets: SF 9/2 (3.74 BU), NO 9/1 (2.04 BU), MIA 30/1 (1.32 BU), PIT 6/1 (6.56 BU)

Additional conference bets:
SEA (14/1): 4.1 BU
SD (10/1): 3.6 BU
PIT (9/1): 3.8 BU
CAR (40/1): 0.7 BU

This will be the last time I add any NFC Conference teams, because I have essentially soaked all the value from my original SF bet - any more money on the NFC and it becomes negative even if it wins. There is still some headroom in the AFC for additional plays if they become attractive.  

@ August 2, 2012



A previous essay presented a methodology for optimizing bet size based on implied odds and betting advantage, balancing risk and profit. Risk, in that case, was narrowly defined as the risk related to "gambler's ruin", i.e. the risk of encountering a prolonged losing streak that will wipe out one's original stake. There is a second, equally important definition of risk which must also be addressed: the risk that betting advantage has been incorrectly calculated. To avoid confusion, I will refer to this as "uncertainty". Uncertainty has impacts for how betting advantage is calculated, which in turn impacts betting unit selection and the overall performance of a betting system. 


In my last post I explored the way in which implied odds from a moneyline and the calculated odds of a particular outcome can be used to calculate an optimum bet size to balance risk and return. Risk, in this case, was narrowly defined as the risk related to "gambler's ruin", a mathematical concept which states that a gambler of finite means that plays against a house of infinite means for long enough will encounter a losing streak sufficient to wipe out his entire bankroll. The smaller the bet, the longer the losing streak must be to wipe out the bankroll; therefore, the lower the risk. However, smaller bet also implies smaller return. The reduced return is essentially an insurance policy that you are purchasing to guard against gambler's ruin. As bets get smaller, this policy becomes more and more expensive in exchange for a smaller and smaller amount of insurance. Hence the need for balance.

There is another kind of risk, which, to avoid confusion, I will refer to as uncertainty: this is the uncertainty inherent in evaluating the odds of an outcome. "I'm 100% sure that the Giants are beating the Mets tonight" is an egregious example of ignoring uncertainty that gambler's employ on a day to day basis. However, the mistake does not need to be nearly that bad in order for the effects to be catastrophic. Let's look at an example.

In our example, the Giants are +100 against the Mets. Being smart bettors, we won't make foolish statements like the outcome is 100% guaranteed. But we do think that the Giants should have been a slight favorite in this game: rather than +100, they should have been -110. Put into terms of betting advantage*, we see an advantage of roughly 0.047.

*I defined betting advantage in my last post, but will do it again since the concept may remain unfamiliar. I define it as (calculated odds) / (implied odds) - 1. In this example, the implied odds from a +100 bet are 50%. The implied odds from a -110 bet would be 52.38%. 52.38% / 50% - 1 = 0.047.

Going through the approach I outlined yesterday, a +100 bet with a betting advantage of 0.047 would lead you to make a bet of 4.76% of your bankroll. I have plotted this point on the bet optimization chart* for a +100 moneyline (the big red X marks the spot):

figure 11.JPG

*For an explanation of this chart, see my previous post on betting unit optimization. The general idea is that for a given bet line and betting advantage, there is an optimum betting unit to balance risk and reward, which is what the black circles indicate.

Okay, so this, ideally, is the process. In reality, however, the data coming out of this analysis is only as good as the data going in. At the very top, I made a judgment call: that the Giants in this hypothetical matchup should have been priced at -110 instead of +100. Whether this analysis came out of a computer program or my gut instinct, the question is the same: what are the consequences of being wrong? Instead of -110, the proper price should have been -105. What are the consequences of this error?

figure 12.JPG

Whoops! My "optimal" bet of 4.76% was actually a slightly negative median outcome proposition (the median outcome is for my starting $1000 to end up at $960 by the end of the run). The real optimal bet here was not 4.76% of my bankroll, but actually 2.5% of my bankroll. Basically, I bet twice as much as I should have on this game by mistaking a -105 team for a -110 team against a +100 price.

On the one hand, this is not that big of a mistake. Missing a moneyline by 5 cents seems trivial. On the other hand, the model recommended betting almost 5% of your bankroll based on a perceived 10 cent miss by the house (or, if you prefer, the market). The issue of value cuts both ways. It isn't just the market that is capable of misevaluating teams, it is you. Having a healthy respect for the margins of error involved on both sides, and what that means for your betting approach.*

*much of this line of thought was inspired by reading a chapter excerpted on-line from the 2nd edition of Tim Harford's excellent "The Undercover Economist". The chapter covers the 2008 market collapse and how its roots can be traced back to relatively small miscalculations in the risks related to mortgage foreclosures. These small errors had huge consequences for the market because investors put too much faith in the models and bet too much of their bankroll on the mortgage market as a result. Here is a link to the Harford piece.

Selecting the optimal betting unit requires you to take uncertainty into account. Constantly evaluating your approach, and how it reflects the real world, is vital to understanding the risks you are truly taking. This is a two step process. The first is evaluating, on average, how close your evaluations match up with results. The second is understanding the uncertainty.

Part of my process is to continually track how my calculated odds match up with what really happened. In other words: of all the times I thought teams had a 65% chance of winning a game, what percentage of them actually DID win the game? If it is not close to 65%, then I need to make an adjustment.

figure 13.JPG

This is a chart of my predicted win % vs. actual win % for MLB. If my program were perfect, then the slope of the best fit line would be 1. Instead, I see a slope of 0.861. That means that my system tends to exaggerate the odds of a team winning a match by about 15%. Once this is known, it can be corrected for.

I can also estimate the uncertainty by looking at how much the variation over the range deviates from the best fit line. This is done by calculating the weighted standard deviation for the data set (I weight it based on how many games fell within each range; for example, I have 620 games in my database where my prediction was between 51% and 52%, but only 158 where it was between 72% and 73%).

Once I have my standard deviation (based on the data in the above chart, it is 1.69%), I can calculate a confidence interval. Selecting this confidence interval is yet another point of analysis that I will revisit at a later date. For now, I will simply share what confidence interval I use. Based on my analysis, the proper confidence interval for my system is 81%.

Because I am only worried about overconfidence (underconfidence may cost me money, but it doesn't put me at risk for negative outcomes, i.e. it is much cheaper than overconfidence), my confidence interval is weighted to one side. Here is the same chart as above, zoomed in and with a line to represent the bottom of my 81% confidence interval.


figure 14.JPG

Back to the example problem, of the Giants facing the Mets with a moneyline of +100. I think that the line should be -110, which translates to a predicted win percentage of 52.38%. Before, I pulled the trigger on a 4.76% bet. Now, before going to the betting window, I look at where this wager falls on my confidence interval.


figure 15.JPG

This analysis shows that, while I think the line should be -110, my error analysis indicates there is a 19% chance that the line may be as low as +107. In other words, instead of betting on San Francisco, the value may be on the Mets.

This does NOT mean I won't place a wager. What it does mean is that I will dial back its size. This level of uncertainty in the model restricts the size of my bets from 1% to 3% of my bankroll.

But what about when my model and the betting markets have a very large disagreement? You'll notice that this chart cuts off at a predicted win % of just over 70%. There's a reason I cut it here. This chart illustrates why.

figure 16.JPGWhen my computer program predicts win percentages above 73% it starts getting kind of... stupid. Or, in technical terms, when I include predictions above the 73% threshold, the coefficient of correlation drops from 0.88 (indicating high correlation between prediction and reality, even if the predicted win percentages are slightly too high) to 0.028 (indicating no correlation at all). Recognizing the limits of where your model breaks down will allow you to assess your limitations, and make improvements.


The impact of uncertainty and confidence on betting strategy has been discussed. First, the potential negative impacts of ignoring uncertainty in your models is illustrated. Then, an analytical method for analyzing, understanding and incorporating the uncertainty of a modeling approach, using my MLB model as an example, is presented.

Even if you don't use a computer program (and many excellent bettors don't), every time you make a bet you are explicitly assigning a probability of a particular outcome. If you don't go back and evaluate how your probabilities reflect reality, it will be very difficult to experience long-term success.

@ August 1, 2012



Through empirical analysis and Monte Carlo simulation, a proposed method for finding an optimal balance between risk and reward in sports betting is presented. The model assumes that the implied odds, as represented by the betting line, and the actual outcome odds of any given proposition are known. Risk, in this case, is not the risk associated with improperly assessing these odds. Rather, risk here is the risk of experiencing "gambler's ruin", a mathematical concept which states that, given a finite bankroll, a gambler playing against an opponent with an infinite bankroll, i.e. the house, will eventually lose his entire stake. The balance is finding a small enough betting size to minimize the risk of gambler's ruin without making the bet size so small that the money that is won becomes insignificant. 


In making any investment, there are two choices that have to be made. The first is what the investment should be (pick a side). The second is how much to invest. The same is true in sports gambling.

Selecting a bet size is all about managing your bankroll, which is another way of saying that its all about managing risk. Gambling is a constant struggle against a pervasive (but awesomely named) mathematical enemy: gambler's ruin.

The casino has two tools working against you. The first is one that everybody understands: the odds are tilted in their favor. The second is gambler's ruin. It's a very simple concept to understand. Let's play a coin flip game. Heads you win $1, tails I win $1. The only difference is I have infinite money, and you only have $10 bucks. Even though the coin flip is a 50/50 chance, this game will end with me having all of your $10. The reason is, once you lose your last $1 on the mathematically inevitable streak of bad luck, you don't have any more dollars to bet against me. That, in a nutshell, is gambler's ruin*.

(*This is why the idea of playing the roulette wheel and doubling your bet each time you lose doesn't work. Eventually you will go on a losing streak long enough to squash you - and because your bet doubles after each loss, the losing streak doesn't even need to be that long. Gambler's ruin!!)

Our example might seem trivial, but the implications are pretty staggering. To illustrate why, I'm going to use a technique called Monte-Carlo simulation. I'll select a starting bankroll, a standard betting unit, the odds of winning, and the payoff for that bet. Then I'll make that bet 6000 times in a computer (roughly equivalent to one season of baseball bets.) And I'll do THAT 1000 times, also in the computer (i.e. 1000 different baseball seasons). Then, out of those 1000 seasons, we'll see how many times I go broke before the season is over.

figure 1.JPG

In the initial example, I started with betting $1 with a $10 bankroll, which is a 10% betting unit. But what the chart above shows that, even if I dropped down to a 1% bet, ten cents, I'd still have a 20% chance of being flat broke before I got to the end of a season.

So, how do we bet on sports while avoiding gambler's ruin? Well, first of all, we don't make bets that don't have any value. We only want to make bets with positive expected outcomes. So let's change the scenario. I'm not going to change it much. We'll keep the payout at even money, but change the odds of winning from 50% to 51.5%. This has what I call a betting advantage (calculated or known odds of winning / implied odds* - 1) of 0.03.

*implied odds is what the odds of winning would have to be for the betting advantage to be zero. They are calculated as: 1 - (money won) / (money risked + money won). If the odds are +100, the implied odds are 1 - ($100) / ($100 + $100) = 50%. In the case of -200, the implied odds are 1 - ($100) / ($200 + $100) = 66%. In the case of -110, the implied odds are 1 - ($100) / ($110 + $100) = 52.3%. And so on.

figure 2.JPG

This relatively small change in winning % has a huge impact on going broke. A 1% bet standard goes from an 18% of busting after 6000 bets to less than 1 in 100. However, it is also true that reducing my betting unit will reduce my opportunity to make money. What we want to do is balance risk and investment.

Reducing our betting unit reduces our risk, but it also reduces our return, since we get paid less money on smaller bets. It follows that there should be an optimal betting unit based on risk, return, and betting advantage. Let's take another swing at our monte carlo simulation, with one modification: instead of keeping the absolute value of the betting unit constant, we will keep the percentage we bet constant instead. If we lose money, we reduce our betting unit, and if we win money, we increase our betting unit, such that we are always betting the same % of our bankroll with each bet. While this change technically eliminates the risk of "gambler's ruin" because our bankroll will never go to zero, it doesn't eliminate the risk of being left with no more than a few nickels to rub together with the wrong luck and too large of a betting unit.

figure 3.JPG In this case, we want to use the median value, NOT the average value, to evaluate the outcome. When evaluating bets that we will be making many times over, the average value is the right number to use. However, when evaluating a bet that can be made only once, the median value is a better reflection of the expected outcome - it is not skewed upwards or downwards by one or two highly lucky outcomes in the simulation.

The above figure shows the expected outcomes for our starting proposition: a 50/50 coinflip that pays even money. This graph shows that the maximum median outcome is with a standard bet of 0%, i.e. we should not make this bet. This result makes intuitive sense - there is no value to us here, so why would we ever make this play? Let's change the odds to be more and more in our favor and see what happens.

figure 4.JPG

Boy, some of those numbers got very big! In reality, we would never get there, because no casino would take a 5% bet of a $100M bankroll. However, theoretically we see where the maximum median value occurs. We also see one of the variables that impacts betting size emerge: how much advantage we have over the implied odds. There is a black line here which charts maximum median value, betting advantage, and % stake. We can combine these three variables into a two variable chart: optimum % stake and betting advantage*. Here's that chart.

figure 5.JPG *betting advantage is % odds / % implied odds - 1, i.e. (51.5%/50%) -1 = 0.02. In each of the median value graphs the lines charted will represent 0, 0.02, 0.03, 0.04, 0.05, and 0.06 betting advantage.

Another variable that impacts this calculation is what the implied odds are. Let's look at another version of the previous two charts, except instead of 50% implied odds, let's consider a +150 bet, i.e. 40% implied odds, and see how the figures change.

figure 6.JPG figure 7.JPG Compared to a +100 bet, a +150 bet with the same betting advantage requires a smaller bet for optimum risk/value balance - nearly half the size. This is because an underdog bet is inherently riskier; there is a higher chance of going on an extended losing streak that can wipe you out. We can do the same thing for a whole range of bets. In fact, let's just skip ahead to that right now.

  figure 8.JPG Each of these is a roughly linear equation, with a different slope depending on the implied odds. We can plot the value of these slops as a function of the implied odds. This will allow us to find a correlation that can be used to calculate the optimum bet size once the implied odds and betting advantage are known over the entire range of values.

figure 9.JPG The result is a roughly polynomial curve over the range of interest (it is very rare in baseball to see odds outside of the range of +200 to -200). We now have all the tools in place to create a mathematical formula that tells us how much to bet to optimize risk and value capture.

  figure 10a.JPG Recall, the implied odds are calculated as: figure 10c.JPG CONCLUSIONS

A methodology for calculating the optimal betting unit based on balancing risk and reward for betting moneylines is presented. Inputs to this formula are the implied odds as calculated from the moneyline, and the calculated odds, i.e. the betting advantage anticipated by the bettor. The analysis is backed up by some intuitive results that occur from examination of the fomrula:

- The bigger the favorite, the more money should be risked. The bigger the underdog, the less money should be risked.

- The larger the betting advantage, the more money should be risked.

- If no betting advantage exists, the only way to win is not to play.

The risk discussed herein is the risk of experience "gambler's ruin", i.e. going on a long losing streak such that your stake is wiped out. There is a separate risk; that is, the risk of mis-evaluating your betting advantage. This is a very real risk: just ask anybody who used to work for Lehman Brothers. This will be discussed in a future post.

@ June 26, 2012


Baseball gambling (and hockey gambling, but who cares) has a wrinkle that sets it apart from basketball and football. This is called the run line.

You'll surely recall that the money line dictates how much a winning bet on a particular side will earn, and will be seen as such:

Pirates +130
Phillies -140

(A quick reminder on money lines. The above lines indicates that a $100 winning bet on the Pirates nets $130 in winnings, and a winning bet on the Phillies nets $71.4. Ideally, this line means that 35% of the action is on the Pirates, and 65% of the action is on the Phillies. In the event of a Pirates win, Vegas pays out $45.50 of very $100 bet. In the event of a Phillies win, Vegas pays out...$45.50 of very $100 bet. The space between $50 (an even split) and $45.50 is the money that goes to Vegas. Although, as we have discussed, Vegas bookmakers are themselves gamblers, and therefore aren't afraid to take a side every now and then.)

A run line for this same game would look like this:

Pirates +1.5 -165
Phillies -1.5 +145

This means that, if the Pirates win OR lose by only 1 run, then that bet wins, and pays out $60 per $100 bet. On the other hand, if the Phillies win by 2 or more runs, then that bet wins and pays out $145 per $100 bet.

Now, I said that this idea is unique to baseball (and hockey, but seriously, who gives a fuck) but that's not entirely true. Football line makers do this all the time. One book will have the Patriots -7, and another will have them at -6.5 (-115). You get a line that's a half-line lower, but it pays out slightly less. You'll also sometimes have the opportunity to "buy" points on a line by paying extra juice. This is all part of the same idea I discuss below.

It is probably helpful to nobody but myself to imagine each contest as a bell curve of possible outcomes. Construction of a bell curve requires the definition of two variables, a mean and a standard deviation. The mean tells you where to center your bell curve, and the standard deviation tells you how wide or skinny the bell should be.

Let's consider the possible outcomes of this Pirates/Phillies contest as such from Vegas' perspective. The lines tell us that Vegas expects Philly to win 65% of the time. The lines also tell us that Vegas expects Philly to win by 2 or more runs only 29.5% of the time. These two variables can be used to solve for the mean and standard deviation. This is illustrated in the chart below.


rl analysis chart 1.GIFThe easiest way to understand this chart is to look at the point where the Pittsburgh run differential is equal to zero. This happens when the cumulative odds are at 65%. In words, this says "the odds that Pittsburgh's run differential will be less than or equal to zero, i.e. negative, i.e. a loss, is 65%". Similarly, we can look at the run line value of -2 and see that this crosses at 29.5%. "The odds that Pittsburgh's run differential will be less than or equal to -2, i.e. a loss by 2 or more runs, is 29.5%".

When we think about money lines, all we care about is how my odds of this line crossing zero might be different from what Vegas thinks. Let's say I think the odds of a Philly win are much higher - say, 82%. Since I don't care what the standard deviation is, I'll just use the same one. Our graphs look like this.

rl analysis chart 2.GIFBut can I bet on the run line based on this as well? I could certainly try it, assuming that Vegas has the right standard deviation. But why do that when I could just increase my bet on the side, since that is where I feel I have an informational advantage? Betting on the run line without knowing the standard deviation is betting in the dark.

Let's look at a different case. What if I think that the mean outcome Vegas has identified is correct, but I think their standard deviation is off? That might look like this.

rl analysis chart 3.GIFIf I was just betting the money line, I wouldn't see much opportunity for value here. However, at -2, Vegas assumes the odds are 29%, but I think they are more like 38%. Now we have identified an opportunity for a value play where one did not exist when we only considered the mean outcome.

Most people don't think in terms of means and standard deviations, I realize. You'll more typically hear a gambler say something like "8 of their last 10 losses have been by 2 or more runs." This is what they are getting at. I prefer a more structured statistical analysis. For either approach, having the right information is the key.

@ February 9, 2011

In which, after finding somebody's innovative work, I mock it as worthless.

Researchers are testing thermoelectric generators as a part of a system that harvests heat from an engine's exhaust to generate electricity, reducing a car's fuel consumption.[...] The first prototype aims to reduce fuel consumption by 5 percent, and future systems capable of working at higher temperatures could make possible a 10 percent reduction [...] The effort is funded with a $1.4 million, three-year grant from the National Science Foundation and the U.S. Department of Energy.
This technology would capture the heat from a car's tailpipe and convert it to electricity which, in future electric or hybrid cars, would be stored in batteries. For only $1.4 million dollars in investment, we can reduce fuel usage by 5 percent.


By the time this shit comes out, at worst, cars will average 60 miles to the gallon. A five percent increase would take this up to 63 miles per gallon. Or, looking at it another way, every mile would use 0.00079 fewer gallons. At future gasoline prices of $5/gallon, this will save you four-tenths of one cent per mile. If a car lasts for 150,000 miles, that's a whopping $600 saved over the life of the vehicle. To put that in perspective, the average driver will spend more than that on losing scratch-off tickets that will be lost under the floor mats of the car.

THIS KIND OF SHIT MAKES ME WANT TO JOIN THE TEA PARTY. Why did the government take $1.4 million of MY PERSONAL DOLLARS and give it to a bunch of Chinese-sounding researchers to waste on this shit that, even if it ever happens (which it definitely won't), will be as close to worthless as you can get without actually being Glenn Beck. I MOCK YOUR INNOVATION, PURDUE UNIVERSITY PROFESSOR XIANFAN XU!!

@ September 8, 2010

Maybe you like to watch sports or listen to rock music while you are on the treadmill, but I prefer to pace myself with Wheel of Fortune. Jogging in place while the wheel clicks away gives me time to think about the important things in life. Things like "why is this asshole buying a vowel when he must know the answer" and "you're spinning?! But you've got 12 grand in the bank and there's only one goddamn consonant left!!"

In fact, since Wheel of Fortune is a game, I've decided that it must have a definite optimal solution. Consider the puzzle below, one which I imagine even the reddest red state moron would be able to tease out:

Word_Puzzle.jpgOne vowel, 2 Bs, an L, a C, and a K are left. You've already got $8,000 in the bank, including an all expenses paid vacation to the Sandals resort in Jamaica and a shopping spree on to spend on human centipede merchandise. Do you spin or solve?

It really comes down to how much risk you can tolerate. Based on this wheel, and assuming that the probability of landing on each spot is equal and that the Lose a Turn spot is essentially the same thing as the Bankrupt slot (the guy with the lifetime NRA membership next to you is DEFINITELY solving this puzzle), we can calculate the expected value of your next spin. Then we can make a chart. That chart looks like this:

wofgraph.gifIn this context, a singleton is a letter of which there is only one, i.e. the C, L, and K. The twofer is the letter of which there are multiples, i.e. the B. The twofer has a higher expected value because you get money for each instance of the letter appearing in the puzzle.

In our example, even if you have $8,000 in the bank, a spin with a twofer in the board will net you an average value of nearly $700.

Now: is there opportunity cost associated with solving? That is, by solving now, not only do I lose the value of this spin, but of all future spins. Consider the example above again, except start with only $5,000 in the bank. The average value of that spin was $921, because I was risking much less money on a bankrupt or lose a turn spot. There are still letters left. What is the value of those future spins?

On Spin 1, I start with $5,000, and the average value of my spin, because there is a twofer left, is $921. However, if I want to know the value of future spins, that presumes that I did not land on the bankruptcy spots; i.e., the starting value of future spins is not $5,921, but rather the average value of all non-bankruptcy spots on the wheel, which is $730 (or $1,460 with a twofer).

On Spin 2, I would theoretically start with an average of $6,460, and only have singletons left. The average value of that spin is only $130. Additionally, my leveraging (that is the ratio of money I'm risking to money I'm potentially earning) goes from a reasonable 5.4:1 to an absurd 50:1!

Here's how the value of the second spin changes with money in the bank, assuming you will use the twofer on your first spin:

wofgraph2.gifThis graph shows that, with anything about $2,000 in the bank, you become what I would consider over-leveraged on your spin (greater than 10:1) and with more than $6,000 in the bank, your bet becomes a loser. It also shows that, in most cases, there is little to no opportunity cost lost unless there are multiple twofers or higher left in the puzzle once you've solved it.

This confirms the strategy that I've long assumed to be correct on the show: once you've determined the answer to the puzzle, you keep going until there are only singletons left or you exceed $10,000 in the bank, whichever comes first. Wheel of Fortune: SOLVED. Next, please.

@ March 9, 2010

If health care doesn't make it through congress, you can probably blame/thank (depending on your point of view) Rep. Bart Stupak (D-Mich) for voting against it and potentially taking a dozen other Democrats with him. Stupak and his like minded cohort are hung up on the issue of abortion. Specifically, government funding for abortion.

Follow along: if the government subsidizes your health care, and your health care provider subsidizes abortions, and somebody with that same health care provider gets an abortion, than the government paid for an abortion. Got it?

Stupak wants to make any health care provider that provides coverage for abortions ineligible for subsidy payments. This means that anybody who gets government subsidies (read: poor people) will not have their abortions covered by their insurance.

Complicated, right? Issues of abortion and poverty and government policy all wrapped up in one distasteful political mess. Allow me to make it more complicated for you by asking this question: what is the cost of an abortion, anyway?

Here's the dirty little secret of the insurance industry (okay, well, not THE dirty little secret, one of probably countless dirty little secrets, each one filthier and more vile than the last, but whatever): its cheaper to pay for an abortion than for a delivery. And its not even close. A first trimester abortion costs ten times less than an actual baby.

There's a concept in financing called capital offset, where the cost of an upgrade is not compared against spending zero dollars, but instead is compared against some minimum amount you have to spend anyway. If you have a house, you aren't necessarily going to run out a buy a new water heater because the one you have is inefficient. However, if the water heater explodes, you have to buy one anyway, so now you can look at the cost of the cheapest available water heater as a capital offset towards the purchase of a new one.

Well, once you get pregnant, should the cost of an abortion be compared against zero? Or is your water heater already broken? That baby is coming out one way or the other. What does it mean to "pay" for an abortion when abortions cost less than the alternative?

@ January 18, 2010

After yesterday's football results, three players remain out of 16 in the $50 buy-in suicide pool Suzi and I are participating in this year. Two of them are me and Suzi. The third is Suzi's boss, Colin. The rules of the pool are simple: you must pick a winning team to stay in it each week, and you cannot pick a team twice. Last man standing wins, with 2nd and 3rd place prizes also given out. The pool of teams which could be selected from was reset for the playoffs.

I claimed to Suzi that there was an optimal, clearly correct course of action to be taken. She resisted, saying that the facts were not all in yet. What follows is a wordy, esoteric, and ultimately pointless exercise in calculating the odds and value of each possible selection and outcome. However, there will be tables. So that's something to look forward to.

@ November 16, 2009

In yesterday's epic and, at least for Patriots' fans, calamitous matchup between the aforementioned Pats and the Indianapolis Colts, Bill Belichick did the stupidest thing ever done by a head coach in the history of the world. At least, that's what I've heard. Take it away, designated stand in for stupid opinions about football everywhere, Peter King:

Belichick was talking to Brady on the sidelines. I was sure they were talking about trying to draw the Colts offside with a hard count; there was no way he'd be authorizing going for it on fourth down. But back went Brady to the field, and he lined up in the shotgun, and started calling signals without the head-bob you normally associate with trying to draft a team offside.

"My God,'' I thought, "he's going for it!''

Two things had to factor in here. One: Belichick didn't want to give Manning the ball with two minutes to go; he'd just seen Manning take the Colts 79 yards in six plays for a touchdown. Two: He trusted Brady to get two yards. Let's place the odds of Brady getting two yards at 60, 65 percent. The odds of Manning going 72 yards to score a touchdown in less than two minutes ... that's maybe 35 percent.

You might say Manning's chance of taking his team 72 yards are better than 35 percent. Not sure I would.

Oh shit, Peter King is trying to do math. Here, put those numbers down before you hurt yourselves, and let the professionals try it.

The goal of any decision is to select the most optimal one with imperfect information. We typically do this by assigning percentages. Peter King has started down this path, but got halfway down it before he got distracted by a shiny object in the woods. Look out Peter King! That's a bear trap! NOOOOO!!

Once you are done gnawing your leg off, take my hand. I'll lead you the rest of the way.

@ September 3, 2009

Whatever your position is on the death penalty, you'll probably admit that the killing of an innocent man by the State would be a tragedy. If you are a regular reader, you'll no doubt be unsurprised to hear my position on the issue.

Let me pause briefly to comment on the irony that I expect there is great intersection between those that find the government incapable of providing health care (life) but perfectly capable of administering capital punishment (death). Moving on.

The horrible irony of the anti-death penalty movement is that the best thing that could happen for the cause is for a man who has been executed to be proven factually innocent after the fact (there's even been a movie about it. Seriously!) In the latest issue of The New Yorker, David Grann profiles what may be just such a case.

Do yourself a favor and read the whole thing. But whether or not the case of Cameron Todd Willingham turns out to be the case that changes the debate about capital punishment in this country, about certain things there can be no doubt. Probability dictates that the United States has unquestionably, at some time in its history, executed an innocent man.

@ August 15, 2009

This popped up on Twitter last Tuesday, but didn't come to my attention until yesterday:

Nissan Leaf = 367 mpg, no tailpipe, and no gas required. Oh yeah, and it'll be affordable too!
This message was obviously aimed right at the stomach of Chevy Volt's announcement of a 230 MPG rating from the DOE. Unfortunately it missed, and instead went right into the logic center of my brain, causing it to rattle and spark. This cannot be true, I thought.

Truth begins to reveal itself in the weasel wording of the next message from Nissan, posted about 90 minutes later:

To clarify our previous tweet, the DOE formula estimates 367mpg for Nissan LEAF.
Which begs the question: what is the DOE formula for estimating miles per gallon for an electric vehicle?

If you are thinking you are not interested in reading this, or think its going to be too long or boring, I cannot stress enough how much you should finish this, and how upset you'll be when you are done. Think of this like an M. Night Shyamalan movie: its going to have a twist ending that will leave you confused, angry, and possibly both.

@ August 13, 2009

Since Chevy announced that the Department of Energy has anointed the forthcoming Volt with an official efficiency rating of 230 MPG, I have been methodically picking apart the methodology by which this rating was determined. By my reckoning, based on information made public by Chevrolet, the most optimistic rating that should be given to the vehicle is 185 MPGe (that Ge is short for gallon of electrons, the unit of energy I invented to compare the efficiency of electrically powered cars to gasoline powered ones.)

By advertising that the vehicle will get 230 MPG, Chevy is obscuring the true cost of operating the vehicle in both environmental and economic terms. More importantly, they are setting themselves up for a public backlash when people actually start driving the thing and find out most determinedly that they will not get 230 MPG. We know this because the same backlash happened with the Toyota Prius. Except instead of seeing a drop from 65 to 40 MPG based on driver behavior, Chevy Volt owners could see a drop from 230 MPG all the way down to 60.

Or maybe not. It's possible that this backlash will not occur, since in order to determine the fuel efficiency, people need to drive in. And in order to drive it, somebody will need to buy it. And the best estimate is that it will cost $40,000.

Forty. Thousand. Dollars.

How many people are going to line up to buy an experimental $40,000 car? I honestly don't know. But here's a question I can answer: if they do buy it, will it be worth it?

@ August 12, 2009

[Part one is here.]

Yesterday, I stated repeatedly that miles per gallon is a stupid way of rating a plug-in electric hybrid like the Chevy Volt, which is now claiming an EPA estimated 230 MPG for city driving. Let's take this apart one piece at a time.

1) In a gasoline car that gets 30 miles per gallon, you can drive 30 miles and use one gallon of gas. In the Chevy Volt, based on our estimates of 40 miles of electric range and 50 MPG on gasoline backup, you will actually consume 3.8 gallons of gasoline if you drive 230 miles.

2) The EPA rates gasoline engines for city and highway driving for two reasons. The first is that city driving involves idling, which consumes fuel while not actually moving. The second is that the efficiency of gasoline engines varies with speed. However, electric motors have much more forgiving efficiency-speed curves than gasoline engines, and do not need to consume energy while idling. If you drove 100 miles on the freeway or 100 miles in the city, there will be little difference in how much fuel you've consumed.

3) Rating the engine based on gasoline consumption alone ignores the cost and environmental impacts of the electricity consumed during the first 40 miles of travel. Just because you've used no gas after 40 miles doesn't mean you haven't used energy, spent money, or emitted carbon. Its electricity, not pixie dust.

And its this last point that is most important. What is the fuel efficiency of the electric batteries? And how does this compare to the fuel efficiency of a gasoline engine?

@ August 11, 2009

General Motors announced today that the Chevy Volt plug-in hybrid car has received a 230 MPG rating for city driving. Compared to the 40-60 MPG boasted by today's high-performing hybrid vehicles, it is in another league. But even more importantly, it is a stupid, stupid way to rate the efficiency of a plug-in vehicle.

In a hybrid vehicle, batteries are used to store and recapture energy that is otherwise wasted during braking and coasting. The result is a more efficient use of the energy stored in the gasoline. Even though there is an electrical component to the utilization of the energy, gasoline remains the sole energy source. That's why MPG makes sense as an efficiency rating for hybrids. When you can plug in your vehicle, this is no longer the case. Electricity comes from the grid, gasoline from the pump; you have a dual fuel vehicle. Moreover, the energy is not used at the same time. Stored electricity is consumed before any gasoline. So, why would you rate a vehicle on miles per gallon if it need not use any gallons at all?

The answer is marketing. And 230 miles per gallon is a pretty nice marketing chip for GM to have. But what does it mean? And here is today's question: How did they come up with that number? I'm not exactly sure, but I have a pretty good guess.

@ April 20, 2009

OC tipper yaworm writes (for, it would seem, the express purpose of enraging me):

Courtesy of the Wall Street Journal Online, the plight of $250,000/yr households finally has a voice.  If nothing else, read the second to last paragraph ("For the Parnells..."). Math!
The paragraph is reproduced for you here:

For the Parnells, their perception of themselves is based on the math. The value of their house is down $60,000. Ms. Parnell says the couple's gross income last year was about $260,000. Taxes, premiums for medical care and deductions for Social Security and their 401(k) contributions cut the gross to about $12,000 per month. The family tithes $1,300 a month at their church. Their mortgage, second mortgage and payment on land they bought is nearly $4,000 a month. Other expenses, including their family car payment, insurance and college funds, as well as basics like food, utilities and donations to charities, leave them with about $1,200 left over each month.
Only $1,200 left over each month after every tax has been paid, 401(k) contribution made, mortgages (plural) paid off, $1,300 given to their church, and all other mandatory expenses, including car payments, college funds, food, utilities, and other basics like donating to charities! Only! ONLY!! DO YOU KNOW WHAT ONLY MEANS YOU DOUCHE!

See... okay, I should calm down. Remember that scene in Pulp Fiction, when they had to shoot Uma Thurman directly in the heart with a shot of adrenaline? Well, if ever I'm in cardiac arrest, and you don't have a needle full of adrenaline handy, just read me that paragraph. I will instantly spring to my feet and punch you in the face.

@ April 2, 2009

Tesla Motors has finally unveiled their Model S, an all-electric sedan.  This is the long-awaited follow-up to the Tesla Roadster, their souped-up all electric sports car (with the souped-up price tag to match) that made a splash on the red carpet at the 2007 Oscars, and was never heard from again.  A work colleague asked this question:

Can someone help me understand how charging an electric car with power generated from a coal-fired plant is a good thing? I understand that CO2 emissions from gasoline internal combustion engines are less than coal-fired power plant emissions.  I get the part about buying oil from foreign countries, I'm just talking about net-net emissions.
Ignoring for a moment that this person with an engineering degree was unable to do the math themselves, let's take a look.

@ March 6, 2009


"A 63-year-old attorney based in Lafayette, La., who asked not to be named, told that she plans to cut back on her business to get her annual income under the quarter million mark should the Obama tax plan be passed by Congress and become law.

"We are going to try to figure out how to make our income $249,999.00," she said."

Current marginal tax rate for the highest earners: 33%

Proposed marginal tax rate for highest earners in the Obama plan: 36%

Before the math, a hypothetical: does this constitute class warfare? Find the answer at the end of the column.

Now, a math question. You earn $255,500, placing you in the top tax bracket of 33%. The rates for this bracket increase to 36%. Barring any other changes in the tax code, how much does your tax bill increase?

Here is the math that people like Unnamed 63-Year-Old Attorney appear to be doing:

$255,500 * (36% - 33%) = $7,665

Oh god! That brings you below $250,000! That means you are being penalized for making more! Class warfare! CLASS WARFARE!!

Here is the problem: you, Unnamed 63-Year-Old Attorney, are an idiot. I hope for the love of god you aren't a tax attorney. Here is how the math actually looks:

($255,500 - $250,000) * (36%-33%) = $165

That's right, boys and girls: the money you earn gets taxed based on the bracket it belongs in. An example: If the tax rate up to $50,000 is 20%, up to $100,000 is 25%, up to $250,000 is 30%, and over is 35%, then people who earn over $250,000 get their taxes calculated, not like this:

Income * 35% = tax bill

It gets calculated like this:

$50,000 * 20% + ($100,000 - $50,000) * 25% + ($250,000 - $100,000) * 30% + (Income - $250,000) * 35% = tax bill

The thing is, I'm betting all of you know that, because you aren't learning disabled like Unnamed 63-Year-Old Attorney. The real question here isn't how to solve the math problem, but rather: why do we have a news story from a major outlet like ABC News about people like this that isn't focused on how they are retarded and our underfunded educational system has failed them? It's like reading a piece of hard-nosed investigative journalism about where did Frankie's ball go. IT IS UNDER THE COUCH FRANKIE.

(The answer to the hypothetical: 36% tax rates only quantify as class warfare if you believe that we were engaged in class warfare during the 1990s before the Bush tax cuts. But the politics are really a story for another day.)

(Okay, this reminds me of something else: last time I was home during the day, I was watching an episode of Maury where a man vehemently denied paternity of his girlfriend's child because she was unfaithful to him. Right before they cut to his testimonial video, she shouts at him, "Yeah but it was with a woman!" and his face, which is on a big screen right behind Maury as he tosses to the video, is completely stunned: "Oh I didn't know that" he mutters right before we get a video telling us all about he ain't the father of DeShawn. He spends the rest of the segment feeling incredibly contrite and embarrassed as Maury goes through the motions before revealing that YOU ARE THE FATHER. That's what should have happened to this story: the reporter should have told the attorney that the tax increase would only apply to that portion of their earnings above $250,000, followed by a quick, embarrassed, "Oh I didn't know that.")

@ February 26, 2009

I have started studying for an important professional certification exam, the Fundamentals of Engineering test.  I will be sitting for the exam in April.  To pass the test I am going to need to bury myself in pretty much everything I learned in 5+ years of college, including things from freshman year that I didn't really pay attention to and some stuff I'm not entirely convinced I actually learned in the first place.  Only 5-10% of what is on the test includes things that I use with anything that even resembles frequency as a working engineer.  This is why engineering certification exams are stupid.

But, I want to continue growing as a professional (read: get money, get get money) so I will study, and practice, and bitch about everything I learned, forgot, forgot I knew, and now need to learn all over again.  Today's topic, mathematics.  So, here's some shit I forgot I knew.

L'Hopital's rule.  Has nothing to do with hospitals. Last seen: freshman year, Calc 2.
Cross product and dot product. Last seen: junior year, Dynamics.
Conic sections. Motherfucker! I haven't seen these since high school.
Integration by parts. Freshman year, Calc 2 again.  I remember that these things existed, but completely forgot how to do it.
Taylor Series.  Freshman year, Calc 2 (and by the time we got here, I had mentally checked out on the course, which I did alot in freshman year).
Trig identities. You know, I'm really starting to wish I'd paid attention in Calc 2...
Complex numbers. Junior year, Signals and Circuits class.
Laplace transforms.  Junior year, Signals and Circuits.
Differential equations. Okay, I used these alot in graduate school, but not once have I had to solve a goddamn differential equation at work. Is there such a job? Where you sit at a desk, and somebody pays you to solve differential equations? And how long do people typically work at this job before they kill themselves?

One section down, another dozen to go.

@ February 18, 2009

It figures that, two days after celebrating my 1000th mile on the electric bike, I would be celebrating my third blown tire.  The previous two blown tires were the fault of the sharp objects that had been allowed to lay in the bike lanes of Houston.  This blown tire was my fault, a result of adding too much pressure.  But it also presented me with an opportunity to consider how great an investment this bicycle actually was. No, seriously.

When evaluating an energy-saving project, there are two ways to go about it.  The first is called "simple payback" - you calculate the amount of energy you'll save each year, and the cash value of that energy.  Then, you divide the total cost of the project by this amount.  The result is the number of years it will take for you to recoup your investment.  This is the analysis I did two days ago in evaluating how long it will take to recoup my bicycle investment.  I came up with a simple payback of 3 to 4 years.

A more complete analysis will include, among other things, the cost of operations and maintenance.  In this case, the operations are free (unless I decide to get myself a driver) so I only need to consider the maintenance costs.  Over the first 4 months of bike ownership, I have spent $100 on repairs, including today's expected $30 bill and the $30 I spent on a new bicycle pump. 

Now for car maintenance savings: for 2008, the IRS reimbursement rate for business vehicles was 50.5 cents per mile.  Over 1000 miles, that amounts to $505, including fuel and maintenance costs.

At that rate, I'll have the bike paid off in less than a year and a half.  Hmm.  Maybe I should have included O&M costs in my original analysis after all.

@ February 16, 2009


I'd be generous in saying that my car gets 25 mpg on my commute, but it sure makes the math easy. I've saved 40 gallons of gas (a little over 3 tanks).  At an average cost of $2/gallon, I've saved nearly $80 in 4 months of biking.

To recoup the entire $2000 investment in the bike (since I'm excluding maintenance savings in the car, I'm also excluding maintenance costs for the bike), I'll need to go 10,000 miles at today's gas prices.  So I'm on pace for a payback of between 3 and 4 years.  Or gas could go back up to $4/gallon again.  That'd be... nice?

@ February 10, 2009

Fact: There was more sea ice, measured in total area, in December 2008 than December 1979.  Aha! Sea ice has actually increased from December 2008 to December 1979. Therefore, that means that global warming science is wrong, and it was bullshit all along. 

That is the argument made in this Daily Tech article, titled Sea Ice Ends Year At Same Level As 1979.

But you, dear reader, having a healthy skepticism, suspect there might be some monkey business in these numbers.  And you, dear reader, would be right.

What monkey business exactly? This monkey business. I'm not going to even try to summarize that article, because it lays out the embarrassing facts more succinctly than I could ever hope to summarize.  Instead, I will say: this is why you should be paying attention in math and science class, boys and girls.  Otherwise, you grow up to be a fool.

@ December 22, 2008

On Friday, I accused Drew Carey of retroactively ruining my childhood with his incredibly underwhelmed reaction to an exactly perfect bid on a showcase.  OC tipper Jim accuses that bidder of cheating:

"While it is legal to hear bid ideas from audience members, on that September 22, 2008 taping, CBS Standards and Practices and host Drew Carey were both suspicious of some audience members during the bidding. As a result, there was a 45-minute shutdown between the Showcase presentation and reveal on that taping. Some in the audience noted Carey's cold, subdued reveal of what should have been one of the show's most historic moments was related to the suspicion that the production staff had on the win."

So what of it? Did Terry Kneiss, the Perfect Bidder, actually cheat?

Presumably, the only evidence of cheating is the bid itself.  Perfect.  Also, incredibly unlikely, as revealed by the fact that nobody had ever done it before.  But is this evidence in and of itself incriminating enough?

Jim, in his comments, notes that there have been previous winners who were as close as $1 to the actual retail price.  I would also make the following observations:

- If Mr. Kneiss had previous knowledge of the bid prices, I would expect him to bid slightly under the actual retail price, rather than the exact retail price, for fear of drawing suspicion on himself.  Why risk an exact bid?

- Mr. Kneiss was in the second position, meaning he could not know ahead of time which showcase he would be bidding on.  He would then have needed advanced knowledge of both showcase prices.

Instead of using the bid as prima facie evidence of Mr. Kneiss' guilt, let's examine that claim further.  What are the odds of getting a showcase bid exactly right?

For this analysis, we will make some assumptions.

- Any person getting to the showcase showdown will be a reasonably skilled bidder. As such, his bids will generally be within +/- $10,000 of the actual retail price.

- Bidders are much more likely to bid a round number (say, $25,000 instead of $25,162).  I will estimate that 3 out of 4 bidders guess round numbers. 

If a typical Price Is Right showcase bidder is able to get within a $20,000 range of the actual retail price, that makes the initial odds 1 out of 20,000 that the bid will be exactly right.  If we further weight the bids such that a round number (say, $1000 increments) are more likely to be bid by a 3:1 margin, the odds drop.  If, say, the value is $25,162, and there is only a 25% chance you will even bid a number that is not an increment of $1000, then the odds shift accordingly, from 1 in 20,000 to 1 in 80,000.

These are long odds, but they are not ridiculous.

Consider: there have been 7,000 episodes of the show taped so far, with 2 showcase bids each show, for a total of 14,000.  That is 14,000 chances for an exact bid. 

Every instance there is a bid, the odds are 79,999 out of 80,000 that it will not be exactly right.  If this process 14,000 times, the odds of no exact bid ever occuring are:

(79,999/80,000)^14,000 = 84%

That means that, after 14,000 instances, there is a 16% chance that an exact bid HAD occurred.  Unlikely, but not zero.  Any event which has a non-zero probability of happening, however small, will eventually happen if given enough chances.  That is why, despite odds of 100 million to one against, somebody eventually wins the Powerball after enough tickets are sold.  Terry Kneiss is the vessel by which the hands of fate showed The Price Is Right viewers the power of infinity. 

And Drew Carey? That motherfucker RUINED MY CHILDHOOD.

@ July 21, 2008

Back in April, I (and anyone else who could count) just about dropped a brick when Hillary Clinton and John McCain both suggested that the pain of high gas prices could be alleviated if we just stopped taxing the stuff for a little while. It is obvious in retrospect that Hillary was experiencing the death-throes of a presidential campaign, and John McCain... well, I think I've made myself clear on this subject.

Fortunately, even the most math-challenged among us were able to see that the promise of an extra $30 bucks was not worth the $10 billion shortfall in the fund that finances highway maintenance and repairs. 

As it turns out, not only was a gas-tax holiday completely insane, but the gas-tax may actually have to go up:

"As motorists cut back on their driving and buy more fuel-efficient cars, the government is taking in less money from the federal gasoline tax.

The result: The principal source of funding for highway projects will soon hit a big financial pothole. The federal highway trust fund could be in the red by $3.2 billion or more next year."
I'll be the first to admit that any major change in the status quo was bound to have some growing pains, and this looks like a doozy.  The federal gasoline tax, as you may recall, is 18.4 cents per gallon (24.4 cents on diesel fuel).  So, as we start driving less or switching to more fuel efficient vehicles, the number of gallons consumed goes down, even though the total amount being spent on gas compared to recent years may remain steady or even continue to climb.  Because the tax is per gallon, fewer gallons means less taxes, regardless of the total amount spent.

So what are we to do? We're definitely in a tight spot.  As a result of decades of car culture, the United States has a vast concrete infrastructure to get those vehicles around.  Short term, I don't see anyway around it: bills have got to be paid. 

Here's the problem: Should the gas tax be raised? And if so, by how much? Let's break it down.

How much less is everyone driving?

Back in April, we assumed the average American was consuming 500 gallons per year.  Obviously, that number has gone down, since, well, that's the whole goddamn problem. 

Ignoring the whole diesel thing for simplicity's sake, the gas tax is 18.4 cents per gallon.  If we're $3 billion short, that translates into roughly 16 billion gallons, or about 45 gallons per person.  Obviously, some large portion of this money is coming from commercial use.  If we assume half, cause I'm too lazy to try to look it up, we'll say every person is using 25 gallons less in the next year.  That would translate into a 5% reduction in gasoline consumption.  If it's true, that is pretty fantastic.   

How much would the tax need to be increased to make up the difference?

While I'm all about facing reality, it also seems clear that the only politicians to suggest raising the gas tax at a time when people are absolutely losing their minds every time they fill up are the ones that don't want to be re-elected.  Fortunately, I have declared myself ObscureCraft President-For-Life, so I'm free to explore this possibility.

If we assume our 25 gallon per person reduction annually is roughly correct, then we need each person to pay the same on 475 gallons as they would have on 500 gallons at 18.4 cents.  This comes out to... 19.4 cents.

Yup, we need to increase the gasoline tax by about a penny to make up the difference.  Let's assume a margin of error and that gasoline costs will continue to grow down, and make it 3 cents. 

Holy shit, does nobody have the cajones to suggest raising the tax by 3 cents? Or am I just such a tax-and-spend liberal that I can't see the forest for the trees? Somebody please help me out here.

If not the gas tax, then what?

I honestly can't get over the fact we're spending $1 billion a month to fuck up Iraq while we search through the couch cushion for the loose change to keep our country intact.

Irony aside, the money is going to come from somewhere.  We're either going to raise the gas-tax, invent a new tax and call it something else, or go into debt to pay for it.  Highways don't grow on trees - although they do sometimes collapse onto them.

@ July 14, 2008

Or, put it another way: "Bush to lift executive ban on offshore oil drilling"

It occurs to me that the "Word Problems" feature may seem as a way for me to apply my lefty-leaning politics to current issues under the guise of objectiveness, Sophie cheating at battleship notwithstanding.  If it appears that way to you, might I suggest: my choice of topic certainly comes out of my tree-hugging commie bias, but numbers be what they be, motherfucker.

So: should we get drillin'?

Guidance from our politicians on this issue is shaky at best.  Bush has been pro-drilling for about as long as he's been the son of an oil-millionaire - difficult to accept his opinion on face value, even if he wasn't, you know... stupid.

(Quick aside: I don't think Frank Caliendo is funny, but isn't it amazing that DirecTV is actually using his impression of the president as a fool who is astonished by the functioning of a television remote as a way of promoting their product? Has anything ever happened like that before with a sitting president?)

(Jesus Christ.  2 terms, people.  Anyway, where was I...)

So instead of looking to the current pres for guidance, let's look at the stances of the two politicians looking to replace him.  John McCain was long an opponent of offshore drilling, but has recently changed his stance to pro-drilling.  However, as you heard here first, McCain has recently been dried and hollowed out so that George Bush can crawl inside and control his actions like the alien in the first Men In Black movie.  So, we can't trust him.

Obama is anti-drilling, but, as a secret Muslim, he would obviously take that stance since increased oil production stateside would interfere with the operations of his Arab overlords.  Can't trust him, either.

No choice - we have to go to the numbers. (Note: if you don't actually want to see the numbers, just skip to the end.  Srs bizness!!)

Unless you are an oil company executive, your decision on a pro/anti drilling stance should be made on whether or not you think taking these actions will help bring down the price at the pump.  Let's break it down: the question of "should we drill offshore and in the Alaskan National Wildlife Reserve (ANWR)" becomes "how much more oil will we get, how much will that bring down the cost of oil, and how much does the price of oil affect the price of gasoline?"

How much more oil will we get?

In the ANWR, about 10.5 billion barrels. Peak oil production would be 800,000-900,000 barrels a day... sometime after 2020.

Offshore, about 16 billion barrels would be opened up. Peak production would be on a similar scale and timeframe.

How much will that bring down the cost of oil?

I'm not an economist, and I don't feel like building a supply-demand curve to figure this out the right way.  So, I'm going to fudge a little bit.

The US currently consumes 20 million barrels of oil every day, give or take. Let's give the ANWR and offshore fields the benefit of the doubt, and say we'll get a total of 2 million barrels of oil every day, once they hit peak production - this will happen many years from now, but, again, I'm going to make this simple, so let's assume it happened right now, today.  Oil costs $140 per barrel.  If there was an extra 2 million barrels on the market, let's say this drops the price of oil by 10%. 

How much does the price of oil affect the price of gasoline?

Why, that is an excellent question.  Thank you for bringing it up!

To determine this, we will explore some historical prices.  Let's look at the national average price of both oil and gasoline today, 5 years ago, and 10 years ago. (Costs are per barrel/per gallon)

2008:  $140/$4.12
2003:  $28/$1.78
1998:  $12/$1.17

From 98-03, oil went up by a factor of 2.3, while gas prices went up by a factor of 1.5.  From 98-08, oil went up by a factor of 11.7, while gas only went up by a factor of 3.5. 

On other words: the price of oil goes up much faster than the price of gasoline.  Whaaa? That's right: there are other factors in the price of gasoline other than how much the oil costs.  A 10% reduction in oil cost does NOT translate into a 10% reduction in gasoline costs.  Refinery costs and capacity make up a very large part of the cost of a gallon of gasoline (that is why after Hurricane Katrina, gasoline prices spiked dramatically - refining capacity nationwide was hit hard by the storm, in addition to some black people.) 

From a typical barrel of oil, depending on the refining process used, you get 20 gallons of gasoline (the rest of the oil goes to make jet fuel, heating oil, and the salve Dick Cheney soaks in every night to stay alive).  At $140 per 42-gallon barrel, oil costs $3.33 per gallon.  Reducing the cost of oil by 10% would result in a per gallon of oil savings of about 33 cents per gallon.


If the ANWR and the Gulf Coast fields were at full capacity today, we'd save something like 30-40 cents on every gallon of gasoline.  Of course, full capacity won't be reached for 10 years at the earliest - who knows how high the price of gasoline will be by then.  30-40 cents will be a drop in the bucket against $6-7 per gallon. 

At $140 per barrel, though, there is money to be made.  Offshore drilling becomes profitable at about $60 per barrel.  With a profit of $80 per barrel, the oil in the Gulf alone is worth $1.2 trillion dollars.

Like I said, the choice of whether to drill is up to you.  Just know what you are getting out of it (30-40 cents off a gallon of gasoline), and what the cost might be.

@ July 3, 2008

Start at: Red Bank, NJ
End at: Houston, TX

Pimped out ride: 14' U-Haul towing the sketchy VW (approx 25' long total)

Total distance traveled: Approx. 1700 miles
Number of states: 10 (NJ, DE, MD, VA, TN, GA, AL, MI, LA, TX)
Gasoline used: 192.6 gallons
Efficiency: 8.8 miles per gallon (gah!!)
Money spent on gasoline: $758
Average $$/gallon: $3.94
Driving time: 34 hours (over 3 days)
Average speed: 50 mph (including breaks - not too shabby)
Number of crosses seen from the highway at least 40' high: 5
Number of times animals got sick in the car: 0 (really! good job Frankie!)
Number of cans of dog food Suzi opened and then left somewhere in the truck until it smelled horribly: 1
Number of ridiculously torrential downpours driven through: 5 (seriously, WTF weather)

Okay, the rest of these aren't exactly numbers, but whatev.

Favorite sign seen from the road: Blacks Run

Story from the trip I will never get tired of telling:

Everything was ready to go.  The car was hitched to the van, our things were packed, the animals were in the car.  I hop in the driver's seat, and start pulling out of the driveway...


Oh sweet Jesus tittyfucking Christ what was that.

It was the trailer un-hitching itself from the van.  The dolly is laying on the driveway with the car still on it, and there is no way to get the ramps down to get the car back off.  The driveway is entirely blocked, and there is already a line of cars behind me wanting to get out.  Where is everyone going all of a sudden? Where did they come from?

They day has already been stressful, but now I am stressed worse than Kirstie Alley's pants.  Thankfully, one of the guys waiting to get out of the parking lot was a decent human being (as you know, a rarity in New Jersey) and started helping me extricate myself.  Urge to kill... fading... fading...

While we are out there working, I notice a woman walk to the dumpster and start rooting through like a hobo.  Which is strange, because there aren't any homeless people in Red Bank.  What was she doing? Whatever, I don't care, let's just get the car down.

"Is this yours?"

I turn around, and the hobo is holding a hand-held vac, a cardboard box, and a VCR.  She must be new to being homeless.  Things that people have put in the dumpster are up for grabs, she can take what she wants.  "Why?"

"This isn't household garbage.  You can't throw this away here."

Urge to kill... rising...

I go back to what I'm doing, while Suzi starts talking to her.  "Can't you see we are dealing with a situation here? Is this really necessary?"  Indignation turns to anger. She's not dropping it.  She wants us to take the items out of the garbage.  We're going to be fined.  Fine, fine us.  We don't care.  We're leaving.  That doesn't satisfy her.  She's still standing there.  Anger to frustration. 

Suzi gets frustrated, but I don't.  I just get angrier.  And, well, some might say I lost it, but I wouldn't.  I definitely made a decision that this had gone on long enough, and I was now going to be an asshole to this woman.

"Listen: we are not taking the garbage.  You can leave it in the dumpster, you can fine us, or you can throw it around on the street, or you can shove it up your ass. I don't care.  Do you not see us dealing with a problem here?"

That felt pretty good, but it wasn't enough.  I'm still getting lip.  I'm going to need to take it to another level.

"Hey! We. Are. Not. Taking. It.  GO. FUCK. YOURSELF."

That did it.  She drags the garbage after her back up the parking lot, to her garage.  Nope, she doesn't just throw it back in the dumpster, she stores it in her garage. 

We got this letter two days later forwarded to us by our former landlord.

Hi Vern
I left a message on your phone.  Your tenant moved out yesterday and we have issued 2 fines.  One for blocking the driveway entrance (when told to move, they were nasty).  $25.00
Secondly, they left a bunch of non household items in the dumpster (3 area rugs, wire basket, vcr, handheld vac, large box).  These items were removed and placed in a garage.  You have been fined $50.00 for these items.  You will also be charged a removal fee, unless you want to remove them yourself.  You have until tomorrow night (Monday night) to remove these items, otherwise we will have them remove and charge you for this service. 
Please let me know if you plan on picking these items up so we can make the proper arrangements for access to the garage.
Thank you.

Springview Gardens

You see, she wasn't just any run of the mill dumpster diving hobo.  She does it professionally.

Suzi wants to just pay the fines and be done with it.  I want to take a picture of my junk and send that instead.  We'll probably just pay the fines.  In a way, though, I guess it works out. If not for all that, I might have actually missed New Jersey.

@ May 7, 2008

Okay, enough of the preachy environmentalist stuff.  I have a real problem, sent to me from Cousin Eric:

We all know  the game Battleship, but Sophie has taken it to another level in an unheard of episode of beginners luck.
The past few weeks Sophie has graduated from Dominoes and Candyland to Trouble (with the pop-o-matic) and now Battleship. She's not fared too well with Trouble, but is undefeated (5-0) in Battleship and on Sunday she took the game to a new level, one that I have never seen before (and I've been playing since the 1960's).   It took Sophie only 18 turns get the 16 hits to sink my entire fleet!  With 100 pegs on the board and only 16 hits available to opposing players the odds of getting one hit at the beginning of the game is 6.25 to 1 or the obvious 16%.  The odds change slightly as each player takes a turn, but the odds of hitting all the other players ships in only 18 turns is.....I have no idea, but it's pretty crazy!
Was there foul play involved?  I can find no evidence.  Sophie's Aunt Laury was in the room at the time, but she was on Sophie's side of the room and board.  Also, if Sophie was getting my coordinates from a Sophie sympathizer  (Laury, Molly, Rose or even Otis), at not yet 5 years of age her poker face has not yet evolved to keep this intel to herself. So, all I can conclude is this unprecedented once in a lifetime Battleship rout is legit and thought this was news worthy enough to share it with you.
The picture below was taken right after the final shot was fired.

Wow.  16 out of 18 hits.  Is this possible?  No, because it actually takes 17 hits to sink everything.  But 17 out of 19 hits? Is THIS possible?  Yes, obviously, it is possible.  That's a dumb question.  The real question is: what are the odds? Aha! Time for math! (PS: I really need to get back to work)

We calculate the odds by calculating, after each turn, the likelihood of getting another hit.  If the previous hit sank a ship, or this is the first shot, we calculate the odds of hitting a ship as (remaining open pegs in a ship)/(total pegs remaining).  In Eric's example above, at the beginning of the game, there are 17 possible spots to hit a ship, and 100 total pegs, so the odds of hitting a ship are 17%.  If the carrier is sunk, these odds change to 12/95, or 12.6%. 

If the previous hit did not sink a ship, then the odds will be calculated depending on the number of pegs already in the ship, the type of ship we are trying to sink, and the position of that ship on the board.  We will work through the carrier as an example. 

You have just hit a ship.  It is the carrier, although you have no way of knowing this.  You just see a peg sticking out of the board.  Your next move is to choose one of the 4 surrounding peg locations.  What are your odds of hitting again?

The carrier has five locations.  If you have hit either end of the carrier to start, your odds are 1/4.  If you hit somewhere in the center, your odds are 2/4, or 1/2.  So, your chances of hitting again are (1/4 + 1/2 + 1/2 + 1/2 + 1/4) / 5 = 40%.

battleship-first-hit.jpgNow you have two locations hit.  What are your odds of hitting a third time? If the two hits are at the ends, the chances are 1/2.  If the two hits are in the center, your odds are actually 100%.  (1/2 + 1 + 1 + 1/2) / 4 = 75%.

battleship-second-hit.jpgFourth time? (1/2 + 1 + 1/2) / 3 = 67%.

Fifth time?? (1/2 + 1/2) / 2 = 50%.

Now, we can calculate the odds of wiping out the cruiser without a miss, once you get that first hit: (0.4 * 0.75 * 0.67 * 0.5) = 10.05%.

If the ship is butted up against an edge, these odds are modified.

So, how do we distill all these facts down into the odds of this specific outcome? With computers! First, we look at the picture again, and assign each ship a position type: center of the board, longways against edge, shortways against edge, or corner.

carrier: center of board
battleship: center of board
submarine: center of board
destroyer: longways against edge
patrol boat: corner

Next, we'll fire up ye olde computer to crank out the odds of successfully hitting everything without missing (we'll get to the issue of the two misses in a second).

The odds of hitting all the spots without a single miss? 1.7 billion to one against.  Really.

Okay, so how do the two misses affect the outcome? Not much.  If we modify the original calculations so that there are 98 spaces to begin instead of 100, the odds drop to 1.5 billion to one against. 

Oh, Sophie, you had a good thing going with your 5-0 record, but clearly you got greedy. Buy that girl a deck of cards, Eric, because her poker face is better than you think. 

@ April 30, 2008

Today we get follow-ups to two stories that ObscureCraft has been tracking.  First, I'm sure you remember reading the first sentence of my "Word Problems" feature on the gas-tax holiday before getting bored, so I'll give you the short version: John McCain wants to suspend the national gas tax for the summer, because he is a stupid old man who can't do math.  It turns out that the state of New York is also governed by stupid old men who can't do math.  

State senators Andrew Lanza, Charles Fuschillo, and Joe Robach, sponsored a bill to suspend the 32.5 cent per gallon gas between Memorial Day and Labor Day.  As a result, I am taking up a collection: if I get $60 in pledges, I will send each of these senators a copy of this book with the following note.

Dear Senator: 

It has come to my attention, based on your recent legislation to suspend the gasoline tax for the summer season, that you are poor at math.  Because I feel it is important that our elected officials be able to solve basic math problems, I have sent you the enclosed book.  Take the time you would spend today writing horrible legislation and work through this book, and I guarantee that your math skills will greatly improve.  Only 20 minutes a day to success!  After you are done, your homework is to write a paragraph on why a gas tax holiday is a retarded idea.
I will start the pot with $10.  And I don't even have a job!  Anybody else in?


And finally:  Monday, I brought you up to speed on the Miley Cyrus photo scandal.  Well, today, I found this on the internets. That is what I call a photo scandal. 

Just click it.  Don't make me explain the disturbing, disturbing image found inside.  Miley Cyrus may not owe me an apology, but whoever created this Disney-related advertisement does.  Because I am upset.  I'm going to go take another shower now.

@ April 19, 2008

Remember in school when you would get questions like this:

A train leaves Chicago at 6:45 going 50 miles per hour.  Another train leaves Detroit at 5:15 going 70 miles per hour.  If its 400 miles between the two cities, where do the trains meet? (Answer: Fuck you teacher!!!)

Well, turns out, you were right when you said you would never need to know how to do that.  Turns out word problems are much harder than that.  Things are not so simplified; you are not given all the information; and, most of the time, you don't even know the question being asked of you is a math problem.  This recurring feature will aim to highlight when a topic in the news is actually a word problem, and then I will try to solve it.

Today's question:  Should I be in favor of John McCain's proposed "gas-tax" holiday?

The answer actually depends on who you are.  I will attempt to answer it from several points of view.  Here are some facts that should be considered with each answer.

The current gas tax is 18.4 cents per gallon (24.4 cents per gallon on diesel fuel).
Estimates peg the value of this tax to the US government at $10 billion.
As of this writing, the national average cost of gasoline is $3.39.
As of this writing, oil costs $113 per barrel.

Here is the answer if you are bad at math:

$3.39 - $0.18 = $3.21, therefore, cheaper gas! Hooray!

Here is the answer if you are good at math:

I'm an average American.  I consume 500 gallons of gas per year.  During the summer months, I'll consume roughly 30% of this gasoline, or 150 gallons.  Therefore, this tax reduction will personally save me about $27 this year.  Uh, that's pretty good, I guess.  Hope the government didn't need that $10 billion dollars for anything.

minnesota-bridge-collapse.jpgHere is the answer if you are an economist:

The average driver reduces consumption in response to rising prices once prices cross approximately $2.50 per gallon.  Decreasing the price per gallon should result in higher consumption.  Per gallon spending drops, but overall spending on fuel will remain roughly constant.  Therefore, the effect of this tax will be to remove $10 billion from the federal budget, and transfer those funds to the gasoline and oil industry.

Here is the answer if you are the gasoline industry:

Sweet, we're going to make another $10 billion dollars this summer.


Blog directory

Powered by Movable Type 4.1