Question

In: Advanced Math

Consider the Monty Hall problem.Verify the results using by writing a computer program that estimates the...

Consider the Monty Hall problem.Verify the results using by writing a computer program that estimates the probabilities of winning for different strategies by simulating it.

1. First, write a code that randomly sets the prize behind one of three doors and you also randomly select one of the doors. You win if the the door you selected has the prize (Here, we are simulating ’stick to the initial door’ strategy). Repeat this experiment 100 times and compute the average number of wins.

2. Next, try simulating the switching strategy. Find the door the host will open and change your initial door with the door not opened by the host. Also repeat this experiment 100 times and compute the average number of wins. If you did everything right, the first code should yield the probability of winning as ≈ 1/3 and the second code should yield ≈ 2/3. You can use any programming language you want (MATLAB, Python etc.)

Solutions

Expert Solution


%%Monty Hall problem
clear all
close all

%1st type with 100 numbers of simulations
val=0; %initial value
for i =1:100
  
    %choosing random number between 1 and 3
    %prize door
    prize_door = randperm(3,1);
    %my choice
    my_door = randperm(3,1);
  
    if prize_door==my_door
        val=val+1;
    end
  
end
%probability
prob=val/100;
fprintf('Average number of win for 1st problem =%f\n',prob)

%1st type with 100 numbers of simulations
val=0; %initial value
for i =1:100
  
    %choosing random number between 1 and 3
    %prize door
    prize_door = randperm(3,1);
    %my choice
    my_door = randperm(3,1);
  
    if prize_door~=my_door
       val=val+1;
    end
  
end
%probability
prob=val/100;
fprintf('Average number of win for 2nd problem =%f\n',prob)

%%%%%%%%%%%%%%%% END OF CODE %%%%%%%%%%%%%%%


Related Solutions

Using Rstudio # 1. Monty-Hall Three doors Recall the Monty-Hall game with three doors, discussed in...
Using Rstudio # 1. Monty-Hall Three doors Recall the Monty-Hall game with three doors, discussed in class. Run a simulation to check that the probablility of winning increases to 2/3 if we switch doors at step two. Set up the experiment two functions "monty_3doors_noswitch" and "monty_3doors_switch" (these functions will have no input values): ```{r} monty_3doors_noswitch <- function(){    } monty_3doors_switch <- function(){    } ``` Use your two functions and the replicate function to compute the empirical probablility of winning...
1. (a) Consider a modified version of the Monty Hall problem. In this version, there are...
1. (a) Consider a modified version of the Monty Hall problem. In this version, there are 8 boxes, of which 1 box contains the prize and the other 7 boxes are empty. You select one box at first. Monty, who knows where the prize is, then opens 6 of the remaining 7 boxes, all of which are shown to be empty. If Monty has a choice of which boxes to open (i.e. if the prize is in the box you...
1. (a) Consider a modified version of the Monty Hall problem. In this version, there are...
1. (a) Consider a modified version of the Monty Hall problem. In this version, there are 8 boxes, of which 1 box contains the prize and the other 7 boxes are empty. You select one box at first. Monty, who knows where the prize is, then opens 6 of the remaining 7 boxes, all of which are shown to be empty. If Monty has a choice of which boxes to open (i.e. if the prize is in the box you...
(a) In the Monty Hall problem with 100 doors, you pick one and Monty opens 98...
(a) In the Monty Hall problem with 100 doors, you pick one and Monty opens 98 other doors with goats. What is the probability of winning (assuming you would rather have a car than a goat) if you switch to the remaining door? Explain your answer. (b) Suppose Monte opens 98 doors without checking for cars. What is the probability that, once the doors are open, changing your choice will not change your chances of winning.
C++ questions about Monty Hall Problem, please make sure to divide the program into functions which...
C++ questions about Monty Hall Problem, please make sure to divide the program into functions which perform each major task. Imagine yourself on the set of a game show. You're given the choice of three doors. Behind one of the doors is a car you can drive home in if you guess correctly. Behind the other two doors are goats. After you initially guess the door, the host of the game show (who knows the door holding the car) opens...
Monty hall Problem Explain the statistical probabilities associated with the game show
Monty hall Problem Explain the statistical probabilities associated with the game show
Recall the Monty Hall problem as presented in class. There are three caves, two of which...
Recall the Monty Hall problem as presented in class. There are three caves, two of which contain dragons and one of which is a hiding princess. The prince chooses a cave and a wizard (truthfully) reveals to the prince that one of the other caves has a dragon. 2 The prince now has the option to switch to the other cave (the one he didn’t choose and wasn’t revealed to have a dragon), and try his luck finding the princess...
Recall the Monty Hall problem as presented in class. There are three caves, two of which...
Recall the Monty Hall problem as presented in class. There are three caves, two of which contain dragons and one of which is a hiding princess. The prince chooses a cave and a wizard (truthfully) reveals to the prince that one of the other caves has a dragon. 2 The prince now has the option to switch to the other cave (the one he didn’t choose and wasn’t revealed to have a dragon), and try his luck finding the princess...
2. (Monty Hall) Suppose you are on a game show and are presented with three closed...
2. (Monty Hall) Suppose you are on a game show and are presented with three closed doors marked door 1, 2, and 3. Behind one door is a prize and behind the other two are goats. Suppose the host allows you to select one door, but the following two rules apply: • Before it is opened the host opens one of the two unselected doors that has a goat behind it. • The host then allows you to switch your...
The Monty Hall problem is named for its similarity to the Let's Make a Deal television...
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 door 1. Before the door is opened, however, someone who knows wh at's behind...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT