Statistical Simulation Examples in Statistics

Start with the recap, study the fully worked examples, then use the practice problems to check your understanding of Statistical Simulation.

This page combines explanation, solved examples, and follow-up practice so you can move from recognition to confident problem-solving in Statistics.

Concept Recap

Using random number generation to model real-world processes and estimate probabilities or outcomes that are difficult to calculate theoretically.

Can't calculate the probability mathematically? Simulate it! Run the scenario thousands of times with random numbers and see what fraction of outcomes match your event. It's like conducting experiments without real resources.

Read the full concept explanation →

How to Use These Examples

  • Read the first worked example with the solution open so the structure is clear.
  • Try the practice problems before revealing each solution.
  • Use the related concepts and background knowledge badges if you feel stuck.

What to Focus On

Core idea: Statistical Simulation starts by naming the possible outcomes and the event rule before assigning or combining probabilities.

Common stuck point: Students often know a procedure related to statistical simulation but skip the recognition step: Am I reasoning about what can happen and how likely it is, with the correct sample space or condition? That leads to a calculation or graph that looks reasonable but answers a different question.

Sense of Study hint: Ask: Am I reasoning about what can happen and how likely it is, with the correct sample space or condition?

Worked Examples

Example 1

medium
You simulate a game where you win if a fair die shows a 1 OR a 6. In 10000 simulated rolls, 3320 wins occurred. What is the simulated probability of a win, and how does it compare to the theoretical value?

Answer

Simulated: 0.332, Theoretical: 130.333\text{Simulated: } 0.332,\ \text{Theoretical: } \tfrac{1}{3}\approx 0.333

First step

1
332010000=0.332\frac{3320}{10000}=0.332.

See the full worked solution + why-it-works coaching

SetupKey insightWhy it worksCommon pitfallConnection

Unlock answer keys One Family plan — every worked solution, all subjects

Example 2

medium
To estimate the area of an irregular shape inside the unit square, you sample 5000 uniform points; 1750 fall inside the shape. Estimate the area.

Example 3

medium
To simulate the probability that a 5-person group has at least one shared birthday-month (12 months), you run 10000 trials and find 6190 hits. Estimate the probability.

Example 4

hard
A simulation runs 50000 trials of a dice game; the event of interest occurs 12530 times. With n=50000n=50000, the standard error is approximately p(1p)/n\sqrt{p(1-p)/n}. Estimate pp and its standard error to three decimals.

Example 5

challenge
You simulate 100000 trials and estimate p^=0.205\hat{p}=0.205. Construct an approximate 95% confidence interval using p^±1.96p^(1p^)/n\hat{p}\pm 1.96\sqrt{\hat{p}(1-\hat{p})/n}.

Example 6

easy
You want to estimate the probability of getting exactly 2 heads when flipping 3 coins. Describe how to use a simulation with a random number generator to estimate this probability.

Example 7

medium
A cereal brand puts one of 6 different toy figurines in each box (equally likely). Use simulation to estimate how many boxes you need to buy to collect all 6 figurines.

Practice Problems

Try these problems on your own first, then open the solution to compare your method.

Example 1

easy
In 1000 simulated coin flips, 480 came up heads. Estimate P(heads)P(\text{heads}).

Example 2

easy
A simulation runs 200 trials and an event occurs 50 times. Estimate its probability.

Example 3

easy
To simulate a fair die, which random integers should you generate?

Example 4

easy
Why is simulation used to estimate hard probabilities?

Example 5

easy
A simulation of 500 trials estimated P=0.62P=0.62. How many trials matched the event?

Example 6

easy
To simulate an event with probability 0.30.3 using a random number in [0,1)[0,1), what range counts as success?

Example 7

easy
A coin-flip simulation gives 0.510.51 at 100 trials and 0.5020.502 at 10000 trials. Which estimate is more reliable?

Example 8

easy
A spinner has a 14\tfrac14 win region. Using digits 0-9, which digits could represent a win?

Example 9

medium
To estimate the probability that two people in a group of 5 share a birthday-week (52 weeks), you simulate 10000 groups and 1850 had a match. Estimate the probability.

Example 10

medium
A game wins with probability 0.20.2. You simulate 50 plays using digits 0-9, letting digit 0 or 1 mean a win. Out of 50 digits, 12 were 0 or 1. Estimate the win probability.

Example 11

medium
You want to estimate π\pi by throwing darts at a unit square with an inscribed quarter circle. Of 10000 darts, 7850 land inside the quarter circle. Estimate π\pi.

Example 12

medium
A simulation estimates a probability as 0.400.40 with 100 trials. Roughly how many trials are needed to cut the typical error in half?

Example 13

medium
To simulate rolling two dice and getting a sum of 7, you generate two random integers 1-6. In 3600 trials, 590 gave a sum of 7. Estimate the probability and compare to theory.

Example 14

medium
A simulation assigns success to a random number in [0,1)[0,1) below 0.450.45. In 2000 runs, 880 succeeded. Estimate the probability.

Example 15

medium
Why might a simulation with only 10 trials give a misleading probability estimate?

Example 16

medium
To estimate the chance a baseball player with a 0.3000.300 average gets at least 2 hits in 4 at-bats, you simulate. In 5000 simulated games, 1410 had 2+ hits. Estimate the probability.

Example 17

medium
A simulation models a 0.70.7-probability free throw. In 1000 simulated shots, 715 went in. Estimate the make probability and the miss probability.

Example 18

challenge
You simulate a 3-game series where each game is won with probability 0.60.6, needing 2 wins to take the series. In 10000 simulations, 6480 series were won. The exact probability is 0.6480.648. Comment on the simulation.

Example 19

challenge
A simulation estimates a probability as 0.500.50 from 400 trials. The approximate standard error is p(1p)n\sqrt{\tfrac{p(1-p)}{n}}. Compute it.

Example 20

challenge
To find how many trials give a standard error below 0.010.01 for p=0.5p=0.5, solve 0.25n0.01\sqrt{\tfrac{0.25}{n}}\le0.01.

Example 21

easy
In 5000 simulated coin flips, 2530 landed heads. Estimate P(heads)P(\text{heads}).

Example 22

easy
To simulate a fair coin using digits 0-9, which digits could represent heads?

Example 23

easy
A simulation produces P0.32P\approx 0.32 after 250 trials. How many matched the event?

Example 24

easy
To simulate rolling a fair 4-sided die using digits 1-8, how would you assign digits to faces?

Example 25

easy
A simulation of 400 trials estimates P=0.18P=0.18. How many trials produced the event?

Example 26

medium
A simulation estimates a probability as 0.50.5 with 100 trials. About how many trials are needed to cut the standard error in half?

Example 27

medium
You simulate 5000 trials of two dice rolls to estimate P(sum=7)P(\text{sum}=7) and observe 845 matches. Estimate the probability.

Example 28

medium
A simulation models a basketball player's free throws as P=0.78P=0.78. To use random digits 00-99, what digit range counts as a make?

Example 29

medium
A simulation runs 2000 trials of drawing 5 cards; 78 trials produced a flush. Estimate P(flush)P(\text{flush}).

Example 30

medium
A simulation outputs results: 10000 trials, event occurs 1850 times. Report the estimated probability as a fraction in lowest terms.

Example 31

hard
A simulation estimates π\pi by quarter-circle dart throws. Of 20000 darts in a unit square, 15710 land in the quarter circle. Estimate π\pi.

Example 32

hard
You simulate a game where each round you toss a coin and win $1 for heads, lose $1 for tails. After 1000 simulated rounds, total winnings are $24. Estimate P(heads)P(\text{heads}).

Example 33

hard
A simulation uses uniform [0,1)[0,1) random numbers; success when the value is less than 0.420.42. Of 10000 trials, 4256 are successes. Estimate the probability and report whether it overshoots or undershoots.

Example 34

hard
To simulate an event with P=0.085P=0.085 using 4-digit codes 0000-9999, how many codes represent a success?

Example 35

hard
A Monte Carlo estimate of 01x2dx\int_0^1 x^2\,dx uses 1000 uniform samples; the sample mean of x2x^2 is 0.3430.343. What is the estimate of the integral?

Example 36

challenge
A simulation of the 'birthday problem' for 23 people (365 days) yields 5078 trials with a match out of 10000. Estimate P(shared birthday)P(\text{shared birthday}) and compare to the theoretical value of about 0.5070.507.

Example 37

medium
A multiple-choice test has 10 questions, each with 4 options (one correct). A student guesses randomly on every question. Design a simulation to estimate the probability of passing (getting 6 or more correct).

Example 38

hard
Two players play a game where each rolls a die. If the sum is 7, Player A wins; otherwise Player B wins. Run a conceptual simulation of 20 trials with these random rolls: (4,3), (2,5), (6,1), (3,3), (5,2), (1,4), (6,6), (2,3), (4,4), (5,1), (3,4), (6,2), (1,1), (2,6), (5,5), (4,1), (3,6), (2,2), (6,3), (1,5). Estimate each player's probability of winning.

Background Knowledge

These ideas may be useful before you work through the harder examples.

probability basicrandom sampling