*A classic post today.*

It’s about time we did the Monty Hall problem.

Many of you will already know the answer, but read on anyway because it turns out to be an excellent example to demonstrate fundamental ideas in probability.

Incidentally, I just did this yesterday to a group of surgical residents: you might be happy to know that none of them got the right answer. One even insisted—for a while—that I was wrong.

Here’s the problem.

Setup: Monty Hall shows you three doors, behind one of which is a prize, behind the other two is nothing. Monty knows which door hides the prize. You want that prize.

Rule: You pick a door that Monty will open. You are free to change your mind as often as you like.

The Pick: I’ll suppose, since I can’t quite hear you, that you settled on **A** (the resident yesterday took that one) and did not change your mind.

## A |
## B |
## C |
---|---|---|

## ↑ |

Question: What is the probability that the prize is behind door **A**?

Answer: Almost everybody will–correctly—say 1/3. Why?

Well, *conditional* on the evidence we have, which is that there are three doors and the prize is behind one of them, we deduce the probability to be 1/3.

Probability is always logically assigned conditional on evidence of some kind. Here, the evidence is simple to articulate. But it isn’t always so easy.

What Monty does next: He opens a door; not the one you picked, and obviously not the one with the prize behind it and asks if you would like to keep your original door choice our would you like to switch?

Question: Which strategy, staying or switching, maximizes the chances of you winning the prize? We can state this another way, but first let Monty open door **B**.

## A |
## B |
## C |
---|---|---|

## ↑ |

You can see, by the brilliantly conceived graphics, that there is no prize behind door **B**.

Same question: This is equivalent to the one we just asked. What is the probability that the prize is behind door **A** (or **C**)?

Your Answer: What’s that? You said *1/2*? Why?

Evidence: Did you say to yourself, since you well learned the lesson that probability is conditional, that “There are just two doors and the prize is behind one of them”? If you said that, then conditional on that evidence, the probability *is* 1/2.

But that is not the best answer. What you should do is switch, *because the probability that the prize is behind door C is 2/3!*

Conditional on *all* the evidence we have, that is.

What other information could there possible be?

Right now, we know that the prize is either behind **A** or **C**. Let’s assume it’s behind **C**, as in this picture.

## A |
## B |
## C |
---|---|---|

## ↑ |
♥ |

Could Monty have opened door **C**? No. He was *forced* to open **B**.

So in this case, it would be better for you to switch (obviously, because the prize is behind **C**).

Suppose that instead of **A** you had first picked door **B**. Which doors could Monty have opened? Right: only **A**. And again you should have switched.

Now suppose you had first picked **C**. Which doors could Monty have opened? Right: **A** or **B**. And in this case you should stay.

If the prize is behind **C**, that makes two situations where you were better off switching and one where you should stay. Do you agree?

Then we have the answer, because the exact same analyses can be made if the prize were behind **A** or **B** (try it yourself). Thus, the probability of winning is 2/3 if you switch and 1/3 if you stay.

What was the evidence that you failed to condition on when you said the probability was 1/2? You forgot that Monty’s choice of which door to open was constrained. He couldn’t open the door you picked and he couldn’t open the door that hid the prize.

That very simple information radically changed the probability structure of the answer.

———————————-

I stole and modified the door picture from this Australian government site.

18 March 2009 at 10:36 am

A great problem.

Did you see the TED talk on probabilities with the example of a test for a disease with 99% certainty etc. That’s a good one, especially if you’re working with medics. Also the HTT v HTH is interesting:

http://www.ted.com/index.php/talks/peter_donnelly_shows_how_stats_fool_juries.html

Apologies, I don’t (yet) have your book and I haven’t been following your blog for long, especially on stats, so P(eggs, grandmother, suck, teaching)= high.

18 March 2009 at 10:43 am

I think the easiest way to really understand the problem is to imagine that there are 1000 doors. You pick one and the probability of being correct is 0.001.

The quizmaster then opens 998 doors which do not have a prize behind them, leaving you to decide whether to swap or stay with the one you have chosen. Now the probability that you were right first time stays exactly the same at 0.001. Therefore the probability that the prize is behind the other door is 0.999.

18 March 2009 at 10:45 am

One more try at posting a script my young son and I wrote together. He was (and I think still is) convinced that HE should not be bound by the ‘switch’ rule since his selections are somehow special.

Fortran in R:

#

