data & variance & craps

Dave Melillo
4 min readMar 24, 2019

I do math for a living, so it might seem counterintuitive that I enjoy gambling. However, understanding that variance is a critical variable in the gambler’s equation, I also have more hope than average, because I know that in any single moment I can catch the wave of variance and cash in.

There is no game in the casino that embodies variance better than craps. I say variance because, statistically, the odds of rolling each number are already known. Even with this knowledge, most players win by putting their money on variance, not statistically backed facts. So does that make them stupid, or do they know something we don’t know? The answer is, probably both.

Craps Probabilities Histogram

The histogram above should look familiar to the craps table at the top of the page. That’s because the casino is visualizing the odds of the game on the felt top. Take a second look if you didn’t see it immediately; The “point” numbers (6,8,5,9,4,10) are organized exactly in the order they are most likely to show, the field bet is red because it’s a trap and the COME bar, which represents the 7 and 11, is the largest section of the table associated to the number(s) that is most likely to show at any given moment.

So at this point if you haven’t played craps you’re probably confused. Not by the rules of the game, but probably because, if everyone knows what number is going to come out the most, why don’t they just keep playing that number over, and over, and over? The answer, is some kinda do, but those terrible people are called “Don’t Pass Bettors” and we don’t like to associate with their kind.

if everyone knows what number is going to come out the most, why don’t they just keep playing that number over, and over, and over?

The answer is that the casino does not make it profitable for most people to “play the odds”. For example, that COME bet that we just talked about pays out 1:1, so if you bet $10 you win $10. So virtually the only way to “hit it big” by playing the COME bar or the pass line is to BET BIG, which most people not willing to do. That’s why you’ll find most casual craps players gravitating towards bets like the HORN (15:1, 30:1), Hardways (7:1, 9:1) and other various prop bets that offer much better pay outs but much worse odds.

That brings us to the interactive part of this story where we can experiment with some data. I used python for this example and imported matplotlib to create the histogram(s) you are about to see, and numpy to build/run the simulations.

# Import numpy and set seed
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(356)#simulate 10 rolls
roll1 = []
for x in range(10) :
dice = max(2, np.random.randint(1,7)+ np.random.randint(1,7))
roll1.append(dice)
# Create histogram
plt.figure(figsize=(10,8))
plt.hist(roll1,bins=11,histtype = 'step', linewidth=2, label='1st Roll')
plt.title('Craps')
plt.xlabel('Number Rolled')
plt.ylabel('Frequency')
plt.legend()
# Display histogram
plt.show()

The simulated results of 10 random rolls are presented below and illustrates how variance works in the short term. We know that 7 is supposed to come out the most often, but in these 10 rounds we actually saw 5 and 6 the most. That makes you wonder … How big does the sample size have to be for variance to wane?

The simulated results of 100 random rolls are presented below and we’re still all over the place. While each number is starting to fall into the range of probability we would expect, we still rolled more 9s, 8s and 6s than 7s.

The simulated results of 1,000 random rolls are presented below and we finally see our statistical expectations take shape. This is the first simulation where 7 was rolled more times than any other number. We still had an abnormal amount of 5s and 6s, but most of the field numbers fell within the distribution we would expect.

And finally, the simulation of 100,000 rolls proves the power of variance (or lack thereof). Over 100,000 rolls the expected distribution takes shape and it’s easy to see which numbers you “should” be betting on. I say “should” because even if you bet $10 on every roll ($1M) the 7 would only win you $320K and you would walk away a YUGE loser.

The house always wins is just another way of saying numbers don’t lie. The statistics are clear when it comes to games like craps, and they leave you only one true strategy if you want to walk away a winner; bet big, leave the table before you lose variance & get lucky :)

--

--

Dave Melillo

The Full Data Stack! Data Engineer, Data Architect, Data Scientist ++ practical application of data science 🛠