Contenu connexe Similaire à 205250 crystall ball (20) 205250 crystall ball1. You got CrystalBall, now
what? Building technically
sound simulation models
© EpiX Analytics LLC
Dr. Francisco J Zagmutt
Managing Partner
EpiX Analytics
fzagmutt@epixanalytics.com
2. Outline
• Background – Crystal Ball, simulation,
this talk
• ModelAssist
• A motivational example
• Technical considerations for sound
models
• A handy checklist to keep in mind
© EpiX Analytics LLC
3. Crystal Ball and simulation modeling
• Stochastic modeling – random variables used
to simulate all possible outcomes
• Crystal Ball: Monte Carlo simulation,
forecasting, and optimization tool
• Wide range of fields and applications:
• Pharmaceuticals
• Mining
• Manufacturing
• Transportation
• Insurance
• Financial industry
• Health / Food safety
• Energy, oil & gas
• Government
• Many others….
© EpiX Analytics LLC
4. The emphasis of this talk
Often deterministic models are “upgraded” to
stochastic ones
During conversion and/or design of new models,
several mistakes can happen.
Mistakes affect spread and shape of outputs ->
statistics e.g. percentiles and variance.
Impact on decision supported by model from
irrelevant to ‘fatal’
Therefore, key to get them right…
© EpiX Analytics LLC
Correct
FATAL!!
5. Free simulation and CB training and
reference tool:
http://www.epixanalytics.com/ModelAssist.html
Based on EpiX Analytics’ decades of
experience in risk analysis consulting,
training, and research
Option to install locally or visit online
Page numbers are Mxxxx. For example,
M0407 is “Selecting the appropriate
distributions for your model”
Keep an eye on these during this talk!
© EpiX Analytics LLC
ModelAssist for CB
6. A motivational example
You are in charge of predicting next year’s total borrowed money
for the consumer lending division in a bank
Making lots of assumptions, a very simplistic calculation could be:
Expected totalBorrowed= # of clients x loan size +…
…however, the number of individual loans and the loan size is
highly variable, and not well known
How do we incorporate this variability and uncertainty in our
calculation above?
© EpiX Analytics LLC
7. We hire a marketing consultancy, and after
4.2M in fees, they conclude that:
• # loans/year is Pert(450,650,800)
• Loan size is $Lognormal(1,000,4,000)
Therefore, we could use CB to “stochastize”
prior calculation using:
Expected totalBorrowed=
Pert(450,650,800)*Lognormal(1000,4000)+...
Lets see how this model works…
© EpiX Analytics LLC
8. Let’s visualize what our model does
Iteration # loans $ per loan Total borrowed
1 550 28,126 15,469,300
550
28,126
© EpiX Analytics LLC
9. Let’s visualize what our model does
Iteration # loans $ per loan Total borrowed
1 550 28,126 15,469,300
2 770 6,307 4,856,390
770
6,307
© EpiX Analytics LLC
10. Let’s visualize what our model does
Iteration # loans $ per loan Total borrowed
1 550 28,126 15,469,300
2 770 6,307 4,856,390
3 498 5,499 1,561,716
4 864 26,795 23,150,880
.
.
.
n
498
5,499
864
26,795
Are these calculations correct?
Model says that for each scenario, every client
borrows the same amount!!
How would this affect your model?
© EpiX Analytics LLC
11. Technical considerations for sound models
1. When a multiplication is a sum
2. Be certain to model uncertainties
1. Confusing variability and uncertainty
2. Reporting of variability and
uncertainty
3. Dependencies matter
© EpiX Analytics LLC
12. 1. When a multiplication is a sum (M0089)
Multiplications can be a shortcut to sum identical numbers
e.g. 10*3=10+10+10
However, random numbers are not identical.
E.g. the sum of n Lognormal(10,4) ≠ Logn(10,4) * n
• Impact: gross overestimation of output variance.
• Correct modeling (M0435):
• Simulate n distributions individually, then sum them
• Use identities (e.g. Binomial(1,p)+Binomial(1,p) = Binomial(2,p))
• Use CLT approximation (e.g. N(m,s)+N(m,s)=N(2m,s√2))
• Use actuarial methods (FFT, Panjer, DePril)
• Lets see how to solve our banking problem, now also
calculating revenue assuming 7.5% IR
© EpiX Analytics LLC
13. Correct approaches
© EpiX Analytics LLC
Approach 1 (M0075):
Use the CLT (N(n*m,s√n))
to calculate total money
borrowed, given n
random # of clients. Then
multiply by IR
Approach 2 (M0435):
Simulate every
client individually and
sum total money
Borrowed. Then multiply
by IR.
14. Does this matter?
Conclusion:
The incorrect
approach
greatly overestimates
the total risk
(sincorrect= 4x correct
method!)
Both correct
approaches
give the same answer
© EpiX Analytics LLC
15. 2. Be certain to model uncertainties
The difference is subtle, but they can greatly impact a model
Variability: heterogeneity (H) among individuals, or randomness (R) (due to
chance, or random samples)
A function of the system being modeled. Can’t be reduced.
• Distribution of household income (H)
• Number of daily coffee breaks (H)
• Catastrophic events (R)
• Quality control sampling (R)
Uncertainty: lack of knowledge about the value of a parameter (e.g.
imperfect data).
A function of the analyst . Thus, can be reduced with more data
• Probability of loan defaults
• Post-launch sales
• Poverty rates in a country
N(m,s)
N( , )
16. 2.1. Confusing variability and uncertainty
• Impact: under or over estimation of output variance.
• Correct modeling:
• Variability: should be repeated in model to
represent heterogeneity or randomness (M0247).
• Uncertainty:
• Its one value, we just don’t know it: thus, show
only once in model (M0088)
• For this reason, can usually be treated the
same way as a point estimate (multiply, divide,
etc)
© EpiX Analytics LLC
17. What happens if I replicate uncertainties?
Uncertainty: what the observer doesn’t know.
• Impact: underestimation of output variance.
• Correct modeling: represent uncertainty distribution only once in
the model.
Example: We randomly sample 100 individuals in a region and 8 have
a disease. How many total infected individuals will there be next
week, given the below populations for areas A-E within the region?
© EpiX Analytics LLC
Area ID Population in the region
A 10,000
B 5,000
C 6,000
D 1,000
E 9,000
18. What happens if I replicate uncertainties?
Correct modeling: uncertainty on
proportion of disease p = Beta(8+1,
100-8+1) once. Then simulate
infected/area using
Binomial(population, p) and sum areas.
Incorrect modeling of uncertainty: sample
p for each area, then simulate and
sum areas as above.
© EpiX Analytics LLC
∑
∑
19. Does this matter?
Certainly! Replicating uncertainties grossly
underestimated the risk, even in this basic example.
© EpiX Analytics LLC
Likewise, if I don’t
replicate variability,
risk will be
overestimated
20. 1. Output = probability. Report
distribution of uncertainty in
probability:
2. If output = distribution.
Report distributions
representing uncertainty and
variability (2 dimensions) of
output:
2.2. Reporting uncertainty and variability
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 20 40 60 80 100 120 140 160 180 200
Number of people affected
Cumulativeprobability
0.0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1.0
0 5 10 15 20 25 30 35 40 45
CumulativeFrequency
Prevalence
Cumulative Frequency of Data
© EpiX Analytics LLC
22. © EpiX Analytics LLC
3. Dependencies matter!
Important rule: every iteration (sample) in
simulation model has to be a possible
scenario
Correlated (dependent) random variables can’t
be sampled independently from each other as
this would create impossible scenarios e.g.
• Sampling a high S&P500 and a very low
Dow Jones.
• Cost estimation of a project, independent of
schedule risks
• Impact: typically underestimation of output
variance (but can also result in overestimate)
23. © EpiX Analytics LLC
Correlation modeling options
• Linear correlation: Rank order correlation.
Most commonly used in CB, but very limited.
• Non-linear:
• Bootstrap: flexible and easy to implement
(M0264)
• Bayesian MC or MCMC: flexible, but harder
to implement (M0052)
• Conditional model logic (e.g. IF
statements): to model causal
flow/conditionality (M0097)
• Copulas: more complex but restricted
shapes
3
4
5
6
7
8
9
10
1.5
2
2.5
3
3.5
4
4.5
5
5.5
Betaposterior
Alpha posterior
Beta posterior vs Alpha posterior
Be
26
28
30
32
34
36
38
2000 2200 2400 2600 2800 3000 3200
BOPD
NPV($M)
26
28
30
32
34
36
38
2000 2200 2400 2600 2800 3000 3200
BOPD
NPV($M)
a)
c)
24. We went through a list of technical issues and
potential mistakes to keep an eye on.
Now is a good time to go over a checklist of
procedures (rather than techniques) to keep in
mind before, during and after your model is
developed.
25. A reference checklist*
1. Engage your decision makers/executives
• Let them help you scope the problem statement
2. Let the problem drive the analysis
• Fancier not always better.
3. Make the analysis as simple as possible, but no simpler
• Easier to communicate and parameterize.
• ALWAYS start simple and later add complexity (if needed)!
4. Identify all significant assumptions and uncertainties
• Honesty will pay off
5. Perform sensitivity and scenario analysis
• To identify key parameters and data gaps
6. Iteratively refine the problem statement and the analysis
• Adapt model to new evidence and/or needs
7. Present and document results clearly
• Communication is key!
*Modified from Morgan, and Henrion, (1990).
© EpiX Analytics LLC
26. Summary
• Background – simulation modeling and Crystal Ball
are used everywhere
• ModelAssist – free modeling reference tool, so use it!
http://www.epixanalytics.com/ModelAssist.html
• Technical considerations for sound models
• Multiplications for sums – don’t do it!
• Uncertainty vs. variability – be sure to distinguish
them
• Dependencies/correlations – don’t ignore them
• A handy checklist to keep in mind
27. Thanks for your time!
Please contact me with any questions, or for a
copy of the CB models I developed for this talk
Dr. Francisco J Zagmutt
Managing Partner
EpiX Analytics
fzagmutt@epixanalytics.com
© EpiX Analytics LLC