# lmad.R

#

# simple simulation of the game Lets Make A Deal to demonstrate that thinking

# about probabilities is sometimes difficult even in the simplest of situations

play <- function(nContestants=1000) {

#

# locals

DOORS <- c(1,2,3)

lmad=matrix(0, nContestants, 6) # P,C,M,C',!switch,switch

#

# put the big prize behind a door

# have the contestant make a guess

# monte will also pick a door. his pick will be cleaned up later

lmad[, 1]=ceiling(runif(nrow(lmad), min=0, max=3))

lmad[, 2]=ceiling(runif(nrow(lmad), min=0, max=3))

lmad[, 3]=ceiling(runif(nrow(lmad), min=0, max=3))

#

# this is a more matlab/r way of doing this. come back and fix this up later

for(cursor in 1:nrow(lmad)) {

#

# clean up monte's pick

# monte cannot select the same door as the contestant

# monte also knows where the prize is and he will not pick it! this is the

# key to the whole problem

while(lmad[cursor, 3] == lmad[cursor, 2] || lmad[cursor, 3] == lmad[cursor, 1]) {

lmad[cursor, 3] = ceiling(runif(1, min=0, max=3))

}

#

# one in three leg

# contestant decides that they have made the right guess and will stick with

# their initial choice.

if(lmad[cursor, 1] == lmad[cursor, 2]) {

lmad[cursor, 5] = 1;

}

# game over

#

# two in three leg

# contestant decides they did not pick correctly. monte's biased (non-random)

# action guarantee that a switch will win if you entered this leg with an

# incorrect guess

lmad[cursor, 4] <- 6 - (lmad[cursor, 2] + lmad[cursor, 3])

if(lmad[cursor, 1] == lmad[cursor, 4]) {

lmad[cursor, 6] = 1;

}

}

# hist(lmad[, 1], c(0,1,2,3))

# write(lmad, file="lmad.csv", sep=",")

print(lmad)

print(sum(lmad[,5]))

print(sum(lmad[,6]))

}

18 March 2009 at 10:56 am

Conrad,

Thanks very much! I look forward to trying out.

Patrick,

My heart soars like a hawk. That is just the right way to solve problems like this: exaggeration. I will steal your idea.

Luke,

No worries. But, yeah, we did link that one. Keep on giving us ideas, though!

18 March 2009 at 11:38 am

A great teaching example.

Now, being a frequentist and a half-baked Bayesian, I find this statement very funny… Not! ^_^

In other words, if you chose the door with prize at first and switch, you switch away the prize. Now there is a 1/3 chance that the chosen door holds the prize originally. So the chance of not winning is 1/3 if you use the policy of always switching.

18 March 2009 at 12:00 pm

It’s a classic :).

18 March 2009 at 1:44 pm

I have a question about this that puzzles me.

I follow the reasoning that one should switch doors. That reasoning considers multiple plays. But why does that reasoning still apply when the contestant only gets to play once?

Yours, puzzled.

18 March 2009 at 2:37 pm

Patrick, brilliant!! I have two questions. How will Monty fit all those doors on the stage and how will he open 998 of them before the show ends?

18 March 2009 at 2:44 pm

Stefan:

If you only play once, i.e., chose a door, then there is no game and no puzzle. Variants can obviously be created, e.g., how much will you bet that you are right after Monty opens one of the remaining two doors – you can double or halve or stand pat. All variants, however, require a second decision that takes into consideration the additional information.

18 March 2009 at 3:39 pm

Bernie, thanks I didn’t express that well. I meant go once through the whole game, ie. choose one door, then decide whether to switch to the other.

18 March 2009 at 5:43 pm

Briggs: yes, steal Patrick’s thousand door idea, but I beg you not to abandon your own explanation. The thousand door idea helps one accept the true answer, and I have seen it around many times over the years. But yours is the best qualitative explanation I’ve seen that helps me understand it intuitively.

18 March 2009 at 5:56 pm

Stefan:

If you play the same game only once, the logic still holds because the prior odds hold. Multiple plays do not influence the logic because the games are independent as in if

a fair coinshows heads 50 times in a row, there is still a 50-50 chance that heads will show the next time the coin is tossed. But perhaps I am still missing your point.18 March 2009 at 7:17 pm

Dang. Try as I might, I fail to grasp this.

- Monty shows me an empty door.

- Maybe I picked the prize door right off the bat.

