Presentation is loading. Please wait.

Presentation is loading. Please wait.

DECISION MODELING WITH MICROSOFT EXCEL Chapter 9 Copyright 2001 Prentice Hall Publishers and Ardith E. Baker Monte Carlo Simulation Part 1.

Similar presentations


Presentation on theme: "DECISION MODELING WITH MICROSOFT EXCEL Chapter 9 Copyright 2001 Prentice Hall Publishers and Ardith E. Baker Monte Carlo Simulation Part 1."— Presentation transcript:

1 DECISION MODELING WITH MICROSOFT EXCEL Chapter 9 Copyright 2001 Prentice Hall Publishers and Ardith E. Baker Monte Carlo Simulation Part 1

2 Simulation allows you to quickly and inexpensively acquire knowledge concerning a problem that is usually gained through experience (which is often costly and time consuming). Introduction An experimental device (simulator) will “act like” (simulate) the system of interest in a quick, cost- effective manner. Goal:To create an environment in which information about alternative actions can be obtained through experimentation. Goal: To create an environment in which information about alternative actions can be obtained through experimentation.

3 SIMULATION vs. OPTIMIZATION In an optimization model, the values of the decision variables are outputs. In a simulation model, the values of the decision variables are inputs. The model evaluates the objective function for a particular set of values. The result of the model is a set of values for the decision variables that will maximize (or minimize) the value of the objective function. The result of the model is a measure of the quality of a suggested solution and the variability in various performance measures due to randomness in the inputs.

4 When should simulation be used? Simulation is one of the most frequently used tools of quantitative analysis today because: 1.Analytical models may be difficult or impossible to obtain, depending on complicating factors. 1. Analytical models may be difficult or impossible to obtain, depending on complicating factors. 2.Analytical models typically predict only average or “steady-state” (long-run) behavior. 2. Analytical models typically predict only average or “steady-state” (long-run) behavior. 3.Simulation can be performed with a variety of software on a PC or workstation. The level of computing and mathematical skill required to design and run a simulator has been substantially reduced. 3. Simulation can be performed with a variety of software on a PC or workstation. The level of computing and mathematical skill required to design and run a simulator has been substantially reduced.

5 Simulation and Random Variables Simulation models are often used to analyze a decision under risk. Under risk, the behavior of one or more factors is not known with certainty. For example: demand for a product during the next month the return on an investment the number of trucks that will arrive to be unloaded The factor that is not known with certainty is called the random variable. The behavior of the random variable can be described by a probability distribution. MONTE CARLO METHOD:

6 Design of Docking Facilities. In the following model, trucks of different sizes carrying different types of loads, arrive at a warehouse to be unloaded. ExitEntrance TruckTruck TruckTruck TruckTruck Dock3Dock3 Dock2Dock2 Dock1Dock1 Truck waiting

7 The uncertainties are: When will a truck arrive? What kind and size of load will it be carrying? How long will it take to unload the trucks? Each uncertain quantity would be a random variable characterized by a probability distribution. The planners must address a variety of design questions: How many docks should be built? What type and quantity of material-handling equipment are required? How many workers are required over what periods of time?

8 The design of the unloading dock will affect its cost of construction and operation. Management must balance the cost of acquiring and using the various resources against the cost of having trucks wait to be unloaded.

9 Determination of Inventory Control Policies. Simulation can be used to study inventory control models. In this model, the factory produces goods that are sent to the warehouses to satisfy customer demand. The random variables are: daily demand at each warehouse and shipping times from factory to warehouse. Factory Warehouse 1 Warehouse 2 Warehouse 3 Demand

10 Simulation can be used to study inventory control models. Some of the operational questions are: The main costs are: When should a warehouse reorder from the factory and how much? How much stock should the factory maintain to satisfy the orders of the warehouses? Cost of holding the inventory Cost of shipping goods from a factory to a warehouse Cost of not being able to satisfy customer demand at the warehouse The objective is to find a stocking and ordering policy that keeps the total cost low while meeting demand.

11 To generate a random variable, draw a random sample from a given probability distribution. Generating Random Variables Two broad categories of random variables: Can assume only certain specific values (e.g., integers) Can take on any fractional value (an infinite number of values) Continuous Discrete

