Simulating Experiments

Download Report

Transcript Simulating Experiments

Simulating Experiments
AP STATISTICS
Steps for simulation
 Simulation: The imitation of chance behavior, based
on a model that accurately reflects the experiment
under consideration.
 Steps for simulation:
 Step 1: State the problem or describe the experiment
 Step 2: State the assumptions
 Step 3: Assign digits to represent outcomes
 Step 4: Simulate many repetitions.
 Step 5: State your conclusions.
Example 5.21 Simulation Steps
 Step 1: State the problem or describe the experiment:
Toss a coin 10 times. What is the likelihood of a run of at
least 3 consecutive heads or 3 consecutive tails?
 Step 2: State the assumptions. There are two:
 A head or a tail is equally likely to occur on each toss
 Tosses are independent of each other (what happens on
one toss will not influence the next toss)
Example 5.21 Simulation Steps Continued
 Step 3: Assign digits to represent outcomes. Using our
random number table, we know that we have the digits 0,
1, 2, 3, 4, 5, 6, 7, 8, 9. Therefore if we count 0 as an even
digit, then the digits can be assigned as follows:
 One digit simulates one toss of the coin
 Odd digits represent heads; even digits represent tails
 Successive digits in the table simulate independent
tosses.
Example 5.21 Simulation Steps Continued
Step 4: Simulate many repetitions: looking at 10 consecutive digits from the table
simulates one repetition. Read many groups of 10 digits to simulate many repetitions.
 Here are the first 3 repetitions starting at line 101 from Table B. During the repetitions we
must label each set of 10 numbers to state whether our desired outcome occurred or not
(whether we had a run of at least 3 consecutive heads or 3 consecutive tails.

Digits
 Heads/Tails
Run of 3


1 9 2 2 3 9 5 0 3 4 0 5 7 5 6 2 8 7 1 3 9 6 4 0 9 1 2 5 3 1
HHT THHH THT TH HHTT TH HHHTTT HHT HHH
Twenty-two additional repetitions were done for a total of 25 repetitions; 23 had a run of 3
or more heads or tails
Example 5.21 Simulation Steps Continued
 Step 5: State your conclusions. We estimate that the
probability of a run by the proportion
23
Estimated probability = 25 = 0.92
 However, 25 repetitions are not really enough to
estimate the true probability. If we had a computer
do the simulation with thousands of repetitions, then
it would find the true probability to be around 0.826
Example 5.23: Orders of frozen yogurt flavors have the following
relative frequencies: 38% chocolate, 42% Vanilla and 20% strawberry.
 The experiment consists of customers entering the store and ordering




yogurt. The task is to simulate 10 frozen yogurt sales based on this recent
history.
We will assign the random numbers as follows:
00 to 37 to correspond to the outcome chocolate (C)
38 to 79 to correspond to the outcome of vanilla (V)
80 to 99 to correspond to the outcome of strawberry (S)
 The sequence of random numbers starting at line101 is as follows
 19223
95034 05756
28713
 The two digit numbers shown here are:
19
(C)
22
(C)
39
(V)
50
(V)
34
(C)
05
(C)
75
(V)
62
(V)
87
(S)
13
(C)
Class Activity (5.3 Simulating Experiments) part 1

A very basic example: probability of having a girl in the family

We assume that having a boy and a girl are equally likely outcomes (50 50 so to say).

The most basic simulation can be done when we have a 50 50 chance. A coin toss.

Let the outcome of a head (H) represent a girl and the outcome of tails (T) represent a boy.

We want the probability of having at least one girl in a family of 4 children. That means one,
two, three or four girls.

Everyone will flip their given quarter 4 times and record the number of heads (the number of
girls). If they get one or more head, they will write down the answer choice YES) if they get no
girls, then they will write down the answer choice NO.

After that, they will write their yes or no on the board and we will compute the probability.