- Or maybe I didn’t.

- Either way, Monty *always* has an empty door with which to open and taunt me, his nerve-wracked contestant.

- Of the two remaining doors, one hides the prize, and the other doesn’t.

- Soooo, AT THIS POINT, its: “heads, I picked the right one on the first try – tails, I didn’t.”

- Heads, I should keep the door I picked originally, tails, I shouldn’t.

Really, I’m thinking ya’ll statisticians are probably just bad wicked people.

18 March 2009 at 8:36 pm

Thanks!

This is by far the clearest explanation of this problem that I have seen.

The key word which you used, but others omitted, is “constrained”. With prize behind C, and the contestant picking A, Monty HAS to open B. And that changes everything.

Now I really understand this.

18 March 2009 at 9:33 pm

I must mis-remember the game. I thought there was always the “wonderful” prize, the donkey and the pretty good prize. I thought the contestant picked, and Monte always opened the door for the medium prize. Then, you got to change your mind.

Sometimes, he opened the door the contestant picked, in which case, you discovered they’d picked the “medium” prize and one of the other doors. So, they knew they would either trade up to the wonderful prize or get the donkey.

Otherwise, if they picked the winner or the donkey, he showed the medium prize. So, they knew they either had the wonderful prize or the donkey.

But… I guess I didn’t watch the show very well, because your description of the MonteHall problem doesn’t match the rules I thought I remembered!

18 March 2009 at 10:26 pm

Lucia, I think I would stay with the door I originally picked in your example. I could use the donkey here on my farm.

18 March 2009 at 10:29 pm

The Monte Hall Problem is so famous it has a listing in the Wikipedia:

http://en.wikipedia.org/wiki/Monty_Hall_problem

It’s a long listing. It includes the Three Prisoners Problem (similar), N doors, Quantum Game Theory, and the Bayesian Solution (which gets the same answer but with lots of equations). My favorite is the Decision Tree (the pictographic solution) because diagrams are helpful to visual types like me.

My main recollection about the Monte Hall Problem is that Marilyn Vos Savant made a lot of dough off it. She somehow got herself listed in the Guinness Book of World Records under “Highest IQ” and parlayed that into a successful pop science journalism career. Monte gave her a big boost with that. She also landed Robert Jarvik, inventor of the artificial heart, as her husband. So I guess Marilyn is pretty smart after all.

19 March 2009 at 1:26 am

Briggs,

Before turning in for the night I took a few minutes to rewrite the procedural code in a manner more consistent with matlab/r style. It is harder to step through with a 12 year old but looks a little nicer on the page.

# lmad.R

# simple simulation of the game Lets Make A Deal to demonstrate that thinking

# about probabilities is sometimes difficult even in the simplest of situations

#

# columns: winningDoor, pickedDoor, openedDoor, resultKeep, resultSwitch

#

# openDoor

# monte knows where the prize is but cannot open the winning door.

openDoor <- function(v) {

while(v[3] == 0 || v[3] == v[1] || v[3] == v[2]) {

v[3] = ceiling(runif(1, min=0, max=3));

}

return (v[3]);

}

play <- function(nContestants=10000) {

lmad=matrix(0, nContestants, 5);

#

# put the big prize behind a door

lmad[,1]=ceiling(runif(nrow(lmad), min=0, max=3));

# have the contestant make a guess

lmad[,2]=ceiling(runif(nrow(lmad), min=0, max=3));

# have monte open a door (column3)

lmad[,3]=apply(lmad, 1, openDoor);

# results for keeping original choice [ expected 1 in 3 ]

lmad[,4]=apply(lmad, 1, function(v) {return (v[1]==v[2])});

# results for switching [ expected 2 in 3 ]

lmad[,5]=apply(lmad, 1, function(v) {return (v[1] == 6 - (v[2] + v[3]))});

#

# print results

#hist(lmad[,1], c(0,1,2,3));

#write(lmad, file="lmad.csv", sep=",");

#print(lmad)

print(sum(lmad[,4])/nrow(lmad));

print(sum(lmad[,5])/nrow(lmad));

}

19 March 2009 at 5:51 am

Hi Briggs,

Also contributing to the problem is our reluctance to “regret” our choices and, if given an opportunity, change our choices. See The Collapsing Choice Theory by Jeffrey M. Stibel, et. al.

