Download 12. Monte Carlo Simulation and Risk Analysis

Document related concepts

Types of artificial neural networks wikipedia , lookup

Gibbs sampling wikipedia , lookup

Transcript

Many situations dictate that randomness be explicitly
incorporated into our models. This is usually done by
specifying probability distributions for the appropriate
uncontrollable inputs.
◦ Such models are called stochastic, or probabilistic.


Risk is the likelihood of an undesirable outcome. It can
be assessed by evaluating the probability that the
outcome will occur along with the severity of the
outcome.
Risk analysis seeks to examine the impact of uncertain
inputs on various outputs.

Production volume is uncertain; assume normal with a mean of
1000 and standard deviation of 100.
 Replace cell B12 with =ROUND(NORM.INV(RAND(), 1000, 100, true), 0)

Whenever F9 key or Formula > Calculation > Calculate Now is
clicked, the value of demand will change randomly


Monte Carlo simulation is the process of generating
random values for uncertain inputs in a model,
computing the output variables of interest, and repeating
this process for many trials to understand the distribution
of the output results.
Monte Carlo simulation can easily be accomplished on a
spreadsheet using a data table.

Excel file Outsourcing Decision Monte Carlo Simulation Model.

Enter the trial number (1 to 20) in column D.
Reference the cells associated with model outputs in row 3: (E3, F3,
G3)  (=B12, =B19, =B20)
Select the range for the data table (D3:G23)
In the Data Table dialog, enter any blank cell for the Column Input
Cell.



1. Develop a spreadsheet model.
2. Determine probability distributions for uncertain
input variables.
3. Identify output variables you want to predict.
4. Choose the number of trials for the simulation.
5. Run the simulation.
6. Interpret the results.




For many decision models, empirical data may be available,
either in historical records or collected through special efforts.
In other situations, historical data are not available, and we
can draw upon the properties of common probability
distributions to help choose a representative distribution that
has the shape that would most reasonably represent the
analyst’s understanding about the uncertain variable.
Uniform or triangular distributions are often used in the
absence of data.
In Analytic Solver Platform, use custom Excel functions or the
Distributions button in the ribbon.


Outsourcing Decision Model
Demand (production volume) is
normally distributed with a mean of
1000 and standard deviation of 100
units.
◦ =PsiNormal(1000, 100) in cell B12
◦ Use ROUND function to ensure that the
result is a whole number:
=ROUND(PsiNormal(1000,100),0).

Unit cost has a triangular distribution
with a minimum of $160, most likely
value of $175, and a maximum of
$200.
◦ =PsiTriangular(160, 175, 200) in cell
B10.


For demand, select
cell B12.
Click the
Distributions button
in the Analytic Solver
Platform ribbon and
select the normal
distribution from the
Common category.


Normal distribution dialog
Change the parameters to mean = 1000, stdev = 100


For unit cost, select cell B10 and select the triangular distribution
Change the parameters in the dialog

To define a cell you wish to predict and create a
distribution of output values from your model, first select
it, and then click on the Results button in the Simulation
Model group in the Analytic Solver Platform ribbon.
Choose the Output option and then In Cell.
◦ Analytic Solver Platform calls output cells uncertain function
cells.
◦ Uncertain function cells must be numeric.

Analytic Solver Platform adds the function PsiOutput( )
to uncertain function cell formulas.
◦ You may also add +PsiOutput( ) to any output cells manually
Select cell B19
 After defining the cell as
an uncertain function,
the formula should read:
=B16 – B17 + PsiOutput( )



First click on the Options button in
the Options group in the Analytic
Solver Platform ribbon. This
displays a dialog in which you can
specify the number of trials and
other options to run the simulation
(make sure the Simulation tab is
selected).
Trials per Simulation allows you to
choose the number of times that
the simulation will generate
random values for the uncertain
cells in the model and recalculate
the entire spreadsheet.

Analytic Solver Platform
generates a stream of random
numbers from which the values of
the uncertain inputs are selected
from their probability distributions.
◦ Every time you run the model, you will
get slightly different results because of
sampling error.

Setting a value for Sim. Random
Seed will guarantee that the same
sequence of random numbers will
be used for generating the
random values for the uncertain
inputs every time the simulation is
run.


Monte Carlo sampling selects
random variates independently
over the entire range of possible
values of the distribution.
With Latin Hypercube sampling,
the uncertain variable’s probability
distribution is divided into intervals
of equal probability and generates
a value randomly within each
interval.
◦ Monte Carlo sampling is more
representative of reality and should be
used if you are interested in evaluating
the model performance under various
what-if scenarios.


Click the Simulate button in the Solve Action group.
When the simulation finishes, you will see a message
“Simulation finished successfully” in the lower-left corner
of the Excel window.

You may specify whether you want output charts to
automatically appear after a simulation is run by clicking
the Options button in the Analytic Solver Platform ribbon,
and either checking or unchecking the box Show charts
after simulation in the Charts tab.

