You are on page 1of 26

•BU275: Business

Decision Models –
Lecture Wk6-1

• Instructor – Dr Qiang
Li
Winter 2024
February 12/13,
2024
Introduction to Simulation

• Motivation

• Introduction to simulation

• Transform random numbers to random variates


• Random numbers: uniformly
between 0 and 1
• Random variates: certain desired
distribution
Analogue vs Computer Simulation

• Analogue simulation replaces a physical system with an analogous physical


system that is easier to manipulate, for example:
• weightlessness for space flights can be simulated using rooms filled with water
• wind tunnels simulating conditions of flight
• treadmill simulating automobile tire wear
D AT E | M O N T H | Y E A R

• Computer mathematical
Presented by simulation uses a computer to imitate/replicate the
First Name Last Name
operation of an entire process or system with a mathematical model, for
example:
• risk analysis on financial processes by repeatedly imitating the evolution of the transactions
involved to generate a profile of possible outcomes
• queuing systems
• design and operation of manufacturing/distribution systems
Modelling Business Decisions

Suppose that you are a retailer…

• You likely know (on average) how many customers to expect in


a day, as well as other distributional characteristics such as
range, standard deviation, etc.

• You may also know the distribution for how many items
customers purchase and the amount spent

• How much you make (i.e., profit) depends on the markup on


the items purchased (which there is also likely a distribution
for)

How would you model this?


Modelling Business Decisions – Expected Value

What if we used the expected values of each distribution?


• Number of customers (time between arrivals)
• Amount purchased (time between purchases)
• Profit margin percentage per item

• This would provide a point estimate of the profit margin


earned… but expected values are steady-state averages and
do not always occur in the short-term

Flaw of averages – plans based on assumptions about


average conditions often go wrong.
Modelling Business Decisions – Variability

• You could create optimistic and pessimistic


scenarios
• Model once using all optimistic values and once
using all pessimistic values
• The results would be quite extreme since it is
unlikely that every random variable will have all good
or all bad outcomes

• You could perform sensitivity analysis, varying one


variable at a time to gauge how sensitive your profit
is to changes in each variable
• This still does not give you a distribution of the
Analytical vs Simulation Results

• Why do we see a difference between analytical and


simulation results?
• Analytical (theoretical) result is a long-run average
(steady-state result)
• Simulation results will not equal analytical results
unless enough trials (replications) have been
conducted to reach steady state
• The more periods simulated (larger number of trials),
the more accurate the results
• … but also requires more time and effort
• e.g., compare the simulation results between 100 vs.
1000 trials
(Computer) Mathematical Simulation

• Systems are replicated with mathematical models


• A type of modeling where multiple sources of
randomness are allowed to impact the model
• Specify probabilistic input variables and assign probability
distribution(s) to input variables

• Simulate the model by repeating the calculations for


hundreds/thousands of instances from input
distributions
• Each replication is known as a trial

