Systematically Betting on Baseball (fun with Spreadsheets)

Systematically Betting on Baseball (fun with Spreadsheets)

If you know me in the “real world” you know that I am a huge Pirate fan.  The part of baseball I have found interesting for most of my life is player development.  Watching players get drafted at 18 out of high school or signed at 16 out of Latin America and then spending 4-6 years of focused training to make it to the major leagues.  I go to spring training every year and follow the Pirates minor league teams as much as I can.  That doesn’t leave me with any time to really read up on the other 31 major league teams, and none to focus on fantasy baseball.  Reading Changing Bases (my book review) changed that a little bit for me.  There is so much about baseball that can be predicted and calculated if you have access to the statistics, but I didn’t think I would be able to find public information that’d be detailed enough to analyze.  That’s when I discovered the “Export Data” link on Fangraphs!  Now I had an Excel with each player’s projected stats for the season.  I immediately joined my friends’ Fantasy Baseball league and began preparing for my trip to Vegas (I was going anyway to watch the Mayweather vs Pacquiao fight).  This blog post is about the spreadsheet I built to allow me to gamble on baseball.  To download my spreadsheet, click here.

Framing the Problem

Baseball betting is a little different than gambling on football.  Most people associate football betting with “line” bets (e.g. betting on the Steelers minus 3 points implies they will win by at least 3).  Those bets are designed to handicap the favorite and make an uneven game in to an even game so that you can bet $1 to win $1.  Gambling on baseball is based on the “money line”.  You pick one team to win the game by any score, but you get paid a higher amount on the same amount wagered if the team is an underdog.  In the United States, the odds for a “money line” bet are expressed as either a positive or negative number.  If the number is positive than the team is an underdog and the dollar amount shown is the amount that you will win on a $100 wager.  If the number is negative than the team is the favorite and the dollar amount shown is the amount that you will have to wager in order to win $100.  Here are a few examples:

  • Pirates +220 means the Pirates are the underdogs and if you gamble $100 on them you will win $220 back and your initial bet.  If you bet a smaller amount it’s proportional, so if you bet $20 you will win $24 (6/5 of 20) and your initial bet.
  • Pirates -150 means the Pirates are the favorites and if you gamble $150 on them, you will win $100 and get your $150 back.  If you bet a smaller amount it’s proportional, so if you bet $15 you will win $10 and get your initial bet back.

Money Line gambling is a lot like picking stocks.  There are two components to deciding whether a particular bet is a good “investment”.  First is the probability that the team wins (or the company performs) and second is the price (odds).  If you know there is a 100% chance that the Pirates will beat the Reds tomorrow, then you should be willing to bet on the Pirates no matter what the odds.  If I tell you that you will have to wager $200 to win $5 (that’s Pirates -$4000 if you’re following “money line” bets), you should still be willing to do it.  However, even if you thought there was an 80% chance the Pirates were going to win, you wouldn’t be willing to bet the $200 to win 5, it’s a bad price (much like a stock for a promising company that’s trading at a 40 P/E ratio).  So the problem is, how do I find bets on baseball that have an objectively good price.

Calculating Probability

The spreadsheet I’ve created takes a very simple approach to calculating the odds for a particular game.  First, determine how many games a team would win over the course of a season if they played with only the players who will play that day.  Second, compare those values

There is a statistic called Wins above Replacement (WAR) that has gained popularity as your single stop shop for analyzing how good a player is.  The statistic uses all kinds of metrics about the player to determine how many more wins per season a team is likely to have with this player in the lineup instead of the best available replacement (“best available replacement” is assumed for each position based on players that have been used as subs or picked up as free agents).

If you have downloaded the spreadsheet that I use to calculate win probabilities, go to the “Batters” tab for an example.  Here you can see the players’ projected stats for this season and the very last column is their “WAR”.  There is one little caveat that needs to be accounted for before we can just use that statistic though.  The projected WAR value is based on some assumptions that the creators have made on how many At-Bats that player will receive (for example, if he’s a backup catcher, he may only start 20 of the team’s 162 games, so the number of “Wins” he can provide his team is very limited).  If you move over to the “Odds” page of the spreadsheet (pasted a picture above) you’ll see that I not only have the players WAR but his “EXT WAR” (not an official baseball stat, but necessary for this calculation).  This calculates the WAR value that the player would have if he played every at bat at that position in the order (the 1st batter in the order has about 15 more at bats than the second who has 15 more than the third and so on).  This “what if he started every game” calculation is also done for the starting pitcher.  You’ll notice it’s more pronounced for pitchers then it is for position players; this is because starting pitchers don’t play many of the team’s games.

Homefield advantage and Bullpen are interesting.  If you’ve read Trading Bases you know that it’s not very useful to try to predict these.  As it turns out team’s rarely have sustained success or failure in the bullpen and it’s more accurate to use the league average bullpen (2.7 WAR) then to try to analyze which pitchers will pitch that day.  Similarly, even though the Pirates were 18% more likely to win home games than away games last year, only the pre-humidor Colorado Rockies have sustained more than an 8% over advantage for more than a couple of years.  Consequently the spreadsheet assumes an 8% advantage for the home team.

