change_door: Contestant has opportunity to change door selection.

Description Usage Arguments Details Value Examples

View source: R/monty-hall-problem.R

Description

change_door() gives the option to stay on first choice or switch to the remaining unopened door.

Usage

1
change_door(stay = T, opened.door, a.pick)

Arguments

If

contestant chooses to switch doors, the selected door cannot be the opened door or the original selection.

Details

The game setup replicates the game on the TV show "Let's Make a Deal" where there are three doors for a contestant to choose from, one of which has a car behind it and two have goats. The contestant selects a door, then the host opens a door to reveal a goat, and then the contestant is given an opportunity to stay with their original selection or switch to the other unopened door. There was a famous debate about whether it was optimal to stay or switch when given the option to switch, so this simulation was created to test both strategies.

Value

Returns a numeric value indicating final door selection.

Examples

1
2

nerea88/montyhall documentation built on Dec. 22, 2021, 12:10 a.m.