Professional Documents
Culture Documents
Laboratory 3
using Wittwer, J.W., Monte Carlo Simulation Example: Sales Forecast, (2004)
The Scenario: Company XYZ wants to know how profitable it will be to market their new gadget,
realizing there are many uncertainties associated with market size, expenses, and revenue.
The Method: Use a Monte Carlo Simulation to estimate profit and evaluate risk.
A lead, in a marketing context, is a potential sales contact: an individual or organization that expresses an interest in
your goods or services.
The table above uses "Min" and "Max" to indicate the uncertainty in L, C, R, and P. To generate a
random number between "Min" and "Max", we use the following formula in Excel (Replacing
"min" and "max" with cell references):
= min + RAND()*(max-min)
Let's say we want to run n=5000 evaluations of our model.
A convenient way to organize the data in Excel is to make a column for each variable as shown in
the screen capture below.
Figure 5: Example Histogram Created Using a Scatter Plot and Error Bars.
In Excel: =STDEV(G:G)/SQRT(COUNT(G:G))
95% Confidence Interval
The standard error can be used to calculate confidence intervals for the true population mean. For
a 95% 2-sided confidence interval, the Upper Confidence Limit (UCL) and Lower Confidence Limit
(LCL) are calculated as:
To get a 90% or 99% confidence interval, you would change the value 1.96 to 1.645 or 2.575,
respectively. The value 1.96 represents the 97.5 percentile of the standard normal distribution.
(You may often see this number rounded to 2). To calculate a different percentile of the standard
normal distribution, you can use the NORMSINV() function in Excel.
Example: 1.96 = NORMSINV(1-(1-.95)/2)
Commentary
Keep in mind that confidence intervals make no sense (except to statisticians), but they tend to make
people feel good. The correct interpretation: "We can be 95% confident that the true mean of the
population falls somewhere between the lower and upper limits." What population? The
population we artificially created! Lest we forget, the results depend completely on the assumptions
that we made in creating the model and choosing input distributions. So, I generally just stick to
using the standard error as a measure of the uncertainty in the mean.
The reason for showing the CDF along with the histogram is to demonstrate that an estimate of the
cumulative probability is simply the percentage of the data points to the left of the point of interest.
For example, we might want to know what percentage of the results was less than -$700.00 (the
vertical red line on the left). From the graph, the corresponding cumulative probability is about 0.05
or 5%. Similarly, we can draw a line at $2300 and find that about 95% of the results are less than
$2300.
It is fairly simple to create the cumulative distribution in Excel. Figure 8 shows how you can
estimate the CDF by calculating the probabilities using a cumulative sum of the count from the
frequency function. You simply divide the cumulative sum by the total number of points.
Many of the questions we may be interested in have to do with using the CDF to go from a
cumulative probability to a percentile or vice versa. The PERCENTRANK() and PERCENTILE()
functions in Excel allow us to do this quite easily.
Note that a percentile, or quantile, refers to the value (in this case, the profit) corresponding to a
given estimated cumulative probability.
Question 1: What percentage of the results was less than -$700?
This question is answered using the percent rank function: =PERCENTRANK(array,x), where the
array is the data range (column G in figure 2 above) and x is $700.
If x matches one of the values in the array, this function is equivalent to the Excel formula
=(RANK(x)-1)/(N-1) where N is the number of data points. If x does not match one of the values,
then the PERCENTRANK function interpolates. You can read more about the details of the RANK,
PERCENTILE, and PERCENTRANK functions in the Excel help file (F1).
The figure below shows a screen shot of some examples where the percent rank function is used to
estimate the cumulative probability based upon results of the Monte Carlo simulation.
The End
This concludes the Monte Carlo simulation example using Excel. This lab is not comprehensive, and
many details having to do with Monte Carlo simulation have not been covered. However, I hope this
lab has given you a good introduction to the basics.
To generate a random number from a Normal (Gaussian) distribution you would use the following
formula in Excel:
=NORMINV(rand(),mean,standard_dev)
Ex: =NORMINV(RAND(),$D$4,$D$5)
To generate a random number from a Lognormal distribution with median = exp(meanlog), and
shape = sdlog, you would use the following formula in Excel:
=LOGINV(RAND(),meanlog,sdlog)
Ex: LOGINV(RAND(),$D$6,$D$5)