12 The game spinner below is an example of a physical device used to generate demand in a given model. Once spun, the spinner is equally likely to point to any point on the circumference of the circle. 12 (10.0%) 13 (10.0%) 8 (10.0%) 11 (20.0%) 10 (30.0%) 9 (20.0%) If the areas of the sectors are made to correspond to the probabilities of different demands, the spinner can be used to simulate demand. Each spin represents a trial.

13 Although easy to understand, the spinner method of generating random numbers would be difficult to use if thousands of trials are necessary. Therefore, random number generators have been developed in spreadsheets. Using a Random Number Generator in a Spreadsheet To generate demand for a given model, first assign a range of random numbers to each possible demand. To do this correctly, the proportion of total numbers assigned to a demand must equal the probability of that demand.

14 For example, using the interval from 0 to 1, make the following assignment: 10% of the interval is assigned to 13 30% of the interval is assigned to 10 20% of the interval is assigned to 11 The probability of drawing a number in the range of.90 to.99999 is 1 out of 10 or 0.1 (10%). This method is useful for generating discrete random variables.

15 To generate a discrete random variable with the RAND() function in a spreadsheet, two things are needed: A GENERALIZED METHOD: 1. The ability to generate discrete uniform random variables 2. The distribution of the discrete random variable to be generated To generate a continuous random variable, two things are needed: 1. The ability to generate continuous uniform random variables on the interval 0 to 1 2. The distribution (in the form of the cumulative distribution function) of the random variable to be generated

16 Continuous Uniform Random Variables. It is important to distinguish between U (the uniform random variable on the interval 0 to 1) and u (a specific realization of that random variable)..25.5.75 0 The game spinner can be used to generate values of U. Every point on the circumference of the circle corresponds to a number between 0 and 1. However, it is impractical for a continuous distribution since the exact point must be read (e.g.,.4999999 999).

17 The Cumulative Distribution Function (CDF). Consider a random variable, D, the demand. The CDF for D [called F(x)] is then defined as the probability that D takes on a value < x. F(x) = Prob{D < x} Knowing the probability distribution for D, the CDF for key values of D is: With a continuous distribution, the probability that any specific value occurs is 0. Therefore, continuous random variables do not have probability distributions. They are defined by the density function and the CDF. X 8 9 10 11 12 13 X 8 9 10 11 12 13 F(x) 0.1 0.3 0.6 0.8 0.9 1.0

18 Probability x F(x) Here is a graph of the CDF. To generate a discrete demand using the graph: Step 2: Read the particular value of the random quantity, d, on this axis Step 1: Locate the particular value of U on this axis u d

19 Suppose you want to model a discrete uniform distribution of demand where the values of 8 through 12 all have the same probability of occurring (uniform, equally likely). The spreadsheet has a function, =RAND(), that returns a random number between 0 and 1. However, this will result in a continuous uniform distribution. To create a discrete uniform distribution, use the INT() function. For example: In general, if you want a discrete, uniform distribution of integer values between x and y, use the formula: INT(x + (y – x + 1)*RAND() )

20 THE GENERAL METHOD APPLIED TO CONTINUOUS DISTRIBUTIONS: The two-step process for generating a continuous random variable W is shown below: x Probability F(x)=Prob{W<x} The cumulative distribution function of W u As before, first locate the value (u) of the random variable U w F(w) Then, read the particular value of the random quantity, W, on this axis

21 Generating from the Exponential Distribution. The exponential distribution is often used to model the time between arrivals in a queuing model. Its CDF is given by: F(x) = Prob{W < w} = 1 – e - w Where 1/ is the mean of the random variable W. Therefore, we want to solve the following equation for w: u = 1 – e - w The solution is: w = -1/ ln(1- u)

22 Now, to draw a sample from an exponential distribution with a mean of 20 (1/ ) using this equation: 1. First generate a continuous, uniform random number with RAND() (for example,.75). 2.Apply the formula: w = -1/ ln(1- u) = -20 (ln(1-.75)) = -20 (-1.386) = 27.72 In a spreadsheet cell, simply enter: = -20 *LN(1 – RAND() )

23 Generating from the Normal Distribution. The normal distribution plays an important role in many simulation and analytic models. Normality is often assumed. Consider drawing a random demand from a normal distribution with a mean (  ) of 1000 and a standard deviation (  ) of 100. If Z is a unit normal random variable (normally distributed with a mean of 0 and a standard deviation of 1) then  + Z  is a normal random variable with mean  and standard deviation . So, we can draw from a unit normal distribution. Excel has a built-in function that can do this: = NORMINV( RAND(), 1000, 100) Excel will automatically return a normally distributed random number with mean 1000 and std. dev. 100.

