BookmarkSubscribeRSS Feed
Stacy
Calcite | Level 5

Please can anyone help me with this question.

The Monty Hall problem is named for its similarity to the Let's Make a Deal television
game show hosted by Monty Hall.
The problem is stated as follows. Assume that a room is equipped with three doors.
Behind two are goats, and behind the third is a car.
You are asked to pick a door, and will win whatever is behind it.
Let's say you pick door1. Before the door is opened, however, someone who knows what's behind the doors
(Monty Hall) opens one of the other
two doors, revealing a goat, and asks you if you wish
to change your selection to the third door (i.e., the door which neither you picked nor he
opened).
The Monty Hall problem is deciding whether
you
change your selection or not
that has a better chance of winning the car
.
It’s common sense that if not to change, the
probability of winning is 1/3 but what about changing the selection.
Simulating this game using SAS, for each round, program the fol
lowing,
1)
Assigning two goats and a car to three doors randomly
2)
Picking a door randomly
3)
Picking one of the two remaining doors to open but must showing the goat
4)
Changing the selection to the remaining door
5)
Deciding the result
Repeating these steps for 100
rounds
,
generating a data set including the following five
variables, the round number, the door the car is in, the door chosen initially, the door
chosen after switching,
and
the result(win/lose). Showing the data set and reporting the
frequency
of the initial door chosen, the frequency of the door chosen at the end, the
average rate of winning.
6 REPLIES 6
PaigeMiller
Diamond | Level 26

There are plenty of explanations/solutions of the Monty Hall problem out there on the internet, including Wikipedia.

 

But it isn't clear why you are posting this in a SAS forum. Are you trying to simulate the results? What is the actual question you are asking?

--
Paige Miller
Stacy
Calcite | Level 5

I am stuck on writing a code to assign two goats and a car to three doors randomly. I'm just not sure about the right code for this particular one

PeterClemmensen
Tourmaline | Level 20

This is a nice starting point.

PaigeMiller
Diamond | Level 26

While I realize this is a homework problem ... the mathematician in me wants to say that the best and most convincing solution does not involve any simulation at all. This problem can be solved simply by computing probabilities of each event.

--
Paige Miller
data_null__
Jade | Level 19

@Stacy wrote:

I am stuck on writing a code to assign two goats and a car to three doors randomly. I'm just not sure about the right code for this particular one


 

You could use this code to generate a number of randomizations of the prize.

 

proc plan ordered seed=89768;
   factors rep=10 door=3 / noprint;
   treatment prize=3 random;
   output out=want prize cvals=('Goat' 'Goat' 'Car');
   run;
   quit;
Reeza
Super User

IML solution

https://blogs.sas.com/content/iml/2015/04/01/monty-hall.html

 

Data step approach - Single iteration

http://www.sascommunity.org/wiki/Monty_Hall,_Paul_Erd%C3%B6s,_and_Monte_Carlo

 

SAS & Python

https://blogs.sas.com/content/sgf/2016/10/12/the-monty-hall-paradox-sas-vs-python/

 


@Stacy wrote:

Please can anyone help me with this question.

The Monty Hall problem is named for its similarity to the Let's Make a Deal television
game show hosted by Monty Hall.
The problem is stated as follows. Assume that a room is equipped with three doors.
Behind two are goats, and behind the third is a car.
You are asked to pick a door, and will win whatever is behind it.
Let's say you pick door1. Before the door is opened, however, someone who knows what's behind the doors
(Monty Hall) opens one of the other
two doors, revealing a goat, and asks you if you wish
to change your selection to the third door (i.e., the door which neither you picked nor he
opened).
The Monty Hall problem is deciding whether
you
change your selection or not
that has a better chance of winning the car
.
It’s common sense that if not to change, the
probability of winning is 1/3 but what about changing the selection.
Simulating this game using SAS, for each round, program the fol
lowing,
1)
Assigning two goats and a car to three doors randomly
2)
Picking a door randomly
3)
Picking one of the two remaining doors to open but must showing the goat
4)
Changing the selection to the remaining door
5)
Deciding the result
Repeating these steps for 100
rounds
,
generating a data set including the following five
variables, the round number, the door the car is in, the door chosen initially, the door
chosen after switching,
and
the result(win/lose). Showing the data set and reporting the
frequency
of the initial door chosen, the frequency of the door chosen at the end, the
average rate of winning.

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1230 views
  • 3 likes
  • 5 in conversation