Estimating Probabilities Using Simulation
Model a chance process, repeat complete trials, and count when the event happens. Learn to choose a valid random-digit mapping, calculate a simulation estimate, and explain what more trials can—and cannot—tell you.
By the end of this lesson, you should be able to:
- Distinguish a random process, a trial, an outcome and an event.
- Describe a random mechanism that matches the probabilities and conditions in a model.
- Define complete trial, including its stopping and recording rules.
- Estimate an event probability from the number of event hits and complete trials.
- Explain long-run behavior without expecting short-run results to balance automatically.
Before you start: Be comfortable with and with interpreting a relative frequency. Review Topic 2.2: Summary Statistics for Two Categorical Variables if needed.
First time learning this? Follow the basketball example from the random-digit model to the trial log. Keep asking “What is trial?”
Here to revise? Use the simulation checklist, then try the practice before opening the solutions.
The concept in 60 seconds
A simulation uses a random mechanism to imitate a process. Instead of repeating the real situation, we repeat its model and see how often the event of interest occurs.
For example, random digits can represent made and missed basketball attempts. If our question concerns attempts together, we must simulate the full set before deciding whether the event happened.
The central calculation:
Outcome: · Make count:
Use independent digits. ; .
Record if the set has makes.
The outline encloses trial. Its attempts contribute event decision, not trial results.
trial may need several random draws. , even if there are several individual successes inside that trial.
Quick check: are attempts always trials?
No. It depends on the question. If the event is “at least makes in a set of attempts,” the complete set is trial. If the question is about a single attempt, then attempt can be trial.
A basketball question
In an original fictional example, a player takes . Our simplified model assumes that each attempt is made with probability and that attempts are independent: the model’s chance of making an attempt is unchanged by earlier results.
Investigative question: under this model, what is the probability that the player makes of attempts?
“” includes exactly makes and all makes. A trial ends after the . We record Yes if there are makes, and No if there are .
The input describes attempt. Our target concerns a set of attempts. These are different events, so do not automatically give as the answer to the question.
The simulation estimates a probability for the stated model. It does not establish that a real player’s success rate stays constant or that real attempts are independent. Those assumptions must fit the situation before the model’s results are used outside this example.
Key ideas and notation
Random process
A process whose result is determined by chance.
Generating random digits to model a set of free throws.
Trial
One complete repetition of the process being studied.
Simulate all attempts and .
Outcome
The result of trial, recorded at the detail needed for the question.
The ordered pattern Miss–Make–Make, written .
Event
A collection of outcomes that satisfy a specified condition.
At least makes: , , or . means Make; means Miss.
A model probability and an estimate
The model gives a chance for a make on an individual attempt. After simulating sets , the relative frequency of event hits estimates the chance of at least makes per set.
If an event happens in of trials, the estimate is .
You may see this estimate written as , read “p-hat.” The mark reminds us that it is an estimate from a finite run. It is not a promise about the next trial.
Probabilities and estimated proportions lie between and , or between and . A ratio above is a signal to check what you counted.
Build a valid simulation
1. Choose an appropriate random mechanism
Generate random integers from through , inclusive, with each digit equally likely. Map digits to Make and . For this independent-attempt model, generate each new digit independently; repeated digits are allowed.
of equally likely digits
of equally likely digits
Both color and the labels and identify the categories. The digit is a possible value and belongs to Make.
Digits contain possible values, . Digits . Thus the mechanism models Make with chance and Miss with chance .
A fair coin mapped to Make and Miss would give and , so it would model a different player. A random mechanism should match the stated probabilities, not just produce .
2. Define one complete trial
Generate digits, translate each into or , and count the makes. Record whether the count is . Stop that trial after its , then begin a new trial using the same rules.
· makes
Event: Yes· makes
Event: Yes· make
Event: NoEach outlined group is complete trial. Start a new group after every ; translate and score all digits in that group.
3. Repeat and record consistently
Choose a total number of trials before running the simulation. Use enough repetitions for a useful estimate. Keep the random mechanism, assumptions, event definition and trial boundary unchanged throughout the run.
A random-number generator, a random-digit table, or an appropriate physical device can supply randomness. Reading digits per trial from a random-digit table is valid here. Picking numbers you think “look random” can introduce patterns and is not a substitute for a random mechanism.
4. Decide whether replacement belongs in the model
For the basketball model, a digit must be available again on every attempt. If using digit cards physically, return and mix the card after each draw. Removing cards would change the next attempt’s chances and create dependence.
Accept all digits. They represent distinct attempts with the same make chance.
Accept IDs and . The within this trial.
Reset all tickets before the next trial.
Ticket IDs identify distinct objects. A repeated category, such as different winning tickets, is allowed when the IDs are different.
Replacement is not a universal rule. When a real situation draws distinct objects without replacement, a faithful simulation must reproduce that dependence within a trial. To make successive whole trials independent, reset to the original setup between trials.
A complete plan names: the device and mapping, assumptions, trial’s steps, its stopping rule, the recorded result, the repetition count, and the final ratio.
Read and estimate from a simulation log
The following log comes from a computer-generated example run of the basketball model. trials are shown as cards; open the full log to trace every result. means Make and means Miss.
makes
At least ? Yesmakes
At least ? Yesmake
At least ? Nomake
At least ? NoOpen the full simulation log
| Trial | Digits | Outcome | Makes | Event: at least |
|---|---|---|---|---|
| 1 | Yes | |||
| 2 | Yes | |||
| 3 | No | |||
| 4 | No | |||
| 5 | Yes | |||
| 6 | Yes | |||
| 7 | No | |||
| 8 | Yes | |||
| 9 | Yes | |||
| 10 | Yes |
Original computer-generated example: independent uniform digits ; . This small run illustrates the method, rather than establishing the exact event probability.
There are event hits in complete trials, so the estimate from this small run is . The denominator is sets, not attempts. The for each complete set.
This small estimate happens to equal the input make probability, , but the numbers describe different events. Longer simulated runs need not keep that equality. In the same generated run, the event occurs in of the first trials and of the first trials, giving estimates of and .
Cumulative totals and separate batches
The -trial, -trial and -trial summaries are prefixes of the same run. Do not add them: the first trials are already included in the , and all of those are included in the .
When combining separate runs that use the same model and event, add event hits and add completed trials. Do not average percentages unless the run sizes are equal. Keep incomplete trials separate until they can be completed under the defined rules.
Why does count as event hit ?
The event is defined for the complete set: “at least makes in attempts.” . Counting its makes would estimate an individual-attempt quantity instead of counting event hits for complete sets.
Understand the long run
The probability of an outcome or event describes its long-run relative frequency. A finite simulation gives an estimate, which varies from run to run.
The law of large numbers explains why, for independent repetitions of the same chance process, the cumulative relative frequency tends to stabilize near the event’s probability as the number of trials grows. It does not require every new estimate to be closer than the previous one.
To see this clearly, switch to a separate fair-coin experiment. Here trial is toss, the event is Heads, and the model probability is . These trials are not the basketball sets.
Solid olive curve: . Dashed line: model probability. This is one generated run of independent fair-coin tosses; another run will differ. The curve need not get closer at every step.
| Complete toss trials | Cumulative Heads | Heads relative frequency |
|---|---|---|
| () | ||
| () | ||
| () | ||
| () | ||
| () | ||
| () | ||
| () |
In this run, the Heads share is after tosses and . It moved farther from over that interval. Later, is close to . That illustrates the difference between a long-run tendency and a guarantee about the next step.
More trials do not repair a wrong model
If you wrongly map digits to Make, the simulated player has an single-attempt make probability. Running thousands of trials estimates probabilities for that incorrect model more steadily; it does not turn the model into a player.
Earlier results do not make a correction “due”
For independent fair-coin tosses, the next toss still has a chance of Heads after a long run of Heads. A coin does not remember the earlier imbalance. Its proportion can move toward over many tosses without forcing the next toss to be Tails.
Use both ideas: a suitable model determines what you are estimating; many independent complete trials help make that estimate more stable. Neither guarantees an exact answer from a particular finite run.
Six worked examples
Example 1: score one complete basketball trial
Question: The digits are , , . Does the event “at least makes in attempts” occur?
- maps to