Monte Carlo Simulation

Download Report

Transcript Monte Carlo Simulation

Simulation: Modeling Uncertainty
with Monte Carlo
12-706 / 19-702
1
Notes on Uncertainty
Uncertainty is inherent in everything we do
There are no right answers
Our goal:
Understand and model it --> make better decisions
We ‘internalize’ uncertainty using ranges or
distributions of our inputs
This is a computationally intensive idea
2
First: Reading PDFs & CDFs
What information can we get from simply
looking at a PDF or CDF?
3
Some types of distributions
Discrete
Uniform
Normal
Triangular
Exponential
Lognormal
…
All defined/expressed in the text
4
Some Reminders
For 2 variables X and Y:
E(X+Y) = E(X) + E(Y)
E[f(x)] does not necessarily equal f(E[x])
For 2 independent X and Y (not typical)
E(X*Y) = E(X)*E(Y)
Var(X+Y) = Var(X-Y) = Var(X) + Var(Y)
Std dev = sqrt(Var)
5
Adding Distribution Functions
Triangular distribution with min -10, mid
0, max 10.. (mean 0, st dev 4)
If X and Y both modeled like this..
Then E(X+Y)=0 ; st dev ~ 5.6 (as above)
6
Simulation alternatives
Physical – hydraulic tanks used for blood
flow models in Porter Hall
3D CAD Simulations
Deterministic (system) dynamics
Monte Carlo (Stochastic) Simulation
Monte Carlo History
 Not a new idea: “Statistical sampling”
 Fermi, Ulam, working on Manhattan Project in 1940’s
Developed method for doing many iterations of picking inputs to
generate a distribution of “answers”
Finally have “fast” computers
 Later, named after Monte Carlo
(famous for gambling)
11
Monte Carlo History - Hendrickson
 I used Monte Carlo Simulation for my doctoral
dissertation research in 1977.
 Simulated dial-a-ride tours in a service area to validate
an analytical model. (used to model service tours
performance).
 Generated service call times and locations, then
constructed vehicle tours and calculated performance.
 Several hundred computer punch cards for simulation of
tours in areas.
 Now could be done rapidly on a spreadsheet.
Computer Punch Cards
Monte Carlo Method
 Monte Carlo analysis: 3 steps
1. Specify probability distributions in place of
constants/variables in a model
2. Trial by random draws
3. Repeat for many* trials
 Monte Carlo does not yield “the right answer”!
 Produces a distribution of results
 Many random draws simulated -> convergence
* hundreds or thousands
14
Random Draws
Historically, developing a random number
generator was difficult.
Now, straightforward using numerical
methods and modern computers.
Validating Simulation Models
Validation is difficult!
Check internal consistency.
Check input distribution assumptions.
Check against known data.
Document assumptions.
Monte Carlo Simulations
We’ll use @RISK (part of DecisionTools Suite)
Adds special probability functions to Excel
Excel has some, but these are better
Bunch of distributions: Binomial, Discrete,
Exponential, Normal, Poisson, Triangular, Uniform
(more on these in a moment)
Has a lot of nice post-simulation analysis
Statistics, graphs, reports
Again, these are not “answers”
17
Let’s Test It!
Look at test-montecarlo-07.xls spreadsheet
Number of trials sheet first
Can random draws from a normal distribution give us
the parameters of that distribution?
i.e. given a distribution w/mean, st dev “can we sample it”?
See Excel formula to do so (and link on web page for more)
What difference does 10, 100, 1000 or 10000 trials
make?
Look at histogram of trials worksheet to visualize
Don’t worry about MC mechanics: tutorial next week
18
Let’s talk about distributions
You (should) have seen these before:
Uniform, Normal, Triangular, Binomial,
Discrete, Poisson, possibly Exponential,
Lognormal, Weibull
Important part of MC is picking “correct”
distributions & parameters
Be careful of over-thinking this choice!
First – lets talk about normal (bell curve)
19
Distribution Examples?
20
Homework Grades – Normal?
0.06
100%
PDF
CDF
90%
0.04
80%
70%
0.03
60%
50%
0.02
40%
30%
0.01
20%
10%
0.00
0%
0
10
20
30
40
50
21
Distributions – Thought Examples
 What processes / items could be modeled with:
 Uniform
 Normal
 Triangular
 Binomial
 Discrete
 Poisson
 Exponential
 Lognormal
 Weibull
22
Bootstrap Approach
Applicable when you have a sample of
observations.
Sample repeatedly from the observations with
equal probability of each being used.
Doesn’t require underlying distribution
assumption.
Can compare bootstrap and classic approaches.
Results
When you add distributions
You get expected results as in E(X+Y) above
What happens when you multiply them?
24
Examples Using Monte Carlo
Using examples familiar to us
Instead of point estimates, use
probabilistic functions
Pick up penny example?
25
Penny Example
Why do we get big weights at bottom/top
of output distributions?
How can we fix?
26
Wrap Up
We have much better models - and knowledge
of our results now
Important take away messages:
Don’t introduce unnecessary uncertainty with your
input choices
Monte Carlo doesn’t give you the answer
Interpreting output (PDFs/CDFs) gives you an
answer
27