24 Simulations can be performed with spreadsheets alone. However, add-in software packages can enhance the capabilities of Excel. Simulating with a Spreadsheet Two Excel add-in packages that will be used are Crystal Ball and @Risk. These add-ins offer additional random distributions and easy commands to set up and run many more iterations than could be run in Excel. In addition, they automatically gather statistical and graphical summaries of the results.

25 A CAPITAL BUDGETING EXAMPLE: ADDING A NEW PRODUCT LINE Airbus Industry is considering adding a new jet airplane (model A3XX) to its product line. The following financial information is available: Startup Costs$150,000 Sales Price$ 35,000 Fixed Costs (per year)$ 15,000 Variable Costs (per year)75% of revenues Tax depreciation on the new equipment would be $10,000 per year over the 4 year expected product life. Salvage value of the equipment at the end of the 4 years is estimated to be 0. Airbus’ cost of capital is 10% and tax rate is 34%.

26 If demand is known, then a spreadsheet can be used to calculate the net present value (NPV). For example, assume that the demand for A3XXs is 10 units for each of the next 4 years: =C9*$B$3=$B$4=C10*$D$2=$B$5=C10-SUM(C11:C13)=$D$4*C14=C14 – C15=C16 + C13 =-$B$2 =NPV($D$3,C17:F17)+B17

27 It is unlikely that demand will be the same every year. A more realistic model would be one in which demand each year is a sequence of random variables. THE MODEL WITH RANDOM DEMAND This model of demand is appropriate when there is a constant base level of demand that is subject to random fluctuations from year to year. Sampling Demand with a Spreadsheet: Assume initially that the demand in a year will be either 8, 9, 10, 11, or 12 units with each value being equally likely to occur. This is an example of a discrete uniform distribution. Now, use the formula =INT(8 + 5*RAND() ) to sample from a discrete uniform distribution on the integers 8, 9, 10, 11, 12. Multiple trials can be performed by pressing the recalculation key for the spreadsheet (e.g., F9).

28 =INT(8+5*RAND() ) Using this formula results in random demands. Hitting the F9 key would result in a different sample of demands, and possibly a different NPV. The demands are random variables, therefore, the NPV is also a random variable.

29 Two questions need to be answered about the NPV distribution: EVALUATING THE PROPOSAL 1. What is the mean or expected value of the NPV? 2. What is the probability that the NPV assumes a negative value (making the proposal to add the A3XX less attractive)? To answer these questions, a simulation model must be built. To run the simulation automatically and capture the resulting NPV in a separate spreadsheet, use the Data Table command.

30 Start with a blank worksheet by clicking on the Insert menu and select Worksheet Next, rename this blank worksheet 100 Iterations

31 Type the starting value (1) in cell A2 and hit Enter, then return to cell A2. Click the Edit menu and choose Fill – Series. In the resulting dialog, select Series in Columns and enter a stop value of 100. Click OK to fill series.

32 Add column titles and the following formula to cell B2. Now select the range A2:B101 and click Data – Table.

33 In the resulting dialog, enter C1 for the column input cell and click OK. Note that since a random number generator is used in the formula, you may get different values than these. Excel will recalculate the values and store the resulting NPV in the adjacent cells in column B.

34 Now, to turn the formulas into actual values upon which we can focus, first select the range of cells B2:B101, then click on the Edit – Copy menu. Next, click on the Edit – Paste Special menu option and in the resulting dialog, choose Values.

35 To get a summary of the 100 iterations, use Excel’s built- in data analysis tool. Click on Tools – Data Analysis. If you do not have this option, click on the Add-in option on the Tools menu and in the resulting dialog, click on Analysis ToolPak. After clicking OK, the Data Analysis dialog will open. Select the Descriptive Statistics option and click OK.

36 In the resulting dialog, choose the Input Range to include the 100 iterations. Now click on Output Range and enter the cell where the output will be placed. In addition, select Summary Statistics and click OK.

37 The resulting analysis gives the estimated mean NPV and standard deviation. Downside Risk and Upside Risk: To get a better idea about the range of possible NPVs that could occur, look at the minimum and maximum NPVs.

