Jump to content
Science Forums

Calculate the odds


Christopher

Recommended Posts

Lets enumerate the possible situations (as I've been suggesting you do. I'll do it for you). The prize door is labeled good, the non-prize door is labled bad.

 

A B C

good bad bad

bad good bad

bad bad good.

 

Now, lets say you pick door A. In the case of the top row, switching is bad. However, in the case of the other two, switching nets you the prize. So, if you pick door A, and then switch, 2/3 of the time you get the prize. The same is true for any other initial selection.

 

The reason your logic (which says all doors have a 2/3 chance before, and so 1/2 after) fails is because Monty knows where the car is. He will not open the door with the car.

-Will

Link to comment
Share on other sites

We should change from c to b increasing our odds of becoming a billionaire from 1 in three to 1 in two.
I think this should read “We should change from c to b increasing our odds of becoming a billionaire from 1 in 3 to 2 in 3.”

 

For any remaining skeptics, here’s source code and output for 1,000,000 trials of each strategy

USER>s W=0 f C=1:1:100000 s A=$r(3)+1,G=$r(3)+1 s:A=G W=W+1

USER>w W/C," "
.33088 
USER>s W=0 f C=1:1:100000 s A=$r(3)+1,G=$r(3)+1,E=A_G s:E=11 G=3 s:E=12 G=1 s:E=13 G=1 s:E=21 G=2 s:E=22 G=3 s:E=23 G=2 s:E=31 G=3 s:E=32 G=3 s:E=33 G=2 s:A=G W=W+1

USER>w W/C," "
.66828

Link to comment
Share on other sites

Lets enumerate the possible situations (as I've been suggesting you do. I'll do it for you). The prize door is labeled good, the non-prize door is labled bad.

 

A B C

good bad bad

bad good bad

bad bad good.

 

Now, lets say you pick door A. In the case of the top row, switching is bad. However, in the case of the other two, switching nets you the prize. So, if you pick door A, and then switch, 2/3 of the time you get the prize. The same is true for any other initial selection.

 

The reason your logic (which says all doors have a 2/3 chance before, and so 1/2 after) fails is because Monty knows where the car is. He will not open the door with the car.

-Will

 

Hmm, I can see that. I don't however see how you are using Bayes Theorum here. In the fashion above you have proven that whatever I choose in the first round, I should choose to change my number from the start. This then raises the question, aren't I then chosing two answers at the start and really only making a decision after one has been removed. Wouldn't this decision then be based upon two remaining answers for which I have a 50/50 chance?

 

Also, why haven't you commented on the data I posted earlier?

 

***********# of Players********Winners*******%

Switched *******155317**********9187****** 5.9

Didn't Switch **-25621911***** -12907113***** 50.4

 

This shows that out of the 25,000,000 people who played and chose to keep their first answer, they won 50% of the time. Of the 155,000 who chose to switch only 5.9% of them won. Seems pretty heavily stack the other way. I have a feeling though that if you were to get another 25,000,000 results for the switched you would get nearly 50% for that one too.

 

Anyone want to overload the server by playing this game 25,000,000 times, switching doors every time? (Not really necessary, because we can use the stats from the bottom line, about 50% of them should have switched to win.)

Link to comment
Share on other sites

Hmm, I can see that. I don't however see how you are using Bayes Theorum here. In the fashion above you have proven that whatever I choose in the first round, I should choose to change my number from the start. This then raises the question, aren't I then chosing two answers at the start and really only making a decision after one has been removed. Wouldn't this decision then be based upon two remaining answers for which I have a 50/50 chance?

 

I'm not using Bayes theroem in argument above. I went to straight enumeration of the possibilities, as that is always the easiest way to see probabilities. And no, you aren't making two choices at the begininng. You make a choice (only one), then Monty opens a door, then you switch. The key is that Monty opens a door. If you picked, then immediately switched, you haven't done anything but change your initial choice, you still only have a 2/3 shot. You need Monty to open the door.

 

Also, why haven't you commented on the data I posted earlier?

 

***********# of Players********Winners*******%

Switched *******155317**********9187****** 5.9

