The Monty Hall problem

[This article was first published on The Beginner Programmer, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

The Monty Hall problem is a famous game which was played in the television show “Let’s make a deal”.

The game goes like this:

There are three doors, behind each door there is either a goat or an amazing sportcar. The contestant wins if they guess where the car is. There are in total 2 goats and the car. Therefore the initial chance of choosing the car is 1/3.

The host asks the contestant to pick a door. Once a door has been chose, the host, who knows where the goats and the car are, opens a door behind which there is a goat and asks the contestant if they want to switch door.

Now the question is: should the contestant change door or should they stay? Is there any statistical reason which could justify either choice?

It might not be that immediate to understand, however the optimal strategy is to change door. In this case, the probability of winning the car increases from 1/3 to 2/3. You can check this by analysing the favourable scenarios over the possible scenarios. However, should we stick with this or should we make a simulation to test this statement out? Let’s go for the simulation with R.

Here are the results:

The simulation confirms that, on the long run, the odds are more favourable if the contestant decides to switch door. Hope this was useful and interesting.
More on the Monty Hall problem:

To leave a comment for the author, please follow the link and comment on their blog: The Beginner Programmer. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)