Monty Hall Problem Simulation

 All, Technology  Comments Off on Monty Hall Problem Simulation
Jun 162014
 

We often talk about maths, science and other interesting and often paradoxical problems.  One problem we had a good discussion of is the Monty Hall Problem.

To prove it, I created a simulation that can be run or forked from here: http://jsfiddle.net/zhulien/L654v/

There are a lot of discussions on the net and on youtube as to why it is the way it is, but not too many simulations to see it working in action.

How the simulation works:

Out of a defined set of rounds, I chose 10,000 as an arbitrary number, we allocate a control (random number between 1 and 2) as well as choose a door where the car is placed and where the person chooses.

We then evaluate the results of the allocations.  In one case, the always switch case, we count how many times we are NOT moving away from the car.  Given that Monty Hall has always chosen one of the goats, then we will also be moving away from a goat in this situation.  In the other case, the 50/50 case, we are using our existing allocated control number to decide whether we would switch or not.  This is a 50/50 decision as to whether we would be moving away from the car or to the car – makes little difference which way you take it.  Our control skew which is very small is our inaccuracy.  Surprisingly, even though at the start we knew 100% of the time we would have one of our negative choices eliminated by Monty Hall, we still have 2/3rd chance of winning the car if we switch 100% of the time vs 50% if we treat the decision as a new one between 2 doors.

Interestingly… I played with the idea of putting the car always behind a fixed door (let’s say 1).  And it made zero impact on the outcome.  I was wondering if ignoring human behaviour and leaving it purely to chance, if randomizing the door the car was behind would impact the outcome – it didn’t.  It’s all about the chance of moving ‘away’ from the car.

JC