Didn't Switch **-25621911***** -12907113***** 50.4

 

This shows that out of the 25,000,000 people who played and chose to keep their first answer, they won 50% of the time. Of the 155,000 who chose to switch only 5.9% of them won. Seems pretty heavily stack the other way. I have a feeling though that if you were to get another 25,000,000 results for the switched you would get nearly 50% for that one too.

 

Its not 50%! Its 2/3 and 1/3! Are will you argue with my above enumeration of the possible states? And there seems to be something wrong with the code. Notice that the number of didn't switches is apparently negative.

 

Not really necessary, because we can use the stats from the bottom line, about 50% of them should have switched to win.

 

I believe I demonstrated in my last post that switching gives you a 2/3 chance of winning. As I said, his code appears flawed, notice the negative number of participants. I gave a mini-lecture on this to a group of grade school kids. With the 50 of them each doing 1 trials, we were fairly close to the 2/3, 1/3.

-Will

Link to comment
Share on other sites

If Monty did show you a wrong door and then you'd have to choose then it would be 1/2. However, if you choose a door first and then Monty reveals a "bad" door then it's 1/3. And 2/3 if you change it.

 

Let's say: Option A is the winner option. And you pick the first door.

 

Door # 1 Door # 2 Door # 3

A B C

A C B

B A C

B C A

C A B

C B A

 

Now, you have 2/6 or 1/3 chances of winning if you choose the first, or any door. Let's stay on the first.

 

 

If you choose the first and it has prize A behing it; then Monty reveals the content behind any of the other two doors, then you will lose if you switch. This, however, has a 1/3 chance.

 

Now, if it was prize B or C. Then Monty will unveil a losing door, and if you switch, you will win. This, has a 2/3 chances of happening.

 

I hope that clears it up. :)

Link to comment
Share on other sites

How do you get 2 in 3 ? you have two coins, you know one is tail, and one is head's that's a 1 in 2 chance for b.
To be clear, I was referring to the following game:

A single winning coin is placed under 1 of 3 shells. The GM knows which one. You do not.

You pick a shell (G).

The GM removes a shell (A) that 1) has a non-winning coins under it; 2) you did not pick.

You may keep you original pick (G), or change it to the remaining shell (B).

 

The possible outcomes, each of which is equally likely, are:

Winning coin is in A, Guess A, Don’t change = WIN, Change = LOSE;

Winning coin is in A, Guess B, Don’t change = LOSE, Change = WIN;

Winning coin is in A, Guess C, Don’t change = LOSE, Change = WIN;

Winning coin is in B, Guess A, Don’t change = LOSE, Change = WIN;

Winning coin is in B, Guess B, Don’t change = WIN, Change = LOSE;

Winning coin is in B, Guess C, Don’t change = LOSE, Change = WIN;

Winning coin is in C, Guess A, Don’t change = LOSE, Change = WIN;

Winning coin is in C, Guess B, Don’t change = LOSE, Change = WIN;

Winning coin is in C, Guess C, Don’t change = WIN, Change = LOSE.

 

So the “don’t change” strategy has a 3/9 chance of winning, the “change” strategy, 6/9.

 

I’m really more of an empirical guy when it comes to potentially tricky questions, preferring to just write a quick “agent” program and see what results it produced - .33088 and .66828 for the quick million trials I ran. Once I got that result, I had confidence in the enumeration argument I make above.

Link to comment
Share on other sites

The problem with writing a program is that it follows whatever rule you set forth. You forced the program to run this test based upon the parameters you set forth.

 

Try writing a program that choses a door, a door that is wrong is then removed. Then tell the program to totally ignore it's first choice and choose one of the two remaining. Now of course for this to work you also have to have the program randomly putting the prize behind different doors. Or possibly you could put the prize behind the same door, and make sure that the computer randomly chooses that first door. Of course random in the computer world isn't exactly truely random, but a fair approximation I believe. To get a true data set however, you have to get it to do both, randomly place the prize behind a door and randomly select that first door.

 

