Monte Carlo Tutorial - Rita Gunther McGrath

advertisement
Monte Carlo: an Excel Tool for
Simple Business Simulation
Helps to model uncertainty in exogenous
variables
Tutorial
Monte Carlo Tool Philosophy
By identifying simple distributions to each exogenous variable,
your goal is to generate statistical summary, frequency charts, and staircase charts of output.
These analyses will allow the user to determine expected outcomes given exogenous uncertainty.
Table of Contents
Background
1
The Monte Carlo Tool
2
Installation Guide
3
Worked Example – Profit Analysis
1.
Creating a Project.
2.
Modify/Remove
3.
Iterative Simulation
4.
Time-Constrained Simulation
5
5
6
7
7
Worked Example – Worksheets
8
1.
Simulation Output Worksheet
8
2.
Summary Worksheet
8
3.
Frequency Table/ Frequency Chart
9
4.
Staircase Chart
9
Background
Multiple uncertainties generated by exogenous variables are not easily factored into valuations or
even to a simple expected profit analysis. Common statistical tools become very difficult to apply
in situations where there are too many variables to be considered. Monte Carlo simulation is a
solution to these complicated situations, by using a simple random variable generation to predict
a long-run convergence to an average.
Monte Carlo was first developed to aid calculation of complicated integrals in computational
physics, because Monte Carlo uses a computational algorithm instead of deterministic algorithm,
which is easily done with a computer. Its application ranges from computer game simulations to
valuations to mathematics and physics. In a way, Monte Carlo uses deterministic algorithm
because it sets distributions, for example, for each exogenous variables to make them random in a
specified range.
Errors in both statistical and computational dimensions prevail in Monte Carlo sampling and
simulation. Nowadays, many products are available that deal with these problems—however, this
particular program is a very simplified version of Monte Carlo simulation that does not deal with
error complexities.
© 2005, The Wharton School, University of Pennsylvania
Monte Carlo
Page 1
The Monte Carlo Tool
The Monte Carlo simulation will generate separate worksheets for simulation output, statistical
summary, frequency chart, and staircase charts.
Generated Worksheets
1. Simulation Output worksheet:
The Simulation Output worksheet will display
simulation output results for each input and output variables you assigned.
2. Summary worksheet: The Summary worksheet will generate a table that displays
maximum, minimum, average, variance, and middle values for each variable assigned by
you. It will also provide you with the number of iterations.
3. Frequency Table/Chart worksheet: The Frequency Table worksheet will show a table
that distributes output values into ‘bins’ which are 20 incremental ranges between the
minimum and maximum values of output. These values will be displayed in a
Frequency Chart worksheet.
4. Staircase Chart worksheet: The Staircase Chart worksheet will display a chart with
upside and downside variance each input contributes to the output, as these inputs vary
between their minimum and maximum.
© 2005, The Wharton School, University of Pennsylvania
Monte Carlo
Page 2
Monte Carlo
Installation Guide
1. Click on Start menu, then click on search
2. Click “All Files and Folders” and type *.xla under “all or part of File Name.” In the list
of results, you should see a folder starting with c:\Program Files\
3. Copy the file “Monte Add-In.xla” into this folder, which should be C:\Program
Files\Microsoft Office\Office 10\Library (any other versions of MS office will just
change the number after Office – ie, if Office 9, the directory becomes C:\Program
Files\Microsoft Office\Office 9\Library)
4. Go to Tools | Add-Ins
5. Check the box next to the Monte Add-In. Press OK to exit. ‘Monte Carlo Simulation’
menu will pop up.
6. If you close the menu generated, the toolbar can be re-shown by going to View |
Toolbars | Monte Carlo
Monte Carlo
Updating From an Earlier Version
1. Uninstall the previous version:
-Go to Tools | Add-Ins in Excel, uncheck Monte Add-In, then close Excel
-Find the directory where the old “Monte Add-In.xla” is installed by using
Search in the Start menu
-Delete the old “Monte Add-In.xla”
2. Install the new version using the installation steps above
Tips for Troubleshooting
© 2005, The Wharton School, University of Pennsylvania
Monte Carlo
Page 3
1. Do not alter the comments that the add-in produces, otherwise the simulation will
not function properly.
2. Enter all currency amounts as numbers without the $ sign. For example, if costs range
from $1 to $3 with a mode of $2, enter in a lower limit of 1, a mode of 2, and an upper
limit of 3.
3. Do not enter inputs with commas. For example, if an input is 1,000,000, enter 1000000.
4. Enter all percentages with their % sign. For example, if an input ranges from 10% to
20% with a mode of 15%, enter in a lower limit of 10%, a mode of 15%, and an upper
limit of 20%.
5. Make sure before pressing “run simulation” that your spreadsheet is open to the page that
contains the inputs, otherwise the simulation will not run.
6. The sort ascending and descending functions will work only for staircase charts created
from that computer. Staircase charts created on a separate computer will not be able to
be sorted.
© 2005, The Wharton School, University of Pennsylvania
Monte Carlo
Page 4
Monte Carlo
Worked Example – Profit Analysis
In this case, a manager of Forde Mechanics wants to determine expected profit for the
next year, given that number produced, number sold, price per unit, and cost per unit are
subject to variations because they are dependent on the market conditions, and well as
firm’s efficiency and productivity. Assume that somehow we know that these variables
are subject to commonly defined distributions. Number produced is equal to 30 and has
a uniform distribution with minimum = 28 and maximum = 32. Number sold is equal to 10
and has a normal distribution with mean = 10 and standard deviation = 2. Price per unit
is equal to $2 and has a triangular distribution with mode=2, minimum=1.5, and
maximum = 3. Make sure when entering prices into the triangular distribution that only
the number, not the $ sign, is entered, as Excel will not understand the input. Finally,
Cost per unit is equal to $0.5 and has a triangular distribution with mode=0.5,
minimum=0.4 and maximum = 0.7.
Working through this example we will introduce you to the Monte Carlo program and
help you to become familiar with this tool. For each skill, you will practice a step-by-step
example in Excel. Tick the box (□) alongside each goal once you feel you have
mastered that skill.
Skill
Exercise
1.
□ GOAL: To add the Workers Compensation System project.
Creating a
Project.
STEP 1
 Create a worksheet with the
