Description Usage Arguments Details Value Author(s) References Examples

In the game, a prize is located behind one of 3 doors (or in one of 3 boxes). The
player makes a guess, after which the game owner opens one door/box that is neither
the winner nor the guess. The player can then make a second guess. This function
runs the game `N`

times.

1 | ```
montyHall(N)
``` |

`N` |
sample size; i.e., number of times to run the simulation of the game. |

The assumption is that both the prize location and the first guess are sampled uniformly. Also, if the owner has a choice, the open is also sampled.

The point is to show that the second guess has twice the winning chance of the first. Sometimes framed as Bayesian inference (Bain, 2016) but in fact obvious if the event space is partitioned relevantly (as the example illustrates).

A data frame with columns for the first guess, the opened door/box, the second guess and the location of the prize.

John M. Chambers

Chambers, John M. (2016)
*Extending R*,
Chapman & Hall/CRC.

Bain, Robert. (2016)
“Are our brains Bayesian?”
*Significance*, vol. 13, issue 4, pp 14-19.

1 2 3 4 5 6 7 |

johnmchambers/XRexamples documentation built on May 18, 2017, 5:09 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.