mhgame: Monty Hall game simulation

Description Usage Arguments Value

View source: R/montyhall.R

Description

Simulate a single game of the Monty Hall Problem

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
mhgame(
  doorseq,
  ndec1 = 1,
  ndec2 = 1,
  nprizes = 1,
  nrevealdif = 1,
  prize.index = NULL,
  selectdec1 = "random",
  doorswitch = 1,
  montyselect = "random",
  verbose.results = FALSE
)

Arguments

doorseq

Vector of sequential door indices for the game.

ndec1

Door index to *always* choose in decision 1.

ndec2

Door index to *always* choose in decision 2.

nprizes

Total number of prizes for game simulations.

nrevealdif

Number of doors Monty does not reveal between player decisions 1 and 2.

prize.index

Door index for prize location in each game.

selectdec1

Either "random" or a door index to choose for decision 1.

doorswitch

Some number between 0-100 (percent chance to switch). Defaults to 1 (100 percent).

montyselect

Indices of doors Monty reveals between decisions 1 and 2.

verbose.results

Whether to return iteration/game details alongside results.

Value

A vector of game results, with simulation details if verbose.results = TRUE.


metamaden/montyhall documentation built on April 4, 2020, 9:39 p.m.