Please can anyone help me with this question.
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?
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
This is a nice starting point.
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.
@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;
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 televisiongame 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 othertwo doors, revealing a goat, and asks you if you wishto change your selection to the third door (i.e., the door which neither you picked nor heopened).The Monty Hall problem is deciding whetheryouchange your selection or notthat has a better chance of winning the car.It’s common sense that if not to change, theprobability of winning is 1/3 but what about changing the selection.Simulating this game using SAS, for each round, program the following,1)Assigning two goats and a car to three doors randomly2)Picking a door randomly3)Picking one of the two remaining doors to open but must showing the goat4)Changing the selection to the remaining door5)Deciding the resultRepeating these steps for 100rounds,generating a data set including the following fivevariables, the round number, the door the car is in, the door chosen initially, the doorchosen after switching,andthe result(win/lose). Showing the data set and reporting thefrequencyof the initial door chosen, the frequency of the door chosen at the end, theaverage rate of winning.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.