38 Distribution of Outcomes: Now we ask the question: How likely will these extreme outcomes occur? To answer this, examine the shape of the distribution of the NPV by creating a histogram. Click on Tools – Data Analysis and choose Histogram. In the resulting dialog, set the input range and choose to save the results in a worksheet called NPV Distribution.

39 In the resulting analysis, the Frequency (column B) indicates the number of trials that fell into the bins (categories) defined by column A. The cumulative % column indicates the cumulative percentage of observations that fall into each category or bin.

40 The histogram gives a visual representation of the distribution of NPVs. Note that it is somewhat bell shaped.

41 The next questions to ask are: How Reliable is the Simulation? Now the two questions about the distribution can be answered: 1. What is the mean or expected value of the NPV? 2. What is the probability that the NPV assumes a negative value (making the proposal to add the A3XX less attractive)? In this trial, the mean is $12,100. In this trial, the probability is >15%. 1. How much confidence do we have in the answers from the first trial? 2. Would we be more confident if we ran more trials?

42 For a 95% confidence interval, the formula is: estimated mean + 1.96(standard deviation) In this case, the standard deviation is the standard error (the standard deviation divided by the square root of the number of trials). Based on this trial, the upper and lower confidence limits are: =$E$4-1.96*$E$8/SQRT($E$16) =$E$4+1.96*$E$8/SQRT($E$16) So, we have 95% confidence that the true mean NPV is somewhere between $9,679 and $14,521.

43 Spreadsheet add-ins such as Crystal Ball and @Risk simplify the process of generating random variables and assembling the statistical results. Simulating with Spreadsheet Add-ins To illustrate, return to the capital budgeting example. A CAPITAL BUDGETING EXAMPLE: ADDING A NEW PRODUCT LINE Airbus Industry is considering adding a new jet airplane (model A3XX) to its product line. The following financial information is available: Startup Costs$150,000 Sales Price$ 35,000 Fixed Costs (per year)$ 15,000 Variable Costs (per year)75% of revenues

44 Tax depreciation on the new equipment would be $10,000 per year over the 4 year expected product life. Salvage value of the equipment at the end of the 4 years is estimated to be 0. Airbus’ cost of capital is 10% and tax rate is 34%. If demand is known, then a spreadsheet can be used to calculate the net present value (NPV). For example, assume that the demand for A3XXs is 10 units for each of the next 4 years:

45 =C9*$B$3=$B$4=C10*$D$2=$B$5=C10-SUM(C11:C13)=$D$4*C14=C14 – C15=C16 + C13 =-$B$2 =NPV($D$3,C17:F17)+B17

46 It is unlikely that demand will be the same every year. A more realistic model would be one in which demand each year is a sequence of random variables. THE MODEL WITH RANDOM DEMAND This model of demand is appropriate when there is a constant base level of demand that is subject to random fluctuations from year to year. Sampling Demand with a Spreadsheet: Assume initially that the demand in a year will be either 8, 9, 10, 11, or 12 units with each value being equally likely to occur. This is an example of a discrete uniform distribution. Enter the discrete distribution in a two-column format for Crystal Ball to be able to use it.

47 After installing Crystal Ball, an additional toolbar will be displayed in Excel. Place your cursor in cell C9 and click on the Define Assumption button.

48 Click Custom in the resulting dialog. Click Ok to open the Custom Distribution dialog. Click on the Data button.

49 Enter the cell range in which the discrete distribution resides and click OK. The resulting distribution will be displayed: Click OK again to accept.

50 Repeat these steps for years 2-4 (cells D9:F9) or use Crystal Ball’s copy data and paste data icons. To get Crystal Ball to draw a new random sample of demands, simply click on the Single Step icon. Clicking on this button will randomly change the demand and the NPV, since each is a random variable.

51 In order to answer the two questions about the NPV distribution: EVALUATING THE PROPOSAL 1. What is the mean or expected value of the NPV? 2. What is the probability that the NPV assumes a negative value (making the proposal to add the A3XX less attractive)? We need to run the simulation automatically a number of times and capture the resulting NPV. To do this using Crystal Ball, first set up the base case model and enter the RNGs (Random Number Generators) in cells C9:F9 as was previously illustrated. (Wilscb1c.xls)

52 Next, click on B19 (the NPV cell) and then on the Define Forecast button.