Goal: find distribution of potential results (not just


Computer Simulation

• Process of designing a mathematical or logical model


of a real system and then conducting computer-based
experiments with the model to explain, analyze and
predict the behavior of the real system
• Typically used when the stochastic system involved
is too complex to be analyzed satisfactorily by
analytical models
• Applications:
• Healthcare, military, finance, marketing, sports/games,
production, service behavior…
Simulation Uses

• Explanatory devices - understand a system or


problem, gain insights

• Analysis vehicles - determine critical elements,


assess uncertainty, find good solutions, what-if,
comparative & sensitivity analysis

• Predictors - forecast future events, assist in planning


Benefits of Simulation

• Simulation leads to better understanding of the real


system
• … without building, disturbing, or destroying it

• Simulation can model any assumption


• … more general/flexible than analytical models

• Simulation often provides a more realistic


replication of a system than purely analytical
analysis
Types of Simulation Models

• Deterministic vs Probabilistic
• Is everything certain (deterministic), or is there
uncertainty (probabilistic)?
• Monte Carlo technique commonly used for probabilistic
simulation

• Continuous change vs Discrete change


• Can system change continuously or only at discrete points
in time?

• Static vs Dynamic
• Does time have a role in model?
Monte Carlo Simulation Process

• A large proportion of the applications of simulations


are for probabilistic models/stochastic systems

• The Monte Carlo technique is a mathematical process


for selecting numbers randomly from a probability
distribution for use in a trial run of a simulation model
• Imitates the operation of a stochastic system by randomly
generating all the different potential outcomes (values) for
a random variable by sampling from a probability
distribution
Random Numbers

• Uniformly distributed (usually between 0 and 1)


• Generated in such a way that every possible number within
the interval has an equal chance of occurring

• No discernible pattern (appear fully random)

• Can be generated in Excel using the function:


= RAND()
Random Variates

• Definition: particular outcomes of a random variable


that are generated from a probability distribution
• Assigned proportional to the relative frequency of
random variables that we wish to generate
• Correspondence between random variates and actual
outcomes is critical to valid/credible simulation models

Use random numbers to generate random variates


• F(x) – cumulative distribution function: P(X< x)
• F(x) lies between 0 and 1
• Map F(x) to random numbers in (0,1)
Basic Examples: Sales Distribution

Sales Prob. Range Proportion


80,000 .2 0.0 - 0.2 20%
100,000 .5 0.2 - 0.7 50%
120,000 .3 0.7 - 1.0 30%

Probability Cumulative
Distribution Distribution

What sales levels would these random numbers generate?


• 0.11, 0.27, 0.38, 0.53, 0.74, 0.99
Discrete Distributions

• Random variates for discrete probability


distributions of random variables can be obtained
using lookup tables

• Example: Coin toss game


• How can we use uniformly distributed random
numbers to simulate the results of the game?
Basic Examples: Coin Toss Game

• A computer cannot flip coins


• Rather, it generates a sequence of random numbers
(between 0 and 1 where every possible number within
the interval has an equal chance of occurring)
• An easy way to generate random numbers is to use
the RAND() function in Excel
• To simulate the flip of a coin, let half the possible
random numbers correspond to heads and the other
half to tails:
• 0.0000 to 0.499999 correspond to heads.
• 0.5000 to 0.999999 correspond to tails.
Basic Examples: Coin Toss Game

• Rules of the game:


• Each round of the game involves flipping an
unbiased coin 5 times
• To play the game, you are required to pay $3 for
each round
• You receive $d at the end of each round, where d is
the (absolute) difference between the number of
heads and tails tossed
• What are possible values of d?
• What is the payoff of playing the game?
Basic Examples: Coin Toss Game
• Example outcomes:
Results of the Game Cost Revenue Payoff
H,H,T,H,T 3 1 -2
T,T,H,T,T 3 3 0
H,H,H,H,H 3 5 2

• Assume we follow the rule: if random number is less than


0.5 choose “H”, else choose “T”
• What is the payoff of the following sequence of random
numbers?
• 0.2, 0.8, 0.45, 0.99, 0.34
• 0.4, 0.23, 0.12, 0.79, 0.01
Basic Examples: Coin Toss Game

• Simulate the model for 100 trials


• What is the average payoff of the game?
• What is the percentage of games in which we earn
$2? What about percentage of games with payoff
$0? With $-2?
• Based on probability theory:
• P(earning $2) = 2/32, P(earning $0) = 10/32, P(earning
$-2) = 20/32
• Expected payoff = 2*2/32 + 0*10/32 - 2*20/32 = -
$1.125
• Do these numbers match the simulation results
Freezing Random Numbers in Excel

• Automatic recalculation of random numbers is a


blessing / curse
• May want to keep data generated; may want to manually
control regeneration
• Can do first by “freezing” data

1. Select Range; Copy; Paste Special (from Edit


menu), select Values option
• Changes formulas to numbers

2. Formulas > Calculation Options >


• Select automatic or manual
Replicating Results

• If you use the “Random Number Generation” routine


in Excel (under Data > Data Analysis), you can specify
a “Random seed”

• This allows you to generate the same set of random


numbers repeatedly

• It would allow you to compare two models under


identically simulated conditions
Basic Examples: Revenue Calculation

The owner of Dwayne’s Concrete Service has the


following distribution for number of jobs each week:
# of Jobs 1 2 3

Probability 0.35 0.2 0.45

Build a simulation model with 100 trials to simulate the


revenues of the company, knowing that the expected
revenue of each job is $1,600.

1. What is the expected profit each week?


2. What is the average revenue from the simulation?
3. Do the results differ?
Statistical Analysis of Simulation Results

• Outcomes of simulation modeling are statistical


measures such as averages

• Statistical results are typically subjected to


additional statistical analysis to determine their
degree of accuracy

• Confidence intervals can be developed for the


analysis of the statistical validity of simulation
results
Next Class:
• Simulation continued …

Thanks for your attention!

You might also like