The last time I was at the Casino I had won a couple hundred dollars playing poker. Being the brilliant guy that I am, I decided to take my winnings to the roulette table and bet it all on black. I wanted to maximize my chances of winning, so I waited until the ball landed on red 5 times in a row. Then, I put my money on black.
This is the Gambler’s Fallacy.
From wikipedia:
The gambler’s fallacy, also known as the Monte Carlo fallacy or the fallacy of the maturity of chances, is the mistaken belief that, if something happens more frequently than normal during some period, it will happen less frequently in the future, or that, if something happens less frequently than normal during some period, it will happen more frequently in the future (presumably as a means of balancing nature).
In other words, it’s the pernicious belief that if you go to flip a coin 10 times, and the first 5 times you flip it ends up heads, then it’s more likely to be tails on the next flip. I knew about the Gambler’s Fallacy before my visit to the casino that day. This shows (besides the fact that I should avoid Casinos) how deeply ingrained this way of thinking is. When money was on the line, I ignored reason and fell back on false intuition.
There’s an incredibly long and dense book called Thinking, Fast and Slow written by a behavioral psychologist named Daniel Kahneman of which I managed to read about 20%.
According to Kahneman, there are two forms of thinking:
1) Instant, automatic, emotional
2) Slow, deliberate, rational
He argues that the first form is the predominate mode of thinking in emotional situations.
Gambling is an emotional situation, so it’s possible that I was stuck in that first form of thinking. We know that it’s not normal for a coin flip or a dice roll to end up the same over many rounds. However, we intuitively (and falsely ) misattribute this rarity to the effect of previous coin flips on future coin flips. It seems our brains are not wired for statistics.
This is a well known fallacy. But since it’s still a very persistent idea, let’s put it to the test and prove that the Gambler’s Fallacy is actually a fallacy. What happens when we set up a situation where we flip a coin 1000 times and see how often the coin comes up heads or tails after a long series of one or the other?
The code I’m about to show you simulates a coin flip scenario. Using Python’s random() function to choose a number between 1 and 100, all numbers 50 and below count as a “win”, and all numbers 51 and above count as a loss ( 50/50 coin flip scenario ). We create a large data set by “flipping the coin” 1000 times in 10000 different games. Then, using the next_in_Row() function, we examine every game which has several wins in a row and figure out what the flip immediately following the winning streak was for each game. With this information in hand, we can then determine the ratio of wins/losses after a winning streak.
Our intuition and the first form of thinking would lead us to believe that longer winning streaks would lead to a higher percentage of losses on the next coin flip.
But our reason and the second form of thinking would lead us to expect a 50/50 ratio no matter how long the winning streak.
Here’s the code:
import random from sys import argv if __name__ == '__main__': script, write_file = argv def rollDice(): '''Rolls the dice and gets a number 1-100''' roll = random.randint(1, 100) return roll def game(repeats): ''' Rolls the dice. Records W if < 51, records L if > 50. 50/50 chance. Returns game results ''' x = 0 rolls = [] while x < repeats: roll = rollDice() if roll <= 50: result = "W" rolls.append(result) elif roll >= 51: result = "L" rolls.append(result) x += 1 rolls.append("END") return rolls def build_set(number_games, length_games): '''Plays game set number of times and returns list of games''' game_set = [] x = 0 while x < number_games: result = game(length_games) game_set.append(result) x += 1 return game_set def next_in_Row(game_set, how_many): '''Returns a list of the next roll for every game which had however many in_a_row''' qualifiers_next_rolls = [] for game in game_set: in_a_row = 0 for x in range(0, len(game)): if game[x] == "W": in_a_row += 1 elif game[x] == "L": in_a_row = 0 if in_a_row == how_many: qualifiers_next_rolls.append(game[x+1]) break return qualifiers_next_rolls if __name__ == '__main__': f = open(write_file, "w") f.truncate() for x in range(1, 30): game_set = build_set(10000, 1000) number_W = 0 number_L = 0 next_rolls = next_in_Row(game_set, x) if next_rolls: for roll in next_rolls: if roll == "W": number_W += 1.0 elif roll == "L": number_L += 1.0 total = number_W + number_L percentage_W = float((number_W/total)*100) f.write("Percentage of next rolls which were W for %r in a row: %r\nNumber of games: %r\n\n" % (x, percentage_W, len(next_rolls))) else: f.write("There wasn't %r in a row\n\n" % (x, )) f.close()
And here’s the results:
Percentage of next rolls which were W for 1 in a row: 50.9 Number of games: 10000 Percentage of next rolls which were W for 2 in a row: 49.76 Number of games: 10000 Percentage of next rolls which were W for 3 in a row: 50.370000000000005 Number of games: 10000 Percentage of next rolls which were W for 4 in a row: 49.919999999999995 Number of games: 10000 Percentage of next rolls which were W for 5 in a row: 50.39 Number of games: 10000 Percentage of next rolls which were W for 6 in a row: 49.80996199239848 Number of games: 9998 Percentage of next rolls which were W for 7 in a row: 49.735449735449734 Number of games: 9828 Percentage of next rolls which were W for 8 in a row: 50.12213562870769 Number of games: 8598 Percentage of next rolls which were W for 9 in a row: 50.0 Number of games: 6277 Percentage of next rolls which were W for 10 in a row: 50.51229508196722 Number of games: 3907 Percentage of next rolls which were W for 11 in a row: 48.87992831541219 Number of games: 2234 Percentage of next rolls which were W for 12 in a row: 51.80412371134021 Number of games: 1165 Percentage of next rolls which were W for 13 in a row: 52.7681660899654 Number of games: 580 Percentage of next rolls which were W for 14 in a row: 46.728971962616825 Number of games: 323 Percentage of next rolls which were W for 15 in a row: 52.41379310344828 Number of games: 145 Percentage of next rolls which were W for 16 in a row: 43.93939393939394 Number of games: 66 Percentage of next rolls which were W for 17 in a row: 35.483870967741936 Number of games: 31 Percentage of next rolls which were W for 18 in a row: 72.72727272727273 Number of games: 22 Percentage of next rolls which were W for 19 in a row: 25.0 Number of games: 4 Percentage of next rolls which were W for 20 in a row: 33.33333333333333 Number of games: 9 There wasn't 21 in a row Percentage of next rolls which were W for 22 in a row: 0.0 Number of games: 1 Percentage of next rolls which were W for 23 in a row: 50.0 Number of games: 2 There wasn't 24 in a row There wasn't 25 in a row There wasn't 26 in a row There wasn't 27 in a row There wasn't 28 in a row There wasn't 29 in a row
As you can see, there was ~ 50% chance of a win on the next flip no matter how long the winning streak was (Although, in some of the longer winning streaks (> 16 in a row ) fewer games were represented and the final ratio was more skewed ). My results prove that the gambler’s fallacy is in fact a fallacy.
No matter how many W’s in a row we get, the odds for the next flip is always going to be 50/50.
Nothing groundbreaking here, but it’s still helpful to see it played out like this. Next time you’re at the roulette wheel, take note of how well you can resist intuition in the face reason. It’s a clear way to delineate between your intuitive, lizard mind and your intellectual, reason-driven mind. If it’s so difficult to make rational decisions with something as cut and dry as this, it makes you wonder how many other ( more subtle ) fallacies we let get the better of us every day.
Thanks for reading!