You'll see in writing this program, that when you tell it to chose on of the doors randomly, you'll have to tell each door to weight each door 50/50. Otherwise you'll be telling the program which door to chose based upon the initial information and not upon the new information of a door being removed.

 

Put it this way. You are basing your 1/3 2/3 off of the original configuration of the doors. Take away one wrong door from each sample and you are left with one right and one wrong.

 

a=right b=wrong

a=right c=wrong

a=wrong b=right

b=right c=wrong

a=wrong c=right

b=wrong c=right

 

Seems like each one above has a 2/4 chance of being right and a 2/4 chance of being wrong to me.

 

Edit: Note all the above situations are all the possible situations you could be faced with. You only have two doors to choose from after one has been taken away. The doors will then have to be a&b, a&c, or b&c. And for each case, one is right or one is wrong.

Link to comment
Share on other sites

I'm not using Bayes theroem in argument above. I went to straight enumeration of the possibilities, as that is always the easiest way to see probabilities. And no, you aren't making two choices at the begininng. You make a choice (only one), then Monty opens a door, then you switch. The key is that Monty opens a door. If you picked, then immediately switched, you haven't done anything but change your initial choice, you still only have a 2/3 shot. You need Monty to open the door.

 

 

 

Its not 50%! Its 2/3 and 1/3! Are will you argue with my above enumeration of the possible states? And there seems to be something wrong with the code. Notice that the number of didn't switches is apparently negative.

 

 

 

I believe I demonstrated in my last post that switching gives you a 2/3 chance of winning. As I said, his code appears flawed, notice the negative number of participants. I gave a mini-lecture on this to a group of grade school kids. With the 50 of them each doing 1 trials, we were fairly close to the 2/3, 1/3.

-Will

 

I know I've sort of already posted an answer to this above, but i hadn't read this post, somehow i missed it. Doing 50 trials were you get about 2/3 chance of winning when you switch is nice. Of course i could flip a coing 100 times and get 75 to be heads. Guess that means that flipping a coin has a 3/4 chance of being heads.

Now should I flip a coin a billion times and it comes up with 750 million heads, then I'd say we have to figure out what is causing the particular coin to come up heads. This i've pointed out is probably the flaw in your code that gave you the .33 and .66 odds in 100000 trials.

Why are you concerned with the negative. When I write a code, I want the program to poll that first step and simply add a number to a previous value. So I tell it to assign the choice to switch with a positive value and add it to the previous number of people who had switched. But if they choose to keep the same door I tell the program to assign a negative value to that response and add it to the previous (negative) number of people who chose to remain with the same door. That way he can make a declination between the two answers.

Link to comment
Share on other sites

Lets enumerate the possible situations (as I've been suggesting you do. I'll do it for you). The prize door is labeled good, the non-prize door is labled bad.

 

A B C

good bad bad

bad good bad

bad bad good.

 

Now, lets say you pick door A. In the case of the top row, switching is bad. However, in the case of the other two, switching nets you the prize. So, if you pick door A, and then switch, 2/3 of the time you get the prize. The same is true for any other initial selection.

 

The reason your logic (which says all doors have a 2/3 chance before, and so 1/2 after) fails is because Monty knows where the car is. He will not open the door with the car.

-Will

I could also respond to this post by pointing out why in the first line if I chose and stick with A then the following is true.

1) Chose A, monty takes away door B, stick with A, WIN.

2) Chose A, monty takes away door C, stick with A, WIN.

see I actually have two chances to win by chosing and sticking with A, whereas in either case if I chose to change, then I lose.

Link to comment
Share on other sites

The problem with writing a program is that it follows whatever rule you set forth. You forced the program to run this test based upon the parameters you set forth.
This is a valid objection when the behavior to be modeled is complicated, and/or described in vague natural language. The behavior of the 2 agents in the Monty Hall problem, however, are simple and well defined, and thus easy to model.
Try writing a program that choses a door, a door that is wrong is then removed. Then tell the program to totally ignore it's first choice and choose one of the two remaining.
This isn’t the Monty Hall problem! If Contestant forgets his first guess when making his second, the problem becomes just “pick one of two”, which, you correctly state, Contestant has a ½ chance of winning. Another way of looking at it is, if Contestant can’t remember his first pick, he has a 50/50 chance of changing (2/3 chance of winning) or not changing (1/3 chance), so his chance of winning is the average of the 2, ½.

 