53 After clicking on the Define Forecast icon, the following dialog will appear: Click on the Large forecast window size and When Stopped (faster) display option in this dialog. Click Set Default and then click OK. Click on the Run Preferences icon to change the Maximum Number of Trials to 500 and click OK.

54 To begin the simulation, click on the Start Simulation button. The following dialog will be displayed upon completion of the 500 iterations. Clicking OK will automatically produce a histogram.

55 To look at the statistics from the simulation, click on View menu on the histogram and click on Statistics. Each run of the simulation will produce different numbers so your results may not match those shown here.

56 Downside Risk and Upside Risk: To get an idea of the range of possible NPVs that could occur, look at the minimum and maximum values in the statistic results. Distribution of Outcomes: In order to answer other questions about the distribution of NPVs, we need to look at the shape of the distribution. The previous histogram (which was automatically produced) gives a graphical view of the distribution. The shape of the distribution is definitely bell-shaped.

57 Other information can be requested from Crystal Ball. For example, suppose you want to determine the exact probability that the NPV will be non-positive (< 0). In the Crystal Ball histogram window, enter 0 in the cell in the lower right corner and hit enter. 19.2 % of the observed NPV values were less than or equal to 0.

58 Click on View – Percentiles in the Crystal Ball window to display the percentiles of the NPV distribution.

59 How Reliable is the Simulation? Now that the questions concerning the mean of the distribution and the probability of negative values has been determined, the next questions to answer are: How much confidence do we have in these answers? Would we have more confidence if we ran more trials? We can have 95% confidence that the true mean will fall in an interval of + 1.96 standard deviations about the estimated mean.

60 Originally, we started with equal mean demands of 10 for each period (year). Then, we allowed for random variation in mean demand (between 8 and 12 units). OTHER DISTRIBUTIONS OF DEMAND Now, assume the mean demand will stay the same over the next four years, somewhere between 6 and 14 units a year, with all values being equally likely. This scenario can be modeled as a continuous, uniform distribution between 6 and 14. In addition, we can explore the impact of different demand distributions on the NPV. When the mean demand is relatively small, a distribution called the Poisson distribution is often a good fit.

61 The Poisson distribution is a one-parameter distribution. Specifying the mean of this distribution completely determines it. The Poisson distribution is a discrete distribution and the Poisson random variable can only take on non- negative integer values. Using Crystal Ball’s Distribution Gallery, we can easily sample from a discrete Poisson distribution or from a continuous uniform distribution. First, indicate in Crystal Ball that the cell D6 will have the uniform distribution and that cells C9:F9 will have a Poisson distribution with a mean value driven by the value in cell D6. (Wilsncb2.xls)

62 With your cursor on cell D6, click on the Define Assumptions icon and choose Uniform as the distribution. Click OK.

63 In the resulting dialog, specify the range of the distribution to be a minimum of 6 and a maximum of 14, then click OK.

64 To specify the Poisson distribution, first select cell C9 then click on the Define Assumption icon. In the resulting dialog, select Poisson and click OK.

65 In the distribution’s dialog, specify the lower range to be –Infinity and the Rate to be =$D$6. Clicking Enter will display the Static and Dynamic options. Click on Dynamic and then click OK. Use the Copy Data and Paste Data icons to transfer the information to cells D9:F9.

66 Now, let’s base the estimates on a sample of 1000 from the distribution of the NPV. Click on the Run Preferences icon to open the following dialog box: Change the Maximum Number of Trials to 1000 and click OK.

67 Click on the Define Forecast icon to capture the NPV in cell B19 for each of the iterations. Now, click on the Reset Simulation icon to clear any previous results.

68 Click on the Start Simulation icon to begin. After 1000 iterations are completed, a histogram will be displayed. Click on View – Statistics to bring up the descriptive statistics dialog. Note that these results may differ from yours.

69 Based on these results, the probability of a negative NPV is 44.2%.

70 In summary, 1. Increasing the number of trials is apt to give a better estimate of the expected return. However, there can still be a difference between the simulated average and the true expected return. 2. Simulations can provide useful information on the distribution results. 3. Simulation results are sensitive to assumptions affecting the input parameters.

71 End of Part 1 Please continue to Part 2


Download ppt "DECISION MODELING WITH MICROSOFT EXCEL Chapter 9 Copyright 2001 Prentice Hall Publishers and Ardith E. Baker Monte Carlo Simulation Part 1."

Similar presentations


Ads by Google