Risk analysis by simulation (Monte Carlo simulation) Michael Wood, October, 2006 (minor revisions January 2009) Some theories and models are deterministic: they give you one definite, certain answer. Others are probabilistic: they only provide answers in probabilistic terms. These models can either be built using mathematical probability theory, or using simulation - sometimes called Monte Carlo simulation because the results depend on chance in the same way as the results of gambling in a casino in Monte Carlo. Simulation is both easier and more powerful in almost all contexts. The idea of simulation is to express uncertainties in the model as probabilities, and then use these probabilities to generate lots of possible futures. These futures can then be used to estimate the probability that the real future will turn out one way rather than another. There are three methods of estimating probabilities for the model. Sometimes past data may be available (eg for the probability of a storm of a given degree of severity). Occasionally, arguments about equally likely outcomes may do the trick (eg the probability of a coin landing on heads is 1/2 since heads and tails are equally likely). When neither of these is possible we have to use subjective estimates. Ideally you should ask several people for their estimates. Obviously the probabilities should be realistic if you want to get meaningful results. In practice, computers are essential for running simulations. @RISK is an add-in to Excel which can be used perform Monte-Carlo simulation. The notes below are a very brief introduction only. There is much more available in the on-line help built into the package, and in the manual. Notes on using @Risk for Excel @Risk is on the network: to run it click on Start – Academic applications – Palisade Decision Tools – @Risk for Excel. (It is also given away with the Clemen and Reilley (2001)—there should be several CDs in the library.) It uses macros, so when you are asked whether to enable macros you must say yes. There should be a Help button for @Risk (separate from the Excel Help). Use this when you need to. @Risk is an Add-in for Excel. The best way to see what it does is to set up an Excel spreadsheet in the ordinary way, and then see what @Risk can add to it. If you run @risk with a spreadsheet downloaded from the web, it is very important to save the spreadsheet first before opening it – otherwise @risk may not work.) My suggestion is to start with a very simple spreadsheet that gives a deterministic answer – eg it might tell you exactly what profit you can expect from a business plan. Use the Excel File menu to load this spreadsheet. To incorporate a risk analysis with @risk that will give a probabilistic answer, you need to go through the following four steps. Step 1. Put in @risk probability functions The first step is to decide which cells contain uncertain values - ie numbers which are to some extent guesswork. Paste an @Risk probability distribution function in each of these by clicking on the Function icon (fx – either on a toolbar or in the Insert menu), then scrolling down to @Risk Distributions in the Category box, and then choosing the appropriate function in the window. (See below for some useful functions.) It is a good idea to colour the cell (right click on cell – Format cells – Patterns) in a particular colour (say pink) to remind yourself that there is an @risk function in the cell. To see what functions are available and what they look like, right click on a cell, click @risk – Define distribution, and then click on the Dist menu to see the various distributions. 1 Note that you can enter parameters which define what the distribution looks like (mean and sd for the normal distribution) on the left hand side, move the “hairs” in the diagram, and enter numbers in some of the cells on the right hand side. To enter a function in the cell, click on Apply. Alternatively, you can use the Paste function icon (fx): this gives you a little more information about what the parameters mean but you don’t get the diagram. Useful functions include RiskNormal, RiskUniform, RiskTriang (so called because the distribution is triangular), RiskPert and RiskDiscrete. The first three should be fairly obvious. RiskPert is a rounded off triangular distribution. RickDiscrete is a bit more complicated to use. Before using it, you need to put two columns of numbers somewhere in your workbook. The first - {x} - represents the discrete (separate) values of the variable, and the second - {p} - represents probabilities of these values. For example: x p 0 0.2 1 0.3 2 0.5 You can then fill in the cell references in the function box. Right click on the cell and use @Risk-Define distribution to see what the function looks like. When you paste an @Risk function in the spreadsheet the number which appears in the cell will be the mean or something similar. It will probably make it clearer how the simulation works if you change the setting so that a randomly generated number from the distribution appears in the cell. To do this, click on the Simulation settings icon (red graph with a square under it), then click sampling and click Monte Carlo under Standard recalc. Now, each time you press F9, the spreadsheet will be recalculated using different randomly generated numbers. The @risk functions are saved as part of the spreadsheet (.xls) file. Step 2. Mark the output cells you want the simulation to analyse Next select the cells you would like analysed (get the cursor on these cells or highlight them), and then click on the Add output icon (the one with the single red down arrow). Step 3. Carry out the simulation Now click on the Start simulation icon (the red graph) or use @risk-Simulation on the menu. This will get you into the @Risk Results window. To change the simulation settings (eg to do more iterations on each simulation) click on the Simulation settings icon (a red graph with a blue rectangle underneath) in the Excel window. Step 4. Analyse the results of the simulation Running the simulation will take you to the @Risk Results window. In this window the Insert menu enables you to display Data – these are the individual values calculated during the simulation process Detailed statistics – these include percentiles and targets (enter a target as indicated and @risk will produce a probability of it being achieved) Various types of graph You can also generate reports and graphs as an Excel worksheet - use Results – Quick report or Report settings. 2 Correlations between variables Values of each variable are normally generated independently of each other. Sometimes this may be unrealistic if high values of one variable have a tendency to be associated with high, or low, values of another variable. To model such dependencies, correlations between variables may be entered in the worksheet. To do this, get to the main menu in the Excel window, and click @Risk – Model – List outputs and inputs. Now select all the inputs in the explorer window on the left of the screen (use the Ctrl key), right click on the selected inputs, and click Correlate distributions. You can now enter the correlation in one of the two appropriate places in the matrix. (The same value should appear automatically in the other.) Then click Apply, and start the simulation. To change the correlations you need to go to the @Risk correlations Sheet, which will have been inserted in the Excel workbook Other functions There are many other facilities offered by @Risk. Use the manual or the on-line Help to explore. Essential points to understand 1 The general idea of Monte Carlo simulation 2 The basic probability distributions for input (the five mentioned above) 3 The use of graphs (histograms and cumulative graphs), the mean, sd, percentiles and targets for interpreting the output 4 The source of probability assessments And for a really thorough understanding 5 The importance of assumptions about dependence and independence Reading @Risk on-line Help Goodwin, P., & Wright, G. (1998). Decision Analysis for Management Judgment (2nd edition). Chichester: Wiley. Clemen, R. T. (1996). Making hard decisions (2nd ed). Belmont, Calif: Duxbury Press. Clemen, R. T. & Reilly, T (2001). Making hard decisions with DecisionTools Suite Belmont, Calif: Duxbury Press. (Includes a student version of @Risk.) Palisade Corporation (2002). Guide to using @risk. Newfield, NY: Palisade Corporation. (There should be three reference copies in the library.) Palisade (suppliers of @Risk) website is http://www.palisade.com 3