Monty Hall

Probability Puzzles in R

Peter Chi

Assistant Professor of Statistics Villanova University

Choose one of the doors

image-url

Probability Puzzles in R

One door is revealed

image-url

Probability Puzzles in R

Revealing a door with reverse indexing

The doors object:

doors
1 2 3

Suppose that Door #1 is chosen, and Door #2 contains the prize...

Revealing the remaining door:

reveal <- doors[-c(1,2)]
reveal
3
Probability Puzzles in R

Revealing a door at random

The doors object:

doors
1 2 3

Suppose that Door #1 is chosen, and Door #1 in fact contains the prize...

Revealing the remaining door:

reveal <- sample(x = doors[-1], size = 1)
Probability Puzzles in R

Let's try it!

Probability Puzzles in R

Preparing Video For Download...