An easy way to view results for any uncertain function is
to double-click an uncertain function cell.

Frequency distribution of cost difference
Select other
options:
Percentiles,
Chart Type,
Chart Options,
Axis Options,
and Markers.

Set Upper Cutoff = 0 to find the probability of a negative
cost difference.
Moore Pharmaceuticals
spreadsheet. With
uncertain data:
1. What is the risk that the
net present value over the 5
years will not be positive?
2. What are the chances
that the product will show a
cumulative net profit in the
third year?
3. What cumulative profit in
the fifth year are we likely to
realize with a probability of
at least 0.90?






Market size: normal with mean of 2,000,000 units and
standard deviation of 400,000 units
R&D costs: uniform between $600,000,000 and
$800,000,000
Clinical trial costs: lognormal with mean of $150,000,000
and standard deviation $30,000,000
Annual market growth factor: triangular with minimum =
2%, maximum = 6%, and most likely = 3%
Annual market share growth rate: triangular with
minimum = 15%, maximum = 25%, and most likely =
20%

Market size:
◦ =PsiNormal(2000000, 400000)

R&D costs:
◦ =PsiUniform(600000000,800000000)

Clinical trial costs:
◦ =PsiLognormal(150000000, 30000000)

Annual market growth factor:
◦ =PsiTriangular(2%, 3%, 6%)

Annual market share growth rate:
◦ =PsiTriangular(15%, 20%, 25%)

Uncertain functions:
◦ Cumulative net profit each year and net present value

Summary of output functions and uncertain variables
◦ Customize this by checking or unchecking the boxes in the Filters
pane.
1. What is the risk that the NPV over the 5 years will not
be positive?
2. What are the chances the product will show a
cumulative net profit in the third year?
3. What cumulative profit in the 5th year are we likely to
realize with a probability of at least 0.90 (that is, the 10th
percentile)?


Each time you run a simulation, you will obtain
slightly different results.
Confidence interval:
◦ Because a Monte Carlo simulation will generally have a
very large number of trials, we may use the standard
normal z-value instead of the t-distribution in the
confidence interval formula.


Moore Pharmaceuticals
95% Confidence interval

A sensitivity chart allows you to determine the influence that
each uncertain model input has individually on an output
variable based on its correlation with the output variable.
◦ Displays rankings of uncertain variables according to their impact on an
output cell.

Benefits:
◦ It tells which uncertain variables influence output variables the most and
which would benefit from better estimates.
◦ It tells which uncertain variables influence output variables the least and
can be ignored or discarded altogether.
◦ By providing understanding of how the uncertain variables affect your
model, it allows you to develop more realistic spreadsheet models and
improve the accuracy of your results.

Click on the Sensitivity tab in the Simulation Results window.

Moore Pharmaceuticals
Market size:
R&D cost:
Clinical trial cost:

If a simulation has multiple related forecasts, an
overlay chart superimposes the frequency
distributions from selected forecasts on one chart
in order to compare differences and similarities
that might not be apparent.




Moore Pharmaceuticals
Click the Charts button in the
Analysis group
Click Multiple Simulation
Results (do not choose
Multiple Simulations!) and
then choose Overlay.
In the Reports dialog that
appears, select the output
variable cells you wish to
include in the chart and move
them to the right side of the
dialog

Result for year
1 and year 5
cumulative
profit

If a simulation has multiple output variables that
are related to one another (such as over time),
you can view the distributions of all output
variables on a single chart, called a trend chart.
◦ A trend chart shows the mean values as well as 75% and
90% bands (probability intervals) around the mean.




Moore Pharmaceuticals
Click the Charts button in
the Analysis group
Click Multiple Simulation
Results and then choose
Trend.
In the Reports dialog that
appears, select the output
variable cells you wish to
include in the chart and
move them to the right side
of the dialog.


A box-whisker chart
shows the minimum,
first quartile, median,
third quartile, and
maximum values in a
data set graphically.
The first and third
quartiles form a box
around the median,
showing the middle 50
percent of the data,
and the whiskers
extend to the minimum
and maximum values.



Analytic Solver Platform creates reports in the form of
Excel worksheets that summarize a simulation.
Click the Reports button in the Analysis group in the
ribbon, and choose Simulation from the options that
appear.
The report summarizes basic statistical information
about the model, simulation options, uncertain variables,
and output variables,


Apply Monte Carlo simulation to forecast the profitability of different
purchase quantities when the future demand is uncertain.
Suppose that the store owner kept records for the past 20 years on
the number of boxes sold



Historical candy sales
average 44.05.
Using 44 for demand and
purchase quantity, the
model predicts a profit of
$264.00.
However, if we construct a
data table to evaluate the
profit for each of the
historical values, the
average profit is only
$255.00.

