play_n_games: Play the Monty Hall Problem game a set number of times.

Description Usage Arguments Details Value Examples

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

Description

play_n_games() plays the Monty Hall Problem game a assigned amount of times.

Usage

1
play_n_games(n = 100)

Arguments

n

= The number of times the Monty Hall game will be run.

Details

The game 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 a data frame with the results of the Monty Hall game simulations. The rows contain the game strategy information. The columns contain the game outcome information.

Examples

1
  play_n_games( n=100 )

herbertm533/montyhall5 documentation built on Sept. 21, 2020, 12:03 a.m.