In this presentation, we will explore probability using two dice in the real-world vs simulation.
We will compare:
- Classical Probability (counting outcomes)
- Simulation probability (using random sampling in R)
In this presentation, we will explore probability using two dice in the real-world vs simulation.
We will compare:
Probability measures how likely an event is to happen.
\[ P(A) = \frac{\text{# of favorable outcomes}}{\text{# of total outcomes}} \]
Total possible outcomes: \(6 \times 6 = 36\)
\[ P(\text{double}) = \frac{\text{# of favorable outcomes}}{\text{total outcomes}} = \frac{6}{36} = \frac{1}{6} \]
We can roll two dice many times and estimate the probability of rolling doubles using simulation.
set.seed(123) n = 100000 die1 = sample(1:6, n, replace = TRUE) die2 = sample(1:6, n, replace = TRUE) doubles = die1 == die2 mean(doubles)
## [1] 0.16551
Explanation: