What is Simulation in Statistics?
Simulation in statistics refers to the process of using random sampling techniques and computer
models to imitate real-world processes or systems. It helps to analyze and understand complex
systems that are difficult or impossible to solve analytically.
Why Use Simulation?
Simulation is especially useful when:
• The problem is too complex for analytical solutions.
• There is uncertainty or variability in input data.
• You want to model "what-if" scenarios or test different strategies.
• Real-world experimentation is costly, time-consuming, or unethical.
Key Concepts in Statistical Simulation
Concept Explanation
Random Variables Represent uncertain inputs (e.g., demand, service time).
Probability
Define the behaviour of random variables (e.g., normal, binomial).
Distributions
Monte Carlo A widely used simulation technique that relies on repeated random
Simulation sampling.
Iterations Each simulated trial or run of the model.
Results obtained from the simulation model (e.g., average waiting time,
Outputs
profit).
Steps in a Simulation Study
1. Define the Problem
Understand the system, process, or question you're trying to model.
2. Build a Simulation Model
Construct a logical or mathematical model of the real system.
3. Specify Input Distributions
Identify which variables are random and assign probability distributions to them.
4. Generate Random Numbers
Use random number generators to simulate values from the distributions.
5. Run the Simulation
Perform many iterations (e.g., thousands) of the simulation to get stable results.
6. Analyse the Output
Summarize the simulated data using statistics (mean, standard deviation, confidence
intervals).
7. Make Decisions or Recommendations
Use the results to inform decisions or compare strategies.
Example: Simulating a Simple Dice Game
Problem: What is the average outcome when rolling two six-sided dice?
Step-by-Step:
• Model: Two independent dice, each with outcomes 1 through 6.
• Distribution: Uniform discrete distribution for each die.
• Simulation:
o Roll die A and die B (generate two random integers between 1 and 6).
o Record their sum.
o Repeat this 10,000 times.
• Result:
o Calculate the average sum (should be close to 7).
o Create a histogram of all sums to view the distribution.
Real-World Applications of Simulation
Area Example
Manufacturing Simulate production lines to minimize bottlenecks.
Finance Forecast stock prices or portfolio risks (Monte Carlo).
Healthcare Model patient flow in hospitals.
Logistics Simulate delivery routes and optimize supply chains.
Epidemiology Predict disease spread under different intervention strategies.
Monte Carlo Simulation (In Detail)
This is one of the most widely used simulation techniques in statistics.
• Involves generating thousands or millions of random samples.
• Applies to problems involving integration, optimization, and probabilistic modelling.
• Used extensively in finance, physics, engineering, and risk assessment.
Advantages of Simulation
• Handles complex systems.
• Allows flexibility in model design.
• Can incorporate randomness and variability.
• Useful for “what-if” analysis.
Limitations
• Requires large computational resources.
• Results are approximate (not exact).
• Depends heavily on the quality of input data and model assumptions.
• Can be hard to validate or verify.
let’s go hands-on theory-based with a real-life simulation example to help
you fully understand how it works.
SIMULATION EXAMPLE: Customer Service at a Bank
Goal:
Estimate the average waiting time for customers in a bank with one service counter.
1. Define the Problem
You want to simulate how long customers wait in line, assuming:
• Only one service counter.
• Customers arrive randomly.
• Each customer takes a random amount of time to be served.
2. Model the System
You need to represent two things:
• Arrival time of customers (say, every 2 to 6 minutes randomly).
• Service time per customer (say, takes between 3 to 8 minutes randomly).
These two are random variables.
3. Assign Probability Distributions
Let’s assume:
• Arrival Time: Uniform distribution from 2 to 6 minutes.
→ Each minute (2, 3, 4, 5, 6) is equally likely.
• Service Time: Uniform distribution from 3 to 8 minutes.
→ Each minute (3, 4, 5, 6, 7, 8) is equally likely.
4. Generate Random Data (Manually)
Let’s simulate the arrival and service time of the first 5 customers by choosing random values within
the ranges.
Customer Arrival Time (minutes after previous) Service Time (minutes)
1 - (comes first) 5
2 3 6
3 5 4
4 4 7
5 2 3
Now let’s compute:
• Arrival Clock Time (cumulative).
• When each customer starts service.
• Waiting time (start of service - arrival time).
5. Calculate Times Step-by-Step
Cust Arrival Clock Service Start Service End Waiting Time
1 0 0 5 0
2 3 5 11 2
3 8 11 15 3
Cust Arrival Clock Service Start Service End Waiting Time
4 12 15 22 3
5 14 22 25 8
7. Draw Conclusions / Make Decisions
If 3.2 minutes is too long, the bank could:
• Add a second counter.
• Try to reduce service times.
• Manage arrival rates (e.g., appointments).
You could then run another simulation with 2 counters to compare!
What-If Analysis Using Simulation
Simulation allows you to change the rules and see the effect without real-life risk. For example:
• What if customers came more frequently?
• What if service took longer?
• What if we added more staff?
You’d simulate each case and compare average waiting time, maximum wait, etc.
Summary of What You Just Did
Step What Happened
Define Bank with 1 counter, random arrivals and service times
Model Arrival/service times as random variables
Simulate Chose random values and tracked timing
Step What Happened
Analyse Found average wait time
Decide Saw if performance is acceptable or needs improvement
Let’s now simulate the same bank scenario but with 2 service counters — this will help you
see the clear impact of adding a second counter.
GOAL:
Estimate the average waiting time with 2 service counters, and compare it to the 3.2 minutes from
the 1-counter scenario.
What Changes?
• Two customers can now be served at the same time if both counters are free.
• If one counter is busy, new arrivals wait for the next available counter.
We'll use the same data as before:
Customer Arrival Time (min after prev) Service Time (min)
1 - 5
2 3 6
3 5 4
4 4 7
5 2 3
So cumulative Arrival Clock Time:
Customer Arrival Clock Time
1 0
2 3
3 8
4 12
Customer Arrival Clock Time
5 14
TRACKING TWO COUNTERS
We'll assign customers to whichever counter is available earliest.
We’ll keep track of:
• When each counter becomes free.
• When each customer arrives.
• When they start service.
• How long they waited.
Let’s go step by step:
Simulation Table – 2 Counters
Counter Counter Free Service Start Wait New Counter Free
Cust Arrival
Used At Time Time Time At
1 0 C1 0 5 0 0 5
2 3 C2 0 6 3 0 9
3 8 C1 (free at 5) 5 4 8 0 12
C1 (free at
4 12 12 7 12 0 19
12)
5 14 C2 (free at 9) 9 3 14 0 17
Final Waiting Times
Customer Wait Time
1 0
2 0
3 0
4 0
Customer Wait Time
5 0
All customers waited 0 minutes!
Conclusion:
• Adding one more counter completely eliminated wait time in this small scenario.
• Simulation clearly shows the benefit of more service points.
• In real life, you’d run this for hundreds or thousands of customers to get reliable averages.
Let’s now simulate the same bank scenario but with 2 service counters — this will help you see the
clear impact of adding a second counter.
GOAL:
Estimate the average waiting time with 2 service counters, and compare it to the 3.2 minutes from
the 1-counter scenario.
What Changes?
• Two customers can now be served at the same time if both counters are free.
• If one counter is busy, new arrivals wait for the next available counter.
We'll use the same data as before:
Customer Arrival Time (min after prev) Service Time (min)
1 - 5
2 3 6
3 5 4
4 4 7
5 2 3
So cumulative Arrival Clock Time:
Customer Arrival Clock Time
1 0
2 3
3 8
4 12
5 14
TRACKING TWO COUNTERS
We'll assign customers to whichever counter is available earliest.
We’ll keep track of:
• When each counter becomes free.
• When each customer arrives.
• When they start service.
• How long they waited.
Let’s go step by step:
Simulation Table – 2 Counters
Counter Counter Free Service Start Wait New Counter Free
Cust Arrival
Used At Time Time Time At
1 0 C1 0 5 0 0 5
Counter Counter Free Service Start Wait New Counter Free
Cust Arrival
Used At Time Time Time At
2 3 C2 0 6 3 0 9
3 8 C1 (free at 5) 5 4 8 0 12
C1 (free at
4 12 12 7 12 0 19
12)
5 14 C2 (free at 9) 9 3 14 0 17
Final Waiting Times
Customer Wait Time
1 0
2 0
3 0
4 0
5 0
All customers waited 0 minutes!
Conclusion:
• Adding one more counter completely eliminated wait time in this small scenario.
• Simulation clearly shows the benefit of more service points.
• In real life, you’d run this for hundreds or thousands of customers to get reliable averages.
Let's turn up the heat and simulate a busier bank — more customers and tighter arrival times.
New Scenario: 10 Customers + Faster Arrivals
Goal:
Simulate 10 customers arriving more frequently, and check how 2 service counters hold up.
New Assumptions
• Arrival gap: Random between 1 and 3 minutes.
• Service time: Random between 3 and 6 minutes.
• 2 service counters, just like before.
Let’s randomly choose the values to simulate (manually):
Cust Arrival Gap (min) Cumulative Arrival Time Service Time
1 - 0 5
2 2 2 4
3 1 3 6
4 2 5 3
5 1 6 4
6 2 8 5
7 3 11 3
8 2 13 6
9 1 14 5
10 2 16 4
Step-by-Step Simulation with Two Counters
We track:
• When each counter is free.
• Assign the customer to the first available counter.
• Calculate wait time if any.
Let’s initialize:
• Counter 1 Free At = 0
• Counter 2 Free At = 0
Simulation Table
Service Counter Counter Free Start Wait New Counter Free
Cust Arrival
Time Used At Time Time At
1 0 5 C1 0 0 0 5
2 2 4 C2 0 2 0 6
3 3 6 C1 5 5 2 11
4 5 3 C2 6 6 1 9
5 6 4 C2 9 9 3 13
6 8 5 C1 11 11 3 16
7 11 3 C2 13 13 2 16
8 13 6 C1 16 16 3 22
9 14 5 C2 16 16 2 21
10 16 4 C1 22 22 6 26
Waiting Times Summary
Customer Wait Time
1 0
2 0
3 2
Customer Wait Time
4 1
5 3
6 3
7 2
8 3
9 2
10 6
Insights:
• 2 counters handled 5 customers easily.
• 2 counters with 10 fast-arriving customers? Still okay, but waiting builds up.
• If arrivals speed up more, or service slows down, wait times will rise quickly.