## CONSTRUCTING A PROBABILITY DISTRIBUTION BY SIMULATION

It can be difficult to construct a probability distribution. However, suppose that we can perform the random process many times. For example, if we are interested in the probability of getting a sum of 6 when rolling two dice, we can roll two dice many times. If our goal is to find the probability of tossing 10 heads in 20 tosses of a fair coin, we can toss the coin a large number of times. Then, using the relative frequency notion of probability, we can approximate the probability of a particular outcome by the proportion of times the outcome occurs in our experiment. If we find the probabilities for all outcomes of the experiment in this manner, we have constructed the probability distribution. The accuracy of these approximate probabilities will improve as we increase the number of repetitions of the experiment.

Let's illustrate this method of building a probability distribution by considering the experiment of tossing a fair coin 20 times. We're interested in the probability distribution for the total number of heads observed. The computer can be used to simulate 20 coin tosses. In the first simulation, we observe the following sequence of heads (H) and tails (T).

H T T T H H H H T H T H H T H H H T H T 12

We note that there are 12 heads in this sequence. Is this a typical value for the number of heads of 20 tosses of a fair coin? To help answer the question, we run this experiment 9 more times; the tosses for the 10 experiments are shown below.

H T T T H H H H T H T H H T H H H T H T 12
T H T T T H H H T H H H H T H H H H T H 13
H H H H T T H T T H H T T T T H T H T T 9
T T H T H T T H T T T T H H T H H T H H 9
T H H T H T H T T T T H H H T H H H T T 10
H T T H H T H H T T T T T H T T T H T H 8
H H T H H T H H H T H T H H T H H H H H 15
T T T T H H H T H H H T H H T H T H T T 10
T T H T H H H H T T T H H T T H T T H T 9
H H T T T T T T H H T H T H T H H H H H 11

To help understand any pattern in these observed numbers of heads, we use a stemplot display. The stems on the left are the elements of the sample space {0, 1, 2, ..., 20}. These are the possible numbers of heads that we could get if a coin were tossed 20 times. Then we indicate by leafs of 0's the outcomes in our 10 experiments.

```              0                  10 EXPERIMENTS
1
2
3
4
5
6
7
8 0
9 000
10 00
11 0
12 0
13 0
14
15 0
16
17
18
19
20
```
More experiments.

We're starting to see some clumping of the values about 10, but we haven't performed enough experiments to see a strong pattern. Click on the "more experiments" link to see the results of 50 experiments.

Page Author: Jim Albert (© 1996)
albert@bayes.bgsu.edu
Document: http://www-math.bgsu.edu/~albert/m115/probability/prob_simulate.html