monty | R Documentation |
Simulation of the Monty Hall Problem. This demonstrates that switching is always better than staying with the initial guess. Programme written by Corey Chivers, 2012
monty(strat = "stay", N = 1000, print_games = TRUE)
strat |
Strategy to use; possibilities are:
|
N |
How many games to play, defaults to 1000. |
print_games |
Logical; whether to print the results of each game. |
No return value, called for side effects. If the supplied parameter
print_games
is TRUE, then it prints out the result
(Win or Loss) of each of the N simulated games. Finally it reports the
overall percentage of winning.
####################################################
Corey Chivers (2012) \insertCiteMonty.Corey2012;textualipsRdbs
# example code
monty("stay")
monty("switch")
monty("random")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.