I have taught computer programming and have used the Monte Hall Problem as an in-class assignment. The students’ simulations would always yield the result they expected rather than the correct result! I have posted on this here. As a software quality assurance engineer with an engineering-science background, and having examined many other simulations including from our national labs, I believe this effect is not necessarily confined to students.

19 March 2009 at 9:52 am

Mike D. says: 18 March 2009 at 10:29 pm

I’m actually surprised it took so long for someone to mention Marilyn. When you say that she “somehow got listed in Guiness . . .” I would suggest that the “somehow” was because she had the highest IQ ever recorded to that point. At that point, Parade magazine did a profile of her, including some questions, and the response was so positive that Parade invited her to do a regular column. Doesn’t seem to be much forethought on her part about “making a lot of dough.”

When she first posted the Game Show Problem, she got a lot of very condescending, and even sexist, flak from academic mathmeticians, but she stuck to her guns, eventually enlisting the aid of hundreds of high school science and math teachers, who, in thousands of trials, overwhelmingly and empirically proved her right.

You can get the complete story here:

http://www.marilynvossavant.com/articles/gameshow.html

Wikipedia also has a good entry on her.

19 March 2009 at 10:16 am

I was wondered whether this logic applies to the popular game show, Deal or No Deal. I don’t think it does.

In the show, the contestant picks one suitcase out of 25 at the start of the show. The suitcases contain various dollar amounts from $1.00 to one million dollars. He then eliminates the remaining suitcases one by one and learns what they contain as he eliminates them. If the contestant chooses to keep going he will eventually reach a point where the only suitcases remaining are his first choice and the last suitcase eliminated.

To make this interesting lets say the contestant reaches the end and knows that that one of the suitcases contains $1.00 and the other $1,000,000.

If I understand the analysis correctly, the Monty Hall solution would not apply to the Deal or No Deal situation because the contestant did not know before hand what is in the suitcases he chooses to eliminate. He is not like Monty Hall who knows and purposely eliminates all but the $1,000,000 suitcase. So at the end of the show, the chance that the contestant’s original choice is the $1,000,000 suitcase is 50/50.

Is this correct?

19 March 2009 at 11:48 am

Paul D I think that your question is interesting.

At the beginning of the game the chance of the million being in the contestant’s case was (if there were 20 cases) 0.05.

In your example at the end only two cases remain and we know that one contains a million and the other only a dollar, does that mean that the probability of the other case containing the million to be 0.95? On that reasoning the candidate should always swap.

Of course you are right when you say that the probability of the million being in either case is 0.5 . The whole point of the game show is that every time a case is opened that is not the million the chances of the million being in the contestant’s case increases. Therefore the value of offers will increase the longer the bigger prizes are not found in the opened cases. When there are only two cases left there the two prizes are each equally likely to be in either case.

In the Monty Hall problem, because the host knows which door has the big prize, a door being opened does not change the likelihood of the prize being behind the chosen door.

19 March 2009 at 4:19 pm

There is another cute probability problem which made the rounds years ago because its solution in some texts was wrong: You go to a house in which there are 2 children. You ring the doorbell and a boy answers. What is the probability that the other child is a boy?

19 March 2009 at 4:58 pm

Jack,

That one—there is more than one variant—is another from national treasure Martin Gardner. The the variant is: two kids, you learn at least one is a boy. What is the probability the other is a boy?

If you ever enter a used bookstore and see a Gardner on the shelf, grab it.

19 March 2009 at 7:02 pm

Increasing the number of doors, as Patrick Hadley suggested, is a great way to explain the problem. But if you are looking for a more visual example, a deck of cards works just as well.

You can demonstrate the problem with 52 ‘doors’, and work your way down to just 3. This method emphasizes that the thing to focus on is not all the doors you’ve opened (or cards you’ve revealed), but on the one you didn’t touch.

19 March 2009 at 10:03 pm

I remember actually “doing” the 1000 doors experiment many years ago with my dad. Well, it was 100, not 1000, and it was file folders, not doors. I took 100 empty folders and put a dollar in one of them. After dad chose one from the pile, I tossed aside 98 others and asked him if he wanted to switch. That convinced him.

However, I think there is still a difficulty with the way you present the problem. When you say

“What Monty does next: He opens a door; not the one you picked, and obviously not the one with the prize behind it and asks if you would like to keep your original door choice our would you like to switch?”