The Monty Hall problem begins: Monty chooses a winning door and doesn’t tell Contestant; Contestant chooses a door; Monty eliminates a door that is neither the winning one, nor the one Contestant chose; Contestant either changes or doesn’t change choice …

 

Here’s a short program that plays 1,000,000 games using the “Contestant always changes” and “Contestant never changes” behaviors. I’ve added comments, and used language features to assure that the agents can’t know what they shouldn’t

r M1,P1,M2,P2 ;get agent behaviors
s A=$r(N) ;monty randomly places prize
s G=$r(N) ;contestant randomly guesses prize
f I=0:1:N i I'=A,I'=G q  ;monty removes non-prize (knowing A)
n (N,G,I,J) s C=$r(N-2) f J=0:1:3 i J'=I,J'=G q:'C  s C=C-1  ;contestant changes guess
s N=3,W=0 f C=1:1:1000000 x M1,P1,M2,P2 s:J=A W=W+1 ;play game 1M times
w W/C ;show fraction of wins
r P2 ;get new agent behavior
;contestant doesn't change guess
s N=3,W=0 f C=1:1:1000000 x M1,P1,M2,P2 s:J=A W=W+1 ;play game 1M times
w W/C ;show fraction of wins

It’s output was .666234 and .332581, as expected.

Now of course for this to work you also have to have the program randomly putting the prize behind different doors. Or possibly you could put the prize behind the same door, and make sure that the computer randomly chooses that first door. Of course random in the computer world isn't exactly truely random, but a fair approximation I believe. To get a true data set however, you have to get it to do both, randomly place the prize behind a door and randomly select that first door.
I could argue here that only the placement of the prize, or Contestant’s guess needs to be random, dragging in Math formalism about discrete uniform random variables, but, with modeling, all I need do is change the behavior of an agent and see if the trial changes, thus:
r P1,P2 ;get new agent behaviours
s G=0 ;contestant always guesses 1st door
n (N,G,I,J) s C=$r(N-2) f J=0:1:3 i J'=I,J'=G q:'C  s C=C-1  ;contestant changes guess
s N=3,W=0 f C=1:1:1000000 x M1,P1,M2,P2 s:J=A W=W+1 ;play game 1M times
w W/C ;show fraction of wins

This outputted .666648, close enough to the first run to convince me.

 

There’s really not more to it than that. One can modify the model to allow for more than 3 doors, more than 1 prize, and/or more than 2 guesses, but the counterintuitive goodness of the problem isn’t much enhanced.

 

As a last resort, I can appeal to authority: this wikipedia articleagrees that the “Contestant always switches” behavior has a 2/3 chance of winning. But that’s cheating, no? B)

 

Off topic, the usefulness of this kind of modeling has for many years subtly disturbed me. I could write code like this when I was a beardless lad of 15. 10 years and much travail later, I was a “trained Mathematician”, and could argue with some conviction in a more formal way. Practically, though, with compute resources cheap and plentiful, one might ask “why bother?” Much of the most elegant and beautiful Math is rendered irrelevant by the availability of cheap, reliable brute force computing. B)

Link to comment
Share on other sites

I could also respond to this post by pointing out why in the first line if I chose and stick with A then the following is true.

1) Chose A, monty takes away door B, stick with A, WIN.

2) Chose A, monty takes away door C, stick with A, WIN.

see I actually have two chances to win by chosing and sticking with A, whereas in either case if I chose to change, then I lose.

 

Clearly mathematical reasoning isn't working to convince you. Please run your own trials. Write a short code, or borrow Craig D's. You will see, beyond any doubt, the probabilities are 2/3 and 1/3.

-Will

Link to comment
Share on other sites

Put it this way. You are basing your 1/3 2/3 off of the original configuration of the doors. Take away one wrong door from each sample and you are left with one right and one wrong.

 

a=right b=wrong

