change_door: Change door

Description Usage Arguments Details Value Examples

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

Description

This is the door the player has switched to after seeing one of the other doors a goat was behind.

Usage

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

Arguments

'stay'

is to choose whether the play will switches doors or keep the same door. 'opened.door' is the door opened with a goat behind it. 'a.pick' is the first door selected by the player.

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

The function returns the final decision the player has made. Either to stay with the original selection, or switch doors after seeing the first goat.

Examples

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

cjbecerr/montyhall documentation built on March 1, 2020, 12:17 a.m.