The evaluation of a model output using the
average value of the input is not necessarily equal
to the average value of the outputs when
evaluated with each of the input values.
◦ In the newsvendor example, the quantity sold is limited to
the smaller of the demand and purchase quantity, so
even when demand exceeds the purchase quantity, the
profit is limited.

Using average values in models can conceal risk.

We can perform a Monte Carlo simulation by
resampling from the historical sales distribution—
that is, by selecting a value randomly from the
historical data.



Generate candy sales by resampling from the 20 historical values.
Enter the formula =PsiDisUniform(D2:D21) into cell B11.
Set profit in B17 as an uncertain function.

Simulation results for purchase quantity = 44

Sampling from empirical data has some
drawbacks.
◦ The empirical data may not adequately represent the true
underlying population because of sampling error.
◦ Using an empirical distribution precludes sampling values
outside the range of the actual data.

It is usually advisable to fit a distribution using the
techniques described in Chapter 5 and use it for
the uncertain variable.


Newsvendor Model with Historical Data
The best-fitting distribution is a negative binomial distribution.



After fitting the
distribution, when you
attempt to close the
dialog, Analytic Solver
Platform will ask if you
wish to accept the fitted
distribution.
Click Yes, and place the
Psi function in the first
cell of the data (cell D2).
Then reference cell D2
in cell B11.

Results

Whenever the Simulate button is clicked, you will notice that the
lightbulb in the icon turns bright. If you change any number in the
model, Analytic Solver Platform will automatically run the simulation
for that quantity; this makes it easy to conduct what-if analyses.
◦ Example: change the purchase quantity to 50; mean profit is less than if
purchase quantity is 44


Historical demand data
shown in columns D and E
Assume that each
reservation has a constant
probability p = 0.04 of being
canceled; therefore, the
number of cancellations
(cell B14) can be modeled
using a binomial distribution
with n = number of
reservations made and p =
probability of cancellation.


Select cell B12 and then click on
the Distributions button in the
ribbon and choose Discrete from
the Custom category.
Edit the range for “values” and
“weights” in the Parameters
section
◦ Values correspond to the range of
demand in cells D2:D13, and
weights are the relative
frequencies or probabilities in
cells E2:E13.

Or, use the function in cell B12:
=PsiDiscrete($D$2:$D$13,$E$2:$E$13)

To model the number of cancellations in cell B14, choose the
binomial distribution from the Discrete category in the Distributions
list. The number of trials is the value in cell B13 and is referenced in
the Parameters section.

Or, use the function =PsiBinomial(B13, 0.04) in cell B14.


Frequency charts
for number of
overbooked
customers and net
revenue if 310
reservations are
accepted.
You can use
Interactive
Simulation to
quickly change the
number of
reservations to find
the best solution.
Cash Budgeting is the process of projecting
and summarizing a company’s cash inflows and
outflows expected during a planning horizon.
 Most cash budgets are based on sales
forecasts.

 Because of the inherent uncertainty in sales forecasts,
Monte Carlo simulation is an appropriate tool for
modeling cash budgets.

Highlighted cells are uncertain variables (blue) and
uncertain functions (green)



Sales are normally distributed with a standard deviation
of 10% of the mean.
Sales in adjacent months are correlated with one
another, with a correlation coefficient of 0.6.
On average, 20% of sales are collected in the month of
sale, 50%, in the month following the sale, and 30%, in
the second month following the sale.
◦ These figures are uncertain, so a uniform distribution is used to
model the first two values (15% to 20% and 40% to 50%,
respectively), with the assumption that all remaining revenues are
collected in the second month following the sale.

Define distributions for all uncertain variables.
◦ Example for April sales (cell E5): =PsiNormal(600000,60000)
◦ Cell B7: =PsiUniform(15%, 20%)
◦ Cell B8: =PsiUniform(40%, 50%).

Define the available balances in row 25 as output variables

Trend chart

Likelihood of not meeting minimum balance in April


Unless you specify otherwise, Monte Carlo
simulation assumes that each of the uncertain
variables is independent of all the others.
Analytic Solver Platform allows you to specify
correlations between uncertain variables.


Cash Budget Monte
Carlo Simulation Model
Click the Correlations
button in the Simulation
Model group in the
ribbon.
◦ In this example we are
only correlating the
variables in the range
E5:K5. Move these to the
right pane.


Initial correlation matrix
The numerical values show
the correlations (initially set
to zero)
◦ The green distributions are
those used in the uncertain
cells.
◦ The blue scatterplots show
visual representations of the
correlations between the
variables.

Replace the zeros by the
correlations you want in the
model.



Analytic Solver Platform will check that the correlations
are mathematically consistent; if not, it will ask you to
adjust the correlations. Always choose Yes. Click the
Update Matrix button and then Accept Update.
Adjusted correlation matrix:
Analytic Solver Platform then adds these to the
simulation model.