agillo.net | about me

Monty hall and why you shouldn't trust your statistical intuition

A lot of interesting books have been written in the last few years about randomness, the future, and just how bad us humans are at understanding risk. Risk is all around us, in the market, job interviews, business ventures - it plays a part in every important decision we make.

Yet, according to “Thinking fast and slow” our subconscious mind just isn’t wired to understand chance. We intuitively learn by trial and error and when the game is rigged for the long run, short term ‘lucky wins’ and ‘unlucky failures’ lead us to draw completely disproportionate conclusions.

Yet it's even worse than that. As it turns out even when we leave our intuition on the bench and turn on rational thinking, we may still get it wrong.

Monty hall

The monty hall problem goes as follows

There are 3 cups (A,B and C) with a ball underneath one of them:

I'll give you a hint, it's not a 50/50 decision. You should in fact switch to cup C as there is now a 2/3 chance of the ball being under that cup. For the maths behind it I recommend you search google. The truth is I still didn't really believe it untill I wrote a little simulator in ruby.

And yes, it is true... (mind explodes - mine anyways)

The code

class CupGame
   attr_accessor :pick
   def initialize
      @choices = [1,2,3]
      @answer  = @choices.shuffle.first
   end

def correct? @pick == @answer end

def eliminate_a_wrong_choice @choices.delete(@choices.find {|c| c != @answer and c != @pick }) end

def swap_pick @pick = @choices.find {|c| c != @pick } end end

def game_result(name,&strategy) games = 10000.times.collect do game = CupGame.new strategy.call(game) game.correct? end correct_games = games.find_all {|c| c}

puts "Results for #{name}" puts "Won : #{correct_games.length * 100.0 / games.length} %" puts end

game_result("no choice") do |game| game.pick=1 end

game_result("with choice but remain on first pick") do |game| game.pick=1 game.eliminate_a_wrong_choice end

game_result("with choice and swap first pick") do |game| game.pick=1 game.eliminate_a_wrong_choice game.swap_pick end

The Result

Results for no choice
Won : 33.43 %

Results for with choice but remain on first pick Won : 33.57 %

Results for with choice and swap first pick Won : 66.34 %

blog comments powered by Disqus