mhsim: Complete a simulation run of the Monty Hall Problem

Description Usage Arguments Value

View source: R/montyhall.R

Description

Run simulations of the Monty Hall problem. Default settings are canonical/classic game parameters, with arguments to change various parameters.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
mhsim(
  niter = 100,
  seed = 1,
  ndoors = 3,
  ndec1 = 1,
  ndec2 = 1,
  nprizes = 1,
  nrevealdif = 1,
  prize.index = NULL,
  selectdec1 = "random",
  doorswitch = 1,
  montyselect = "random",
  verbose.results = FALSE
)

Arguments

niter

Number of simulation iterations or games.

seed

Seed integer to set in 'set.seed()'.

ndoors

Total quantity of doors for game simulations.

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

Set indices of doors Monty reveals. Defaults to "random".

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.