Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Let's use a simulation to investigate how often we would win the game if we decided to switch doors half the time ( i .
Let's use a simulation to investigate how often we would win the game if we decided to switch doors half the time ie with probability when playing many rounds of the game. The simulation shown in the template is used to simulate rounds of the game in which you initially select Door # The vector switch records whether you decide to switch, while the vector wins records whether you win the car. The value in switch represents deciding to switch and the value in wins represents a win. The sample function is used so that switch has value half the time.
b The code stops at specifying the outcomes for when the car is behind Door # Complete the code by specifying how outcomes should be assigned if the car is behind Door # or Door #
c Run the simulation and view the results.
i Based on the simulation results, what is the approximate overall probability of winning with this strategy of switching doors of the time?
ii Based on the simulation results, is it a better strategy to always switch doors or always
not switch? Explain your answer, referencing relevant numerical results.
d Using an algebraic approach, calculate the probability of winning by always switching doors.
Let Ws represent the event of winning by always switching doors. It may be helpful to define the events of the car being behind Door # Door # or Door # as D D and D respectively, and to suppose that you initially select Door #
replicates
num.doors
#create empty vectors to store results
switch repNA replicates
wins repNA replicates
#set seed for a pseudorandom sample
set.seed
#simulate rounds of the game
fork in :replicatesswitchk samplec size #choose whether to switch or notifcar door ifswitchkwinsk#outcomes if car is behind door #outcomes if car is behind door
#view the resultse Consider a modification of the game in which you are asked to select from one of four doors, where one door leads to a car and the others lead to goats all other aspects of the game remain the same; Monty will only open one door and that door must lead to a goat Calculate the probability of winning by always switching doors and compare this to the probability of winning by never switching doors.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started