it’s not really clear if Monty is constrained to always do this or if he just chose one of the two remaining doors at random (50-50) and it just happened to be empty. The word “obviously” in there does help a bit.

Fundamentally, the problem is that it’s not clear from the presentation of the problem whether our prior knowledge is only that there is a prize behind exactly one of the doors, or if our prior knowledge also includes a strategy that Monty must always follow.

20 March 2009 at 1:01 am

I might and an easier way to state it:

You’re guaranteed to win if you choose the wrong door to begin with.

You’re guaranteed to loose only when you accidentally choose the correct door.

20 March 2009 at 10:03 am

I think most people confuse the possible outcome probabilities with the *which door* probabilities, meaning, they only see a Win or a Loss and Door {Win} and Door {Loss}, thus the thinking that the probability *must* be 50/50.

Reminds me of a problem that nailed everyone in high school becaue they couldn’t grasp the shifting frame of reference:

Three people go to a hotel, cost is $25, each gives $10 to bellhop (Total=$30).

The Bellhop keeps $2 in tip and gives each $1 back ($9 per person).

If each person paid $9 for a total of $27, and the bellhop has $2, for a total of $29, where’s the other dollar?

21 March 2009 at 2:44 am

Took me a while Wade but I finally got it. Each person paid $9 for a total of $27. But the bellhop’s $2 comes out of that $27, leaving $25 for the hotel. There never was a total of $29, so the problem as stated actually contains a lie, or at least a deliberate misdirection.

21 March 2009 at 10:21 pm

Ad,

Got it. (both anwers!) It’s a misdiretion. I’m thinking this is why people confuse the Monty Hall problem. They think the question is “what is the probability the prize is in one of two doors, the one you have already chosen, and another door.” The actual qestion is: “what is the probability the prize is behind one of 3 doors conditioned under the following rules…”

16 July 2009 at 11:18 pm

Probability and statistics don’t apply to single events. You either pick the right door or you don’t.Switching doesn’t help. When you say your chances improve by switching that is taken from information about multiple tries. If you were on Monte Hall every week for a year then you would probably win more times than not if you switch. However you could lose 10 times in a row just as you could flip a coin and get tails 10 times in a row. I understand why statistically you would win 2 out of three time in multiple attempts. But this doesn’t apply to a single event. You either win or you lose. If you switch and lose or don’t switch and win, how does knowing the statistics help you?

17 July 2009 at 5:17 am

What you said, Rodney, is false. Probability

doesapply to single events. At least, if you think about probability logically, the way we have analyzed the problem here.In classical frequentist statistics, it’s true that you cannot think of any number of events less than the limit, which is to say, infinite numbers of them. But since we’ve not yet—none of us—ever seen an infinite number of events, we’ll never be able to verify any frequentist claim. There is quite a large, and growing very quickly, number of us who reject frequentist philosophy and instead use probability in its logical sense. Have a look around for some other articles on the subject.

Gist is, since probability can apply to single events, we can use probability to analyze this problem.

20 April 2011 at 9:04 am

As I see it, the problem is whether or not Monty is constrained to open any doors at all. If the decision to open another door was made before the contestant chose, then the above analyses apply, but Monty did not ALWAYS open another door after a contestant chose. If Monty is free to make that choice then these probabilities no longer apply, as his decision may not be random at all. He could elect to open another door only when the contestant has chosen correctly.

20 April 2011 at 10:17 am

Greg Cavanagh,

I like your answer. It’s a better way to look at it I think. You have a 2/3 chance of picking the wrong door so,the chance that the remaining door contains the prize must be 2/3. Your selection makes two partitions: your door and the other two. You already know that one of them doesn’t contain the prize. Monty will show you which it is but that doesn’t change the probabilities because you didn’t get any new information.

20 April 2011 at 10:33 am

Briggs,

So according to your link, the contestant (obviously a potential door-trader) can only trade doors during trading hours, namely:

* 9am-8pm on weekdays;

* 9am-5pm on weekends and public holidays; or

* at no time on Christmas Day, Good Friday or Easter Sunday -

unless you invite a trader to come outside these times.

“invite a trader to come outside these times” must be one of those cute Ozzie phrases. I assume Monty’s show was prerecorded to take these times into account.

20 April 2011 at 12:21 pm

The probabilites are sensitive to your assumptions.

Monte knows which door holds the prize

Monte always shows a door with no prize.

