Monty hall simulation download




















You select a door, and then the host opens one of the remaining doors, always revealing one of the goats. The question is if switching will make a difference, and if so, what your odds of winning the game are if you switch and if you don't. Before proceeding, take a moment to think through the logic of the game and decide what you think the odds are under each condition. Then, click over to the 'Current Game' tab and play a few rounds.

The data will be saved and available for download when you are done in the 'All Data' tab. Finally, you can run many, many simulations all at once if you prefer on the 'Simulate Many' tab. Remember to include Numpy library by including at the top import numpy as np. Next, write a function that simulates the contestant's guesses for nsim simulations. This function should be similar to above but we're only testing so we'll just return a bunch of zeros for now:.

Putting it all together. Simulate games where contestant keeps his original guess, and games where the contestant switches his door after a goat door is revealed. Compute the percentage of time the contestant wins under either strategy. Is one strategy better than the other? Additional work: One of the best ways to build intuition about why opening a Goat door affects the odds is to re-run the experiment with doors and one prize. If the game show host opens 98 goat doors after you make your initial selection, would you want to keep your first pick or switch?

Can you generalize your simulation code to handle the case of "n" doors? Skip to content. Include Synonyms Include Dead terms. Peer reviewed Download full text. American Journal of Business Education , v3 n2 p Feb The "Monty Hall" problem or "Three Door" problem--where a person chooses one of three doors in hope of winning a valuable prize but is subsequently offered the choice of changing his or her selection--is a well known and often discussed probability problem.



0コメント

  • 1000 / 1000