The Price from the Probability


Take a look at the bottom of the “odds” page (I’ve pasted a picture just above), when you add up the bullpen WAR and the EXT WAR for the starters you end up with a Total WAR.  Remember this is not the total WAR for the team as a whole, but the WAR if the 9 guys playing today played every day for the whole season.  We add 48 to that because it is estimated that a team of all replacement level players would still win 48 games.  That gives us the “Expected Wins” for this team of 9 over the course of an entire season.  Dividing that by 162 results in the “WAR Win Probability”; that is, the percent chance that they win any particular game with these players.  For right now, that’s not based on the team they’re playing against.  On the next line you’ll see the 8% historic homefield advantage factored in as a 4% advantage for the Astros (home team) and a 4% disadvantage for the Mariners (away team).  The “Odds to win” uses the “WAR Win Probability” to calculate the percent chance of winning THIS game and then adjusts by the “Effect” of home field advantage.  This gives me the percent chance to win.  Finally, we use that to create “fair” Money Line bets for this game.  Remembering how to read Moneyline bets, our “Expected ML” means a “fair” bet would be having to pay $114.94 to win $100 on the Astros or betting $100 to win $114.94 on the Mariners.

Making the Right Bets

Now we know that the “fair” line, we have to check the odds that the bookmaker is willing to give us.  This game actually took place on 4/30/2015 and the odds that the MGM was giving were Astros +105 and Seattle -125.  In the case of Seattle, the spreadsheet said they should have been the underdog.  For a chance to win $100 if they win, the spreadsheet says I should have to pay $87 (this is calculated by dividing 100 by the ML odds I calculated and multiplying times 100); the MGM wanted $125!!!  That’s not a price I should take.  Seattle is more interesting.  The MGM is selling tickets worth $105 if the Astros win that only cost me $100.  I had that the Astros were the favorite and those tickets should cost $120 (Calculated by taking 114% of the $105 payout).  That’s a great price.

The next question is how much to bet.  There are going to be a bunch of games each day and you want to bet as many of them as you can find good prices on.  Unlike when the odds are against you (I’m looking at you, my arch nemesis, Blackjack), when the odds are in your favor you want to bet as often as possible because the more you bet, the higher the probability you’re up.  I made up a rather simple system to bet as many games as possible and bet more on the ones where I thought I got a very good price.  If the difference between the price Vegas posted on the Moneyline was less than $10 cheaper than mine, I would bet $10.  If Vegas was offering a $10-$20 discount, I would pay $20.  If the difference was $20 or more, I would pay $50.  So let’s look at the games that were played 4/30:

  • Phillies at Cardinals
    • ML on Philly… MGM: +190  Me: +173.67… Result: Bet $20
    • ML on Cardinals… MGM: -220  Me: -173.76… Result: No Bet
  • Angels at Athletics
    • ML on Angels… MGM: +110  Me: +110.26… Result: No Bet
    • ML on Athletics… MGM: -130  Me: -110.26… Result:  No Bet
  • Reds at Braves
    • ML on Braves… MGM: -110  Me: -105.94… Result:  No Bet
    • ML on Reds… MGM: -110  Me: +105.94… Result:  Bet $20 Returned $38.19
  • Toronto at Cleveland
    • ML on Cleveland… MGM: +120 Me: +101.89… Result:  No Bet
    • ML on Toronto… MGM -140 Me: -101.89… Result:  No Bet
  • Nationals at Mets
    • ML on Mets… MGM: +100 Me: -114.24… Result:  Bet $20
    • ML on Nationals… MGM -120 Me: +114.24… Result:  No Bet
  • White Sox at Minnesota
    • ML on Twins… MGM: +135  Me: +113.46… Result: Bet $50 Returned $117.50
    • ML on White Sox… MGM: -155 Me: -113.46… Result:  No Bet
  • Tigers at Royals
    • ML on Royals… MGM: -120  Me: -116.37… Result: No Bet
    • ML on Detroit… MGM: +100  Me: +116.37… Result: No Bet
  • Seattle at Houston
    • ML on Houston… MGM:+105  Me: -114.94… Result: Bet $50 Returned $102.5
    • ML on Seattle… MGM: -125  Me: +114.94… Result:  No Bet
If your wondering what happened in the game that we have spent far too much time talking about, Jose Altuve hit a single in the bottom of the 10th to give the Astros a walk-off win.  On the whole, the spreadsheet was up about 30% on the ~$500 I gambled based on its advice.  It’s important to remember that even though the spreadsheet can give you the advantage over the casinos that it’s still gambling.  The “right” bet isn’t always a winner in the same way that companies with good fundamentals and a good price don’t increase their share price every day.