The contrast between the Monte hall problem to the Deal or No Deal problem is a nice illustration.

Patrick Hadley alteration, I can find a large number of people who would insist that the probablity of the new car is behind door #1 never rises above 50%, whether 1 door or 98 doors are removed.

20 April 2011 at 2:38 pm

Somewhat off topic:

This month is the 250th anniversary of the death of the Englishman and Presbytarian minister, Thomas Bayes FRS. (He died 17th April 1761 in Tunbridge Wells, Kent).

Did I miss any posts on this …?

20 April 2011 at 5:55 pm

Suppose you did not know how the game worked. After Monty opens one door to show that nothing is behind it, you realize that you do not know if he opened the door BECAUSE nothing was behind it or if he just randomly selected one of the 2 possible doors. Now that is an interesting dilemma.

It seems likely that Monty would always chose a door with nothing behind it, because the game is more interesting that way. So you should always switch. But then again, perhaps Monty will ALWAYS open the door with the prize behind it (if he can), because then the gameshow wouldn’t have to give away a prize! Then you should always stay. Perhaps he could even have opened the door that you initally chose!

20 April 2011 at 9:36 pm

Classic. I’d like to see a post detailing parrondo’s paradox, as I have trouble understanding it…you have a way of making things rather clear.

21 April 2011 at 7:56 am

I’ve been thinking about Monty selecting a door randomly and then, if it didn’t shield the prize, ask if you want to switch. It seems to me that the probability the prize is behind the remaining door is still 2/3 because you didn’t learn anything new. Obviously, if the opened door had the prize the question would be moot. Finding it doesn’t have the prize is indistinguishable from Monty being forced to open it because it had none. Why then would it matter if he had chosen randomly?

