Lesson 4.1 · Probability, Random Variables and Distributions
Simulation
Some probabilities are hard to calculate with a formula, but you can still estimate them by imitating the random process many times. That imitation is called a simulation, and it is also the engine behind the idea of statistical significance you will use for the rest of the course.
Probability as long-run relative frequency
When you flip a fair coin, you can't predict any single flip. But if you flip it thousands of times, the proportion of heads settles down near . That is what a probability means in statistics:
Definition
Probability
The probability of an outcome of a random process is the proportion of times the outcome would occur in a very long series of repetitions. Probabilities are always between and .
The fact that relative frequencies settle down is called the law of large numbers: as the number of repetitions grows, the proportion of times an event happens gets closer and closer to its true probability.
Two consequences are worth remembering:
- Short runs are unpredictable. Ten flips can easily give 7 heads. That is not a sign the coin is unfair.
- Chance does not "correct" itself. After five heads in a row, the next flip is still 50–50. The law of large numbers works by swamping early streaks with many later trials, not by balancing them out.
The steps of a simulation
A simulation replaces a real random process with a model that behaves the same way, such as random digits, a random number generator, cards or a spinner. On the AP exam you should describe a simulation clearly enough that someone else could carry it out.
Four steps of a simulation
- Describe how to use a chance device to imitate one trial. Say what each outcome represents (for example, "digits 0–6 represent a made shot").
- Say what you will record at the end of each trial (for example, "the number of made shots out of 5").
- Perform many trials.
- Use the results to answer the question: the estimated probability is the proportion of trials in which the event happened.
Assigning digits
The assignment must match the probabilities in the real process.
- For a probability of , single digits work: 0–6 is a success (7 of the 10 digits), 7–9 is a failure.
- For a probability of , use pairs of digits 00–99. Let 00–34 be a success (35 of the 100 pairs) and 35–99 a failure.
- For choosing people without replacement (a committee, a sample), label each person and skip repeated labels, because the same person can't be chosen twice.
- For independent trials that each have the same probability (shots, flips, customers), repeats are allowed. Don't skip them.
Worked example: Assigning digits for a free-throw shooter
A basketball player makes of her free throws. Describe how to use random digits to simulate one game in which she shoots 5 free throws, recording how many she makes.
Solution. Let each digit represent one shot: 0–6 means she makes it and 7–9 means she misses. Read 5 digits from a random digit table (repeats allowed, since shots are independent) and count how many are 0–6. That count is the result of one trial. Repeat for many trials.
For example, the digits represent make, miss, make, make, miss: 3 made shots.
Estimating a probability from simulated results
Once you have many trials, the estimated probability is just a proportion.
Worked example: Reading a simulation
The player in the previous example wants to know how likely she is to make all 5 shots. A computer ran 400 simulated games and found 67 games with 5 made shots. Estimate the probability.
Solution.
About of simulated games had 5 made shots. (The exact answer is , which you'll learn to compute in the independence lesson, so the simulation did well.)
More trials give a more reliable estimate. An estimate based on 20 trials can easily be off by or more; one based on 1,000 trials is usually close.
Using simulation to judge a claim
Simulation is also how you decide whether an observed result is surprising under some assumption. Simulate the process assuming the claim is true, then see how often you get a result as extreme as the one you actually observed.
- If results that extreme are common in the simulation, the observed result is plausible under the claim. It gives no convincing evidence against it.
- If results that extreme are rare (say, less than about of trials), the observed result would be unusual if the claim were true, which is convincing evidence against the claim.
Worked example: Is the claim believable?
A school says of its students walk to school. In a random sample of 40 students, only 13 walk. To see whether this is surprising, a student simulated 200 random samples of 40 from a population in which exactly walk. Only 5 of the 200 simulated samples had 13 or fewer walkers. What should you conclude?
Solution. The estimated probability of getting 13 or fewer walkers by chance, if the claim is true, is
A result this small would happen only about of the time if really walked. That is unusual, so the sample gives convincing evidence that fewer than of the school's students walk.
Common mistake
A small simulated probability does not prove the claim is false, and a large one does not prove it true. Simulation tells you whether the data are consistent with a claim. Also, never conclude something from the actual sample alone. Always compare it with what chance variation produces.
Tip
When you describe a simulation on a free-response question, name the chance device, say what each outcome represents, say what you record per trial, and say you will repeat many times. Missing any of those usually costs credit.
Practice
An event has probability . Which assignment of random digits correctly simulates one trial?
A simulation of a game was run 250 times, and the player won in 38 of them. Estimate the probability of winning the game.
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
Which statement correctly describes the law of large numbers?
An event has probability . Let the digits 0–1 represent a success and 2–9 a failure. Use the random digits below, one digit per trial, to simulate 20 trials. How many successes occur?
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
A class simulated flipping a fair coin 10 times and recorded the number of heads. They repeated this 200 times. The results are below.
| Heads | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Trials | 0 | 2 | 9 | 23 | 41 | 49 | 42 | 22 | 9 | 3 | 0 |
Use the simulation to estimate the probability of getting 8 or more heads in 10 flips of a fair coin.
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
Using the simulation in the previous problem, Jaylen flips a coin 10 times and gets 9 heads. Which conclusion is best?
A club has 10 members, 4 of whom are seniors. A committee of 3 is chosen at random. Which design correctly simulates choosing one committee?