Creating a Histogram in ExcelSales Forecast Example - Part IIIIn Part II of this Monte Carlo Simulation example, we completed the actual simulation. (If you haven't already, Download the example spreadsheet). We ended up with a column of 5000 possible values (observations) for our single response variable, profit. The last step is to analyze the results. We will start off by creating a histogram in Excel, a graphical method for visualizing the results.
We can glean a lot of information from this histogram:
The histogram tells a good story, but in many cases, we want to estimate the probability of being below or above some value, or between a set of specification limits.
[ Running MC ] Creating a Histogram in ExcelMethod 1: Using the Histogram Tool in the Analysis Tool-Pak. This is probably the easiest method, but you have to re-run the tool each to you do a new simulation. AND, you still need to create an array of bins (which will be discussed below). Method 2: Using the FREQUENCY function in Excel. This is the method used in the spreadsheet for the sales forecast example. One of the reasons I like this method is that you can make the histogram dynamic, meaning that every time you re-run the MC simulation, the chart will automatically update. This is how you do it: Step 1: Create an array of binsThe figure below shows how to easily create a dynamic array of bins. This is a basic technique for creating an array of N evenly spaced numbers. To create the dynamic array, enter the following formulas:
After you create the array of bins, you can go ahead and use the Histogram tool, or you can proceed with the next step. Step 2: Use Excel's FREQUENCY formula The next figure is a screen shot from the example Monte Carlo simulation. I'm not going to explain the FREQUENCY function in detail since you can look it up in the Excel's help file. But, one thing to remember is that it is an array function, and after you enter the formula, you will need to press Ctrl+Shift+Enter. Note that the simulation results (Profit) are in column G and there are 5000 data points ( Points: J5=COUNT(G:G) ). The Formula for the Count column:
Creating a Scaled Histogram To scale the histogram, use the following method: Step 3: Create the Histogram Chart Bar Chart, Line Chart, or Area Chart: A More Flexible Histogram Chart
[ Running MC ] REFERENCES: NIST/SEMATECH e-Handbook of Statistical Methods, June 2004, "Histogram", http://www.itl.nist.gov/div898/handbook/eda/section3/histogra.htm CITE THIS PAGE AS: Wittwer, J.W., "Creating a Histogram In Excel" From Vertex42.com, June 1, 2004, http://vertex42.com/ExcelArticles/mc/Histogram.html
| |
|
|
| © 2004 Vertex42, LLC | "Creating a Histogram In Excel" |