Consider the following possibilities (assume the prize is behind door C and the contestant’s pick is to the left of the line.

A | B C

B | A C

C | A B

If Monty fails to open door C, what would have changed that makes it different from Monty restrained from opening C? Note that C appears twice on the right and only once on the left. IOW: regardless of what Monty does, C has a 2/3 probability of being on the right due to the initial conditions. The way I see it, if there is only a single door on the right it has a 2/3 probability of containing the prize .

21 April 2011 at 8:21 am

I think I may have the answer. Assume X is the opened door randomly selected (whatever that means) by Monty.

A | x C … A | B x

B | x C … B | A x

C | x B … C | x B

There are only 2/6 outcomes that the unopened door was C and 2/6 outcomes where C was originally chosen assuming, of course, that Monty’s random choice would be uniformly made. Obviously, it helps to count ALL of the outcomes.

Now, what if you don’t know how Monty makes his selections

21 April 2011 at 8:53 am

I’m curious. If we were to put people in this situation and test whether they knew about the stats of this problem or not, would they switch doors anyway. My guess (again, no data on this – does anyone have any?) would be that people would start second-guessing themselves and then switch anyway.

Besides, we all know that if you choose a wrong door, Monty Hall realizes this, and then proceeds with the game. If you choose the right, prize door, then Monty Hall opens up another door to encourage you to switch to the other – ‘dud’ door.

The lesson? To quote Brain Guy, “It’s a trick. You can’t win.”

21 April 2011 at 9:36 am

Tom:

Parrondo’s Paradox is trivial, unless someone else can think of a profound example… my understanding of it is that there is a game that, played forever, you can not profit from playing. But there ARE times when you can predictably profit. Then the trick is to play the game when you know you’ll profit, and get out before you start losing.

An example would be a game where if you have an even number of dollars, you gain 3 dollars, but if you have an odd number of dollars, you lose it all. When you have an odd number of dollars, a winning strategy would be to give $1 away and then continue playing the game.

25 April 2011 at 10:11 am

jack mentioned the “curious case of the child who answered the door” so here’s a bit of code. I’ve tried to make it all as explicit as possible and to go for complete enumeration. But it gives the wrong answer. Or does it? Probability would be fun if tiny subtleties of language or code didn’t dramatically change the answer.

nfamilies = 10000

# Simulate a set of families

families = data.frame(t(replicate(nfamilies,sample(c('b','g'),2,replace=T))))

names(families) = c("child1","child2")

# Select one child to open the door

# We have no information about how the child is selected

dopener = replicate(nfamilies,sample(1:2,1))

families = transform(families,dooropener=dopener)

# Determine the gender of the child opening the door

families = transform(families,genopener=ifelse(dooropener==1,as.character(child1),as.character(child2)))

# And of the other child

families = transform(families,genother=ifelse(dooropener==1,as.character(child2),as.character(child1)))

# Select only families where a boy opened the door

bopen = subset(families,genopener=='b')

# and tabulate the gender of the other child

print(table(bopen$genother))

14 December 2012 at 3:36 pm

Re “case of the child who answered the door” (jack mosevich):

I’d say the probability of the other child being a boy as well is ~50%.

14 December 2012 at 9:32 pm

I just figure that my initial pick is probably wrong. Once Monty has eliminated a room the remaining one is probably right.

Or if there were 100 doors and you picked one… and then Monty opened 98…

15 December 2012 at 4:49 am

Martin Gardner’s books have had a significant effect on my life, I believe. I try to keep in mind his dogged persistence in taking a puzzle or problem, once solved, to the next level, by asking new questions. As a reader, he never let you get too comfortable in the knowledge you were acquiring, showing that there’s always a next step to those willing to accept the challenge.

I believe it was from one of Martin Gardner’s books that I first learned of one counter-intuitive example of probability that has served me well. It was the classic story of the gambler who slowly went broke betting that he would throw at least one double-six on twenty throws of a pair of dice. (The key insight I picked up was to rephrase the problem to use the word “and” instead of the word “or”; you can then multiply probabilities of independent events to get a combined probability of whatever you’ve combined with the “ands”.)

Unfortunately, not many of the Martin Gardner titles I remember so fondly are available for my Kindle yet.

15 December 2012 at 12:36 pm

I always did that boy-answering-door as a hamster-meister reaching blindly into a bag containing two randomly selected hamsters from the hamster barrel. The customer asks whether he has a matched set or a mixed pair and the hamstermeister says he didn’t look but he knows from touch that one of them was male.

So there are four equiprobable events in the original population. (It’s a population of pairs, not of single hamsters.)

MM

MF

FM

FF

and the hamstermeister’s

non-probabilisticinformation eliminates FF from theevent population.So we have

MM

MF

FM

equiprobable events, and in 2 of the 3 the Other Hamster is female.

16 December 2012 at 8:31 pm

TOF,

I hesitate to insert my oar between statisticians enjoying a private joke, but isn’t that a separate problem? To make a judgement in the hamster case you must first know that the barrel contains two sex-matched pairs. There is no such constraint in the “two children” problem, so Wolfgang’s answer is correct. Or am I being stupid?

17 December 2012 at 12:33 pm

Monte Hall, in actual game show of lets make a deal, Monte Hall’s behavior was not so predictable. Some days there would be a car behind door A and a bedroom set behind door B and a $1,000 cash behind door C. The contestant would would be told that there is a car behind one of the doors, but the other doors could be a prize or a no-prize. Furthermore, Monte does not alwasy open a door not chosen before allowing a final switch. It makes the results more difficult to model.

17 December 2012 at 12:41 pm

Regarding the boy opens the door. In this case the information given doesn’t tell you anything about the child that has not been met. So 50% that it is a boy.

The hamster problem, once you are told taht one of the hamsters is male you have satified one of the necessary conditions toward having a mixed pair.

Back to the house with the boys.. Suppose you had been told that there was at least one boy in the house. You can reason that there is a 1/3 chance that both children are boys and a 2/3 chance that it is a mixed pair. (like the hamster problem) However, once you meet one boy, there is a 50% chance that the child that you have not met is a boy.

28 December 2012 at 12:47 am

Excuse me, but I think that the surgical resident was correct.

The probability of guessing whether the prize is behind door A or C

ONCE door B IS OPEN is 1/2.

The probability of guessing the correct door with two tries BEFORE a door is opened is 2/3.

Your explanation was “Suppose that instead of A you had first picked door B. Which doors could Monty have opened? Right: only A. And again you should have switched.”

How can that be part of the explanation of the odds when DOOR B is ALREADY

OPEN?

Please let me know if I am incorrect.

28 December 2012 at 12:58 am

Chet,

You are incorrect.

28 December 2012 at 6:45 am

Your explanation was “Suppose that instead of A you had first picked door B. Which doors could Monty have opened? Right: only A. And again you should have switched.”

How can that be part of the explanation of the odds when DOOR B is ALREADY

OPEN?

Please let me know how I am incorrect.