default parameters given in
the range C7:E15 (i.e. Units
Sold = 10, Price per Unit =
$2, Units Made = 30, Cost
per Unit = $0.5)
 Note that:
Revenue = Units Sold x
Price per Unit
Costs = Units Made x Cost
per Unit
Profit = Revenue – Costs
STEP 2
 Select E8 with the value
for Units sold.
 Go to Insert Inputs |
Normal
(Since Units Sold is a
normal distribution)
© 2005, The Wharton School, University of Pennsylvania
Monte Carlo
Page 5
Skill
2.
Modify/Remo
ve
Exercise
STEP 3
 Input the values
given in the
problem into the
pop-up formula
wizard. (Mean =
10, Standard
Deviation = 2)
 Assign a name to
this variable (on
the pop up formula
wizard)
 Press OK
STEP 4
Repeat steps 1-3 for Units Produced (E12), Price per Unit (E9), and Cost per
Unit (E13).
STEP 5
 You will notice that each
cell with assigned variable
has a comment. This
comment contains data
about the input.
STEP 6
 Select E15 with Profit value
 Go to Insert Output | Insert Output
 Enter the name of the output variable
when an inputbox appears.
 The cell will have a comment that is
of same characteristics as comments
for inputs
□ GOAL: To change the distribution/ outputs for the
STEP 1
 Select E8.
 Go to Insert Input | Remove
(Notice that this removes the
distribution assigned to the cell)
 If you want to clear all the
distributions in the cell, then select
any empty cell, and then go to Insert
Input | Remove
STEP 2
 Repeat STEPs 2-3 of Exercise 1, to restore value back into E8
© 2005, The Wharton School, University of Pennsylvania
Monte Carlo
Page 6
Skill
Exercise
3.
□ GOAL: To change the distribution/ outputs for the
Iterative
Simulation
STEP 1
 Go to Run Simulation
STEP 2
 Iterative Method is already set as
default.
 Enter 200 into the textbox next to
Iterations.
 Click Accept
Note: This procedure is an iteration
based on the number of iterations
you set.
4.
TimeConstrained
Simulation
□ GOAL: To change the distribution/ outputs for the
STEP 1
 Go to Run Simulation
 Iterative Method is set as default
 Click on the checkbox under TimeConstrained Method
 Enter 10 into the textbox next to
Seconds
 Click Accept.
Note: This procedure is an iteration
based on the number of seconds
you set.
© 2005, The Wharton School, University of Pennsylvania
Monte Carlo
Page 7
Monte Carlo
Worked Example – Worksheets
1. Simulation Output Worksheet
This Worksheet gives you simulated results according to each iteration up to the number
of iterations you specified (in this case, up to 200).
2. Summary Worksheet
This Worksheet gives you a statistical summary of all the variables used in Monte Carlo
simulation. More specifically, maximum, minimum, average, standard deviation, and
middle value. Middle value refers to the average of maximum and minimum.
© 2005, The Wharton School, University of Pennsylvania
Monte Carlo
Page 8
Number of Iterations is the number of times the programs ran the simulation to generate
results.
3. Frequency Table/ Frequency Chart
The Frequency Table Worksheet is a frequency analysis. Each output value is placed in
respective Bins which is an allocation based on dividing output distribution into 20 subdivisions between the maximum and the minimum values. The table is plotted on a
separate Chart, as a Frequency Distribution Chart.
4. Staircase Chart
This Worksheet will display a chart with upside and downside variance each input
variable contributes to the output variable, as these inputs vary between their minimum
© 2005, The Wharton School, University of Pennsylvania
Monte Carlo
Page 9
and maximum. You can select to view the chart by sorting inputs by highest to lowest
contribution to UPSIDE, or by sorting inputs by highest to lowest contribution to
DOWNSIDE by selecting one of the categories shown under the chart.
For example, the Upside and Downside Variance of price per unit is calculated by:
Upside variance
= Profit (price per unit @ maximum) / Profit at expected - 1
= $14.20 / $4.5 – 1
= 215.56%
Downside variance
= Profit (price per unit @ minimum) / Profit at expected – 1
= -$0.37 / $4.5 -1
= -108.22%
© 2005, The Wharton School, University of Pennsylvania
Monte Carlo
Page 10
Download