a=right c=wrong

a=wrong b=right

b=right c=wrong

a=wrong c=right

b=wrong c=right

 

Seems like each one above has a 2/4 chance of being right and a 2/4 chance of being wrong to me.

 

Edit: Note all the above situations are all the possible situations you could be faced with. You only have two doors to choose from after one has been taken away. The doors will then have to be a&b, a&c, or b&c. And for each case, one is right or one is wrong.

Could you also reply to this post?

 

I also understand the premise of programming. That is to set rules for the program to obey and let it run it's course. I once wrote a program for a prefessor, having had no experience whatsoever writing programs, except for a couple of simple spreadsheets to make calculations for my brothers farm business. However I believe you'll understand my attempt at explaining what it was. First, it was a Monte Carlo simulation (not totally sure what that means). Second it was to computer something to do with switching magnetic fields in a material (it was for a thermodynamics class). Having no experience, I had a friend help me with the writing of the program. Once he showed me the basics of the program I wanted to write, I made a couple of modifications to make the data different. The problem was that I was getting a hang up point where the system would settle when I knew that the problem I was working on couldn't settle. The problem, boundary conditions.

 

The point of this rant, I can't just read your program above and fully understand it, so I'll have to leave that to a computer programmer to tell me if there is any subtle point which you are missing from your very simplistic program. Don't get me wrong the problem should be simplistic, after all we are just choosing a door and then choosing whether to keep that door or switch.

 

Anyway, after a couple of hours staring at all the different outputs of my many different changes (also taking several hours of changes) I finally stumbled upon a solution that made my program mimic real life. Then I found out that so had several others in my class, oh well.

Link to comment
Share on other sites

Clearly mathematical reasoning isn't working to convince you. Please run your own trials. Write a short code, or borrow Craig D's. You will see, beyond any doubt, the probabilities are 2/3 and 1/3.

-Will

 

Ok let me write them all out.

A is right

Choose A, Monty removes B, stick with A, win.

Choose A, Monty removes C, stick with A, win.

Choose B, Monty removes C, stick with B, lose.

Choose C, Monty removes B, stick with C, lose.

 

B is right

Repeat above choices swapping B for A.

 

C is right

Repeat above choices swapping C for A.

 

Hmmm, seems like all possible sets have a 50/50 chance of winning if I stick with my original choice.

Link to comment
Share on other sites

Ok let me write them all out.

A is right

Choose A, Monty removes B, stick with A, win.

Choose A, Monty removes C, stick with A, win.

Choose B, Monty removes C, stick with B, lose.

Choose C, Monty removes B, stick with C, lose.

 

B is right

Repeat above choices swapping B for A.

 

C is right

Repeat above choices swapping C for A.

 

Hmmm, seems like all possible sets have a 50/50 chance of winning if I stick with my original choice.

 

Except the possibilities are about what you pick, not Monty.

 

You pick door A. Stick with A win.

You pick door B. Stick with B lose.

You pick door C. Stick with C lose.

 

You can only pick door A, B or C. Those are all the possibilties for the prize in door A.

-Will

Link to comment
Share on other sites

From Wikipedia, the free encyclopedia.

Jump to: navigation, search

 

In search of a new car, the player picks door 3. The game host then opens door 1 to reveal a goat and offers to let the player pick door 2 instead of door 3.The Monty Hall problem is a puzzle in game theory involving probability that is loosely based on the American game show Let's Make a Deal. The name comes from the show's host, Monty Hall. In this puzzle a player is shown three closed doors; behind one is a car, and behind each of the other two is a goat. The player is allowed to open one door, and will win whatever is behind the door. However, after the player selects a door but before opening it, the game host (who knows what's behind the doors) must open another door, revealing a goat. The host then must offer the player an option to switch to the other closed door. Does switching improve the player's chance of winning the car? The answer is yes — switching results in the chances of winning the car improving from 1/3 to 2/3.

 

The problem is also called the Monty Hall paradox, in the sense that the solution is counterintuitive, although the problem does not yield a logical contradiction

 

 

My mistake it is 2/3 not 1/2 oop"s B)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...