Download presentation
Presentation is loading. Please wait.
1
Chapter 23 Simulation with the Excel Add-In @RISK
to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston Copyright (c) 2004 Brooks/Cole, a division of Thomson Learning, Inc.
2
Description Many simulations, particularly those involving financial applications can easily be performed with the EXCEL @RISK provides a complete statistical or graphical summary of the results. In this Chapter we will see can be used to simulate a wide variety of situations ranging from the NPV of a new project to the probability of winning at craps.
3
23.1 Introduction to @RISK: The Newspaper Problem
@RISK is used to model situations where we make decisions under certainty. We need to determine how many Year 2000 nature calendars to order in August It costs $2.00 to order each calendar and we sell each calendar for $4.50. After January 1, 2000 leftover calendars are returned for $0.75. Our best guess is that the number of calendars demanded is governed by the following probabilities.
4
How many calendars should we order?
Demand Probability 100 .3 150 .2 200 250 .15 300 .05 How many calendars should we order? Our final result is in file newsdiscrete.xls.
5
We proceed as follows: Step 1: Enter parameter values in C3:C5.
Step 2: It can be shown that ordering an amount equal to one of the possible demands for calendars always maximizes expected profit. Step to generate demand according to above probabilities. In particular, our simulated means, variances, and other statistics will be much more accurate than is we used the Monte Carlo simulation option. Step 4: In cell B7 computer Full price revenue with formula =C3*MIN(C1,C2)
6
Step 5: In B8 computer salvage revenue with formula =C4
Step 5: In B8 computer salvage revenue with formula =C4*IF(C1>C2,(C1-C2),0) Step 6: In B9 computer ordering costs with formula =C1*C5. Step 7: In cell B10 computer profit with formula = B7+B8-B9. Step 8: In cell C1 enter the possible order quantities with the formula = RISKSIMTABLE([100,150,200,350,300}). If we obtain the arguments of function by pointing to a different cell then we do need to omit the { and } brackets.
7
Step 9: Select B10 as an output cell by selecting the single arrow icon.
Step 10: Select the Simulations Settings Icon and from the Iteration tab select 1000 iterations and 5 simulations. From the sampling tab choose LATIN HYPERCUBE from the SAMPLING option. This will to recalculate demand and profit 1000 times for each of the five order quantities. Step 11: To run the simulation select the start stimulation icon. The summary results are shown in the book. To obtain detailed statistics select INSERT DETAILED STATISTICS.
8
Interpretation of Statistical Output
From Figures 2 and 3 in the book we find that Average profit for 1000 trials when 200 calendars are ordered is $ The RISKSIMTABLE function uses the same set of random numbers t generate demand for each simulation. You can return to the results at any time by selecting the RESULTS ICON. You can return to your worksheet from RESULTS by selecting WINDOW SHOW EXCEL WINDOW.
9
Finding Confidence Interval for Expected Profit
If we ran 1000 or more would generate a different set of profits we would get a different estimate of average profit. So we do not learn average profit exactly from any simulation. How accurate is our estimate of average profit? From Section 9.9 we know we can be 95% sure that average or expected profit for 200 calendars is between (Mean Profit)±t(.25,199) Mean Standard Error)
10
Modeling Normal Demand with the =RISKNORMAL FUNCTION
The assumption of discrete demand is unrealistic. To model normal demand simply change cell C2’s formula to =RISKNORMAL(200,30). @RISK performs the generation of a normal random variable by using the Inverse Transformation Method. With normal demand any order quantity is reasonable, because demand may assume any value.
11
Finding Targets and Percentiles
At bottom of Detailed Statistics output we may enter targets as values or percentages. Enter a value tells you fraction of iterations for which output cell was less than or equal to target.
12
Creating Graphs with @RISK
To create a histogram of possible profits go to the RESULTS menu and right click on our output cell (Profit) from the Explorer style list. Then choose histogram and the third simulation and you will obtain a histogram. By moving the sliders at the bottom of the graph you may zero in on the probability of any range of values. By right clicking on a histogram or cumulative ascending graph and selecting FORMAT we can obtain a cumulative descending graph.
13
In a cumulative descending graph the Y-coordinate is probability profit excess x-coordinate.
14
Using the Report Settings Option
You may also directly create your graphs and statistical reports with the Report Settings Option. By choosing the Report Settings Icon you can choose any output to be sent directly to the current workbook or a new workbook.
15
Using the @RISK Statistics
Instead of generating huge reports you may just want the mean and standard deviation of your output cells placed in your spreadsheet. @RISK 4.0 contains statistical functions that accomplish this goal.
16
23.2 Modeling Cash Flows from a New Product
Managers often want to do a best case, worst case and most likely analysis before making a decision. They often fail to realize that any value between the best and worst case may occur. The triangular random variable makes it easy to make this happen. We will model Year 1 market use with a triangular random variable. will generate Year 1 market share by making the likelihood of a given market use proportional to the height of the “triangle”
17
The Lilly Model To model this from of the product life cycle we must model the following sources of uncertainty: Number of years for which unit sales increase. Average annual percentage increase in sales during sales increase portion of sales period. Average annual percentage decrease in sales during sales decrease portion of sales period.
18
Part © We now use a tornado graph to determine the key drivers of NPV.
To obtain a tornado graph you must have selected Collect All Outputs box from Simulation Settings Sampling dialog box. Each bar of the Correlation Tornado Graph gives the correlation of random variable with NPV.
19
In short, the uncertainty about Year 1 Unit Sales is very important for determining NPV, but other random variables could probably be replaced by their mean without changing the distribution of NPV by much. For random variable the Regression tornado graph computes the “standardized regression coefficient” for random variable when we try and predict NPV from random variables in the spreadsheet.
20
A standardized regression coefficient tells us the number of standard deviations by which NPV changes when the random variable changes by 1 standard deviation. For example A one standard deviation change in Year 1 Unit Sales change NPV by .98 standard deviations. A one standard deviation in annual growth rate will increase NPV by .15 standard deviations.
21
23.3 Project Scheduling Models
We used linear programming to determine the length of time needed to complete a project. We learned how to identify critical activities, where an activity is critical if increasing its activity time by a small amount increases the length of time needed to complete the project by the same amount. We have assumed that all activity times are known with certainty. In reality, these times are usually uncertain. Of course, this implies that the length of time needed to complete the project is also uncertain.
22
It also implies that for each activity, there is a probability that the activity is critical.
A complete example (repeated from Chapter 5) is included. The first step in the solution is to choose distributions for the uncertain activity times. We illustrate a distribution that has become popular in project scheduling, called the Pert distributions.
23
23.4 Reliability and Warranty Modeling
In today’s hi-tech world, it is very important to be able to computer the probability that a system made up of machines will work for a desired amount of time. The subject of estimating the distribution of machine failure times and the distribution of time to failure of a system is known as reliability theory.
24
Distribution of Machine Life
We assume the length of time until failure of a machine is a continuous random variable having a distribution function F(t) = P(X≤t) and a density function f(t). Thus for small Δt the probability that a machine will fail between time t and t + Δt is approximately f(t) Δt . The failure rate of a machine at time t (call it r(t) is defined to be (1/ Δt )times the probability that the machine will fail between time t and t+ Δt given that the machine has not failed by time t.
25
Thus If r(t) is an increasing function of t the machine is said to have an Increasing Failure Rate (IFR). If r(t) is a decreasing function of t the machine is said to have a Decreasing Failure Rate (DFR). Thus a machine whose lifetime follows an exponential random variable has constant failure rate.
26
The random variable that is most frequently used to model the time till failure of a machine is the Weibull random variable. The Weibull random variable has the following density and distribution functions
27
Common Types of Machine Combinations
Three types of common combinations of machines are as follows: A Series system functions only as long as each machine functions. A Parallel system functions as long as at least one machine functions. A k out of n system consists of n machines and is considered working as long as k machines are working. Of course by combining these types of combinations a very complex system may be modeled.
28
Estimating Warranty Expenses
If we know the distributions of the time till failure of a purchased makes it a simple matter to estimate the distribution of warranty costs associated with a product.
29
23.5 The RISKGENERAL Function
What if a continuous random variable such as market share does not appear to follow normal or triangular distribution? We can model it with the =RISKGENERAL function. A sample RISKGENERAL analysis can be found in the riskgeneral.xls file.
30
23.6 The RISKCUMULATIVE Random Variable
Recall that with the RISKGENERAL function we estimated relative likelihood of a random variable taking on various values. With the RISKCUMULATIVE function we estimate the cumulative probability that the random variable is less than or equal to several given values. With the RISKCUMULATIVE function we may approximate the cumulative distribution function for any continuous random variable.
31
Example A large auto company believes net income for North American Operations (NAO) for the next year may be between 0 and 10 billion dollars. The auto company estimates there is a 10% chance that net income will be less than or equal to 1 billion dollars, a 70% chance that net income will be less than or equal to 5 billion dollars , and a 90% chance that net income will be less than or equal to 9 billion dollars. to simulate NAO’s net income for the next year.
32
Solution Our work is in the file Cumulative.xls.
The RISKCUMULATIVE function takes as inputs the following quantities: The smallest value assumed by the random variable. Te largest value assumed by the random variable. Intermediate values assumed by the random variable. For each intermediate value of the random variable, the cumulative probability that the random variable is less than or equal to the intermediate value.
33
@RISK will now ensure that
For net income x between 0 and 1 billion the cumulative probability that net income is less than or equal to x rises with a slope equal to .1. For net income x between 1 and 5 billion the cumulative probability tat net income is less than or equal to x rises with a slope equal to .15. For net income x between 5 and 9 billion the cumulative probability that net income is less than or equal to x rises with a slope equal to .5. For net income x greater than 9 billion the cumulative probability that net income is less than or equal to x rises with a slope equal to .10.
34
23.7 The RISKTRIGEN Random Variable
When we use the RISKTRIANG function we are assuming we know the absolute worst and absolute best case that can occur. Many companies prefer to us a triangular random variable in which the worst case and best case are defined by a percentile of the random variable.
35
23.8 Creating a Distribution Based on a Point Forecast
Each day we are constantly inundated by forecasts. While the forecasts may be the best available, they are almost sure to be incorrect. In short, any single valued implies a distribution for the quantity being forecasted. How can we take a point forecast and find a random which correctly models the uncertainty inherent in the point forecast?
36
The key to putting a distribution around a point forecast is to have some historical data about the accuracy of past forecasts of the quantity of interest. We begin by seeing if past forecast exhibit any bias. For each past forecast we determine the Actual value/Forecasted value. Once we have eliminated forecast bias we look at the standard deviation of the percentage errors of the unbiased forecast and use the following random variable to model the quantity being forecasted
37
RISKNORMAL(Unbiased Forecast),(Percentage Standard Deviation of Unbiased Forecasts)*(Unbiased Forecast).
38
23.9 Forecasting Income of a Major Corporation
In many large corporations different parts of a company makes forecasts for quarterly net income and an analyst in the CEO’s office pulls together the individual forecast and creates a forecast for the entire company’s net income. In this section we show an easy way to pool forecasts from different portions of a company and create a probabilistic forecast for the entire company.
39
Recall that the correlation between two random variables must lie between -1 and +1 with
Correlation near +1 implies strong positive linear relationships Correlation near -1 implies strong negative linear relationships Correlation near +.5 implies a moderate positive linear relationships Correlation near -.5 implies moderate negative linear relationships Correlation near 0 implies weak linear relationships
40
23.10 Using Data to Obtain Inputs for New Product Simulations
Many companies use subjective estimates to obtain inputs to a new product simulation. In many situations, however, past data may be used to obtain estimates of key variables such as share, price, volume and cost uncertainty. The utility of each of our models will depend on the type of data you have available.
41
The Scenario Approach to Modeling Volume Uncertainty
When trying to model volume of sales for a new product in the auto and drug industries it is common to look for similar products that were sold in the past. For past products we often have knowledge of the following: Accuracy of forecasts for Year 1 sales volume Data on how sales change after the first year
42
Modeling Statistical Relationships with One Independent Variable
Suppose we want to model the dependence of a variable (Y) on a single independent variable (X). We proceed as follows: Step 1: We try and find the straight line, power and exponential curve tat best fits the data. Straight line is a curve of form Y=a+bX Power function is of form Y=axb Exponential function is of form Y=aebx Step 2: For each curve and each data point computer the percentage error
43
Step 4: Choose the curve that yields the lowest MAPE as the best fit.
Step 3: For each curve computer Mean Absolute Percentage Error (MAPE) by averaging the absolute percentage errors. Step 4: Choose the curve that yields the lowest MAPE as the best fit. Step 5: Assuming that at least one of the three curves appears to have some predictive value model the uncertainty associated with the relationship between X and Y as follows: If straight line is best fit then model Y as =RISKNORMAL (Prediction, Standard deviation of actual errors) If power or exponential curve is best fit then model Y as =RISKNORMAL (Prediction, Standard Deviation of Percentage Error)
44
23.11 Simulation and Bidding
In situations in which you must bid against competitors, simulation can often be used to determine an appropriate bid. In this chapter we show how to use simulation to determine a bid that maximizes your expected profit.
45
Uniform Random Variables
A random variable is said to be uniformly distributed on the closed interval if the random variable is equally likely to assume any value between a and b inclusive. To generate samples from a U(a,b) random variable enter the formula =RISKUNIFORM(a,b) into a cell.
46
23.12 Playing Craps with @RISK
Craps is a very complex game. it is easy to estimate the probability of winning at craps. In the game of craps a player tosses two dice. If on the first toss a 2,3, or 12 results the player loses. If on the first toss the player rolls a 7 or 11 the player wins. Otherwise the player continues tossing the die until she either matches the number thrown on the first roll or tosses a 7.
47
If you roll your point before rolling a 7 you win.
If you roll a 7 before you roll your point you lose. By complex calculations it can be shown that the player wins at CRAPS 49.3% of the time. to verify this.
48
Solution The key observation is to note that we do not know how many rolls the game will take. After each dice roll we keep track of the game status 0 = Game lost. 1 = Game won. 2 = Game still going. Our output cell will keep track of the status of the gram after the 50th toss. A “1” will indicate a win and a “0” will indicate a loss. Our work is in the file Craps.xls.
49
23.13 Simulating the NBA Finals
Our Indian Pacers came within two plays of winning the 2000 NBA championship. Before the series, what was the probability that the Lakers would win the series. From the Sagarin ratings we found that the Lakers are around 4 points better than Pacers. Home team has a 3-point edge and games play out according to a normal distribution with mean equal to our predication and a standard deviation of 12 points.
50
Past history shows the Sagarin forecasts exhibit no bias.
In file Finals.xls we simulate the NBA 2000 Finals.
51
@RISK Crib Sheet Once you are familiar with the function of icons, you will easy to learn. Icons allow you to open and simulations. The Simulation Settings icon allows you to control the settings for the simulation. Simulations Settings dialog box features four tabs: Iterations Tab #Iterations is how many times you to recalculate the spreadsheet. #Simulations – Leave this at 1 unless you have a =RISKSIMTABLE function in spreadsheet.
52
Pause on Errors box causes @RISK to pause if an error occurs in any cell during the simulation.
Update Display box to show the results of each iteration on the screen. Sampling Sampling Type allows you to select Latin Hypercube sampling or Monte Carlo sampling. Latin Hypercube is slower but more accurate. Standard Recalc – If you choose Expected Value of the random variable unless random variable is discrete. Collecting Distribution Samples – Check all if you want to get tornado graphs, a scenario analysis or extract data. Also check this box if you want statistics on cells generated functions.
53
Random Number Generator Seed – When the seed is set to 0, each time you run a simulation you will obtain different results. Other possible seed values are integers between 1 and 32,767. Whenever a nonzero seed is chosen the same values for the Input cells and Output cells will occur. Macro Tab to run a MACRO before or after each iteration of a simulation. After each iterations recalc and entering Macro1 after evaluating each output cell would result in the following sequence of events functions and calculate output cells Run Macro 1 functions and calculate output cells. Select Output Cells icon enables you to select an output cell for will create statistics.
54
List Input and Output Cells icons list all output cells.
Run Simulation icon starts the simulation. Show Results icon allows you to see results. There are two windows: Summary Results Window containing Minimum, Mean and Maximum for all Input and Output cells. Simulation Statistics containing more detailed statistics. Define Distribution icon allows you to see the mass function or density function for any random variable.
55
Graphing - To obtain a graph by right clicking on the cell from the Explorer interface. Then choose type of graph desired. A histogram gives the fraction of iterations assuming different values. A cumulative ascending graph the y-axis gives the fraction of iterations yielding a value <= the value on the x-axis axis. For a cumulative descending graph the y-axis gives the fraction of iterations yielding a value >= the value on the x-axis.
56
At the bottom of simulation statistics windows is a TARGET option
At the bottom of simulation statistics windows is a TARGET option. You may enter a VALUE or PERCENTILE fills in the one you left out. The Extracting Data icon allows you to see the values of =RISK functions and Output cells created on the iterations run. The Sensitivity icon provides a Tornado graph right click on output cell and select Tornado graph.
57
@RISK Functions Riskdiscrete Function Riskduniform Function
This generates a discrete random variable that takes on a finite number of values with known probabilities. Riskduniform Function Use Riskduniform when a random variable assumes several equally likely values. Binomial Distribution Use =RISKBINUOMIAL when you have repeated independent trials each having the same probability of success.
58
RISKTRIANG RISKTRIGEN Function RISKUNIFORM Function
Enables us to model a nonsymmetrical continuous random variable. Generalizes the well-known idea of best case, worst case, and most likely scenario. RISKTRIGEN Function Sometimes we want to use a triangular random variable. But we are not sure of the absolute best and worst possibility. RISKUNIFORM Function Suppose a competitor’s bid is equally likely to be anywhere between 10 and 30 thousand dollars. This can be modeled by a uniform random variable with the formula =RISKUNIFORM(10,30)
59
RISKGENERAL Function What is a continuous random variable does not appear to follow a normal or triangular distribution? We can model it with the =RISKGENERAL function. The syntax of RISKGENERAL is as follows: Begin with the smallest and largest possible values Then enclose in {} the numbers for which you feel you can compare relative likelihoods. Finally enclose in {} the relative likelihoods of the numbers you have previously listed.
60
Modeling Correlations
Suppose we have 3 Normal random variables each having mean 0 and standard deviation 1 which are correlated as follow: Variable 1 and Variable 2 have .7 correlation Variable 1 and Variable 3 have .8 correlation Variable 2 and Variable 3 have .75 correlation
61
Truncating Random Variables
If the random variable assumes a value between 0 (the truncation value) and 1 (the upper truncation value) that value is retained. Otherwise, another value if generated. The truncation values must be within 5 standard deviations of the mean. RISKPERT Function The =RISKPERT function is similar to the =RISKTRIANG function. The RISKPERT function is used to model duration of projects.
62
While the =RISKTRIANG has a piecewise linear density function, the =RISKPERT density has no linear segments. It is a special case of a Beta random variable. Common Error Message Invalid number of arguments error message means an incorrect syntax is used with function.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.