Some chance questions have neat formulas. Many do not, or the formula is not obvious. A simulation answers them anyway: you build a small model of the chance process, run it many times, and count. This topic also fixes what the word probability means, which the rest of the unit builds on.
What a probability is
Flip a fair coin once and you cannot say what will happen. Flip it 10,000 times and the share of heads will be very close to one half. That long-run share is the probability of heads. In general, the probability of a result is the proportion of times it would happen if the chance process were repeated a very large number of times. It is always a number from 0 to 1: 0 for a result that never happens, 1 for one that always does.
The law of large numbers says exactly this: as the number of repetitions grows, the share of repetitions with the result gets closer and closer to its probability. In the short run, anything can happen. Thirteen heads in 20 flips is common. After 2,000 flips the share will very likely be close to 0.5. The early excess of heads is not "corrected" by extra tails; it is simply swamped by the many later flips.
Running a simulation
A simulation imitates a chance process with a model that has the same chances. Each repetition of the model is one trial. The share of trials with the result estimates its probability. Four steps make a simulation someone else could follow:
- Model. Name the chance device and what each value means. For a 70% free-throw shooter, use random digits: 0 to 6 is a make (7 of the 10 digits), 7 to 9 is a miss.
- Trial. Say what one trial is and what you record. For "9 or more makes in 10 shots", one trial is 10 random digits, and you record the number of makes.
- Repeat. Do many trials, often 100 or more.
- Estimate. The estimated probability is the number of trials with the result divided by the number of trials.
Two details matter. First, the digit assignment must match the real chances. Digits 1 to 6 do not model a 1-in-6 chance: they are 6 of 10 digits, a 60% chance. Second, decide whether repeats are allowed. When each trial step is a new shot with the same chance, repeated digits are fine. When you are choosing different people, as in a random sample, you skip repeats.
Testing a claim with a simulation
A student council of 8 seniors and 12 juniors says it picked 4 members at random for a conference, and all 4 were seniors. Is that believable? Simulate the claim: label the members 01 to 20, with 01 to 08 the seniors. Use random numbers to choose 4 different labels, skipping repeats and numbers above 20, and record how many seniors are chosen. The figure shows 100 such trials.
Worked example. Use the simulation to judge the council's claim.
Count the trials at the observed result: 2 of the 100 trials chose 4 seniors.
Estimate: .
Conclusion: if the pick were truly random, choosing 4 seniors would happen only about 2% of the time. Because that result is so unusual, the data give reason to doubt that the council picked at random.
Notice what the conclusion does not say. It does not say the pick was certainly unfair: 2 of the 100 random picks did choose 4 seniors. A rare result makes the claim hard to believe; it does not make it impossible. The comparison is always "How often does the model produce a result like the one we saw?"
Reading a simulation's dotplot
Each dot is one trial. To estimate a probability, count the dots that meet the condition and divide by the number of dots. Watch the words. "10 or more boxes" includes the dots at 10. "More than 10" does not. A cereal maker puts one of 4 prizes in each box at random; in a simulation of 100 families buying boxes until they had all 4 prizes, 27 families needed 10 or more boxes, so the estimate is .
| Word | Means | Example |
|---|---|---|
| Trial | one run of the chance model | one simulated family buying boxes |
| Result recorded | what you note after each trial | the number of boxes bought |
| Estimate | trials with the result over all trials |
How many trials?
An estimate from 50 trials can easily be off by several percentage points. One from 1,000 trials is much steadier. So when two simulations disagree, trust the one with more trials. If you need a more trustworthy estimate, run more trials; never change the model or stop trials early to get a number you like.