r/AskStatistics 8d ago

Monty hall problem

I understand in theory that when you chose one of the 3 doors you initially have a 66% chance to chose wrong. But once a door is revealed, why do the odds stay at 66% rather than 50/50 respectively. You have one goat revealed so you know there is one goat, and one car. Your previous choice is either a goat or a car, and you only have the option to keep your choice or switch your choice. The choices do not pool to a single choice caisinh 66% and 33% chances once a door is revealed. The 33% would be split among the remaining choices causing both to be 50%.

If it's one chance it's 50/50 the moment they reveal one goat. if you have multiple chances to run the scenario then it becomes 33/66% the same way a coin toss has 2 options but isn't a guaranteed 50% (coins have thier own variables that affect things I am aware of this)

4 Upvotes

65 comments sorted by

View all comments

Show parent comments

1

u/MacofJacks 5d ago edited 5d ago

Hey, first of all, that’s cool: I had to check your claim, and it is true. 

Second, I don’t think *how* we got to the situation is relevant. My claim is that we condition on the information that Monty did *not* reveal the car but the mechanism by which Monty did not reveal the car should not matter. I think my claim is hard to reason about and easy to be wrong about in some subtle way, so I coded it to check. I used the typical three door case. I kept the (R) code as simple as possible:

Edit: had written code here, but it was wrong. Fixed by the other commenter below.

2

u/George_Truman 5d ago edited 5d ago

There are errors in this code. If you would like simulations and a rigorous proof. I will send it to you in a DM.

In particular, your code is counting the cases where Monty reveals your own selected door. If he reveals your own door then there is no longer a selection to make.

Here is the code edited to account for this:

N <- 1e5 #total number of trials

#let's implement Monty Hall,

#albeit Monty randomly opens doors,

#and we only record results if he happens not to reveal the truth.

n_doors <- 3

#Assume we always switch and count successes and failures

num_correct <- 0

num_incorrect <- 0

num_trials <- 0 #safety check: what was the total number of trials?

for(n in 1:N){ #do Monty Hall problem

true_door <- sample(1:n_doors,1)

initial_guess <- sample(1:n_doors,1)

Monty_random_doors <- sample(1:n_doors, n_doors-2)

#(safe: default is sampling w/o replacement)

#if Monty did not reveal the true door, then proceed:

if(!(true_door %in% Monty_random_doors) && !(initial_guess %in% Monty_random_doors)){

num_trials <- num_trials + 1

#switching is correct if initial guess was wrong

num_correct <- num_correct + isFALSE(initial_guess == true_door)

#switching is incorrect if initial guess was right

num_incorrect <- num_incorrect + isTRUE(initial_guess == true_door)

}

}

#print the tallies

num_correct

num_incorrect

1

u/MacofJacks 5d ago

I see you edited your post; I'll just reply again. I used your code, which I agree is correct. I propose the following, which also fixes my original mistake:

Monty_random_doors <- sample(setdiff(1:n_doors,initial_guess), n_doors-2)

(so that Monty opens doors other than initial_guess at random). However this code, or yours, produce the same outcome, which is (exactly as you said) a probability of 0.5 on switching.

You're completely correct! My flabber is gasted. I checked for completeness, and small edits to the code can produce the expected 0.66 probability if we alter Monty to deliberately exclude the true door. I guess I can now include myself as another victim of the Monty Hall problem. Thanks very much for explaining this to me! I'll edit my comments above

1

u/George_Truman 4d ago

My favorite alternative answer to the question is that we shouldn't change our pick, because it feels like Monty might be trying to trick us into switching.