Download presentation
Presentation is loading. Please wait.
1
ESD.70J Engineering Economy
Fall 2007 Session Two Michel-Alexandre Cardin – Prof. Richard de Neufville – ESD.70J Engineering Economy Module - Session 2
2
Session two – Simulation
Objectives: Generate random numbers Get familiar with Monte Carlo simulation Set up simulation using Data Table Generate statistics for simulation Draw histogram and cumulative distribution function (CDF) Also called Value At Risk and Gain (VARG) curve ESD.70J Engineering Economy Module - Session 2
3
Questions for “Big vs. Small”
From the base case spreadsheet, we’ve calculated NPVs However, we assumed deterministic demand forecasts for years 1, 2, and 3. This assumption is over-simplifying since actual demand will vary Since life in uncertain, we’d like to simulate a range of possible NPV outcomes, the Min, Max, distributions, and the expected NPV values! ESD.70J Engineering Economy Module - Session 2
4
Set up random generator
Open ESD70session2-1.xls /ESD70session2-1.xls ESD.70J Engineering Economy Module - Session 2
5
Excel’s RAND() function
Returns random number greater than or equal to 0 and less than 1, sampled from a uniform distribution To generate a random real number between a and b, use: =RAND()*(b-a)+a In tab “RAND”, the formula in cell C3: “=Entries!C9*((1-Entries!C25)+2*Entries!C25*RAND())” Returns a uniformly distributed random demand for year 1 centered around 300, which may differ by plus or minus 50% Same logic applies for cell C4 and C5 Here a = (50% x 300) = 150; b = (50% x 300) = 450; p = 50% m = 300; a = m - pm = m(1 - p); b = m + pm = m (1 + p) The formula RAND() x (b-a) + a means that you vary between 0% and 100% of the difference between a and b, and you add that random value to a. This creates a number between a and b, centered around the mid-value between a and b. E.g. if m = 300, a = 150 and b = 450. Then b - a = 300, and the RAND() can make vary the value RAND()(b-a) between 0 and 300 randomly. Therefore, a number varying between 0 and 300 added to a (or 150), will generate values between 150 and 450, or between a and b. This formula expands as follows, which gives rise to the formula shown above: RAND()(b-a) + a = RAND()(m + pm - m + pm) + m - pm = RAND()2pm + m - pm = m(2RAND()p p) = m(1 - p + 2pRAND()) = Entries!C9*((1-Entries!C25)+2*Entries!C25*RAND()) Because Entries!C9 = m = 300 and Entries!C25 = p = 50% ESD.70J Engineering Economy Module - Session 2
6
Random number generator
Follow the instructions, step by step Go to tab “RAND” Type “=Entries!C9*((1-Entries!C25)+2*Entries!C25*RAND())” in cell C3 Type “=Entries!C10*((1-Entries!C25)+2*Entries!C25*RAND())” in cell D3 Type “=Entries!C11*((1-Entries!C25)+2*Entries!C25*RAND())” in cell E3 Press “F9” several times to see want happens ESD.70J Engineering Economy Module - Session 2
7
Random number generator
Click “Chart” under “Insert” menu “Chart Type” select “XY(Scatter)”, “Chart sub-type” select any one with lines, click “Next” “Data Range” select B2:E3, click “Next” “Chart options” select whatever pleases you, click “Next” Choose “As object in” and click “Finish” Press “F9” several times to see want happens We have built a random demand generator for the 3 years that assumes independent demand (0 correlation) from year to year ESD.70J Engineering Economy Module - Session 2
8
Check with your neighbors… Check the solution sheet… Ask me questions…
Give it a try! Check with your neighbors… Check the solution sheet… Ask me questions… ESD.70J Engineering Economy Module - Session 2
9
How Monte Carlo Simulation works
Calculate two NPVAs corresponding to the two random demand simulations Demand in Year 1 Demand in Year 2 Demand in Year 3 NPVA 345 678 1001 189 579 690 How about generating many sets of random demands, and get the corresponding NPVAs automatically? ESD.70J Engineering Economy Module - Session 2
10
Monte Carlo Simulation
ESD.70J Engineering Economy Module - Session 2
11
Setup simulation by Data Table
Follow these instructions, step by step: Link demand in sheet for Plan A to the random demand generator, specifically, Plan A!E5 = Rand!C3; Plan A!G5 = Rand!D3; Plan A!I5 = Rand!E5 In “Simulation” sheet, type “=‘Plan A’!C16” in cell B8 (“=‘Plan A’!C16” is the output of result for NPVA) Create the Data Table. Select “A8:B2008”, click “Table” under “Data” menu, in “column input cell” put “A7”, leave “row input cell” blank. Same thing done for Plan B NOTE: there is no input in the value column of the Data Table; an empty cell is selected as the “column input cell”. Why? ESD.70J Engineering Economy Module - Session 2
12
ESD.70J Engineering Economy Module - Session 2
Explanation For the One-Way Data Table, there is no need to set up the input values in a list, since each row of the Data Table calls RAND() and generates an NPVA projection We have 2000 rows in the Data Table, so we have simulated 2000 times Click “F9” to try another simulation run ESD.70J Engineering Economy Module - Session 2
13
ESD.70J Engineering Economy Module - Session 2
Excel crashing note If your Excel crashes during simulation runs, input some numbers (0’s or whatever) into the input value column to the left of the data series. Do not leave the area of input values blank in the Data Table You can hide the dummy values by setting their font value to “white” color ESD.70J Engineering Economy Module - Session 2
14
Check with your neighbors… Check the solution sheet… Ask me questions…
Give it a try! Check with your neighbors… Check the solution sheet… Ask me questions… ESD.70J Engineering Economy Module - Session 2
15
Calculating descriptive statistics
Useful to know mean, maximum, and minimum values for the simulated results Follow step by step: In Cell D1 type “=AVERAGE(B$9:B$2008)” In Cell D2 type “=MAX(B$9:B$2008)” In Cell D3 type “=MIN(B$9:B$2008)” ESD.70J Engineering Economy Module - Session 2
16
Check with your neighbors… Check the solution sheet… Ask me questions…
Give it a try! Check with your neighbors… Check the solution sheet… Ask me questions… ESD.70J Engineering Economy Module - Session 2
17
Deterministic vs. dynamic results
From the base case spreadsheet, we learn NPVA is $162.1 million What is your result for the expected NPVA and NPVB when considering demand uncertainty? Jensen’s inequality and the Flaw of Averages: Flaw of averages discussion…. Read the paper on The example here states that if an investor bases a retirement plan decision on the historical expected return of stocks, this strategy may run all of its funds much quicker than originally planned. This is because forecasts that represent or are based on averages are always wrong. In this case, a forecast based on average expectations of demand will inevitably lead to an NPV that is different than if one takes different demand scenarios, calculate NPV for each scenario, and take an expected value of NPV considering all possible scenarios. Jensen’s inequality represents this issue. Jensen’s Inequalities study convex functions and the relationship between their mean values. They are stated as follows: If X is a real-valued random variable with E(|X|) finite and the function g() is convex, then E[g(X)] >= g(E[X]). The case is opposite for concave functions. Although this inequality is used in mathematics and statistics, it is also useful in economics when showing that an investor with a concave utility function prefers a certain return to the same expected return with uncertainty. For an investor with a convex utility function, the case is similar. In this inequality, x can be demand for year 1 and f(x) be the corresponding NPV for that year. To be precise then, y could be demand for year 2, z demand for year 3, and therefore f(x, y, z) = NPV. Concentrating on one year for this example, on the left side of the inequality is the expected demand for year 1 E(x) so that f[E(x)] is the NPV corresponding to this expected demand value. This corresponds to the deterministic case since we assume that the demand in each year 1, 2, and 3 is the expected demand value, which produces the NPV of $162.1M. On the right side of the inequality is f(x), therefore the NPV obtained for year 1 for each possible value of demand. E[f(x)] is therefore the average of all NPV values obtained, where each NPV value is associated to a particular value of demand at year 1. This corresponds to what we do in simulations and is about $97M. The inequality states that the NPV value obtained from average or expected demand (deterministic case) is different from the NPV value obtained from the average of all NPV values obtained for each demand value (simulations). Here, E[f(x)] = $97M is lower than f[E(x)] = $162.1M, so it seems f(x) is a concave function, and that the deterministic case is not representative of the real NPV values that may occur in reality. While investors would expect $162.1M, in reality and on average the project would produce much less value when one recognizes uncertainty. ESD.70J Engineering Economy Module - Session 2
18
Value at Risk and Gain (VARG)
The VARG curve is another name for cumulative distribution function (CDF) In our case, VARG curve aims at making a representation to managers that “There is a probability X that NPV will be lower (higher) than Y dollars for this project” Value At Risk is a common language on Wall Street. It stresses downside risk, though we should also look at CDF for upside potential of a project. Hence the name Value At Risk AND GAIN! ESD.70J Engineering Economy Module - Session 2
19
Cumulative Distribution Function
Follow the instructions, step by step: In sheet “Simulation”, set Cell G7 “=$D$3+($D$2-$D$3)/20*F7”, and drag the formula down to G27 Set Cell H7 “=COUNTIF($B$9:$B$2008,"<="&G7)”, and drag the formula down to H27 Set Cell I7 “=H7/2000”, and drag down to cell I27 Same is done for Plan B Step 1 sets the first bounds as the MIN value, takes the range of values (as MAX - MIN) and divides it into an equal number of 20 bins. Then dragging the formula creates all 20 bins by multiplying with values between 0 and 20. Step 2 counts the number of samples that are <= to the value of the bound. Step 3 calculates the frequency of occurrence of samples for each bin. ESD.70J Engineering Economy Module - Session 2
20
Cumulative Distribution Function
Right-click the chart on the right, select “Source Data” Select “Series”, and press “Add”. This adds a new data series to the graph. Call it “NPVA” Select the range =Simulation!$G$7:$G$27 for X values, and the range =Simulation!$I$7:$I$27 for Y values. Click “OK” Double click the curve and change “Weight” to 3 Hit “F9” and watch the CDF move ! ESD.70J Engineering Economy Module - Session 2
21
ESD.70J Engineering Economy Module - Session 2
Explanation We set up 20 data buckets and count how many data points fall into each interval “=COUNTIF()” function counts the number of cells within a range that meet the criteria The Excel file demonstrates how you can: add NPVA and NPVB means as vertical lines add histograms for two NPV distributions using the information created earlier Can also use the Histogram analysis tool in “Data Analysis” package ESD.70J Engineering Economy Module - Session 2
22
Cumulative Distribution Function
Use your cursor on the graph to find different Values At Risk and Gain Alternatively, use the percentile function In cell N5, type 10% In cell R5, type “=PERCENTILE(B9:B2008,N5)” What does this tell you? That’s interesting information for managers and decision-makers! ESD.70J Engineering Economy Module - Session 2
23
ESD.70J Engineering Economy Module - Session 2
Question Why are high NPV values more cut off for Plan B on the VARG curve and histogram than for Plan A? A matter of constraints… Plan A builds for capacity 900 right away in the first year. When demand is high in year 1 and 2, it can capture such extra demand, sell more, and therefore benefit from this unexpected opportunity. In year 3, demand higher than 900 cannot be captured, which is why the histogram for Plan A is more cut off on the right than on the left. Plan B builds for capacity 300 in year 1, 600 for year 2, and 900 for year 3. Therefore in each year, when demand is higher than expected it cannot capture this unexpected opportunity and benefit from higher NPVs. This is why the VARG curve and histogram for Plan B have fewer high NPV values than Plan A. This also explains why the mean NPV for Plan B is lower than for Plan A. ESD.70J Engineering Economy Module - Session 2
24
Check with your neighbors… Check the solution sheet… Ask me questions…
Give it a try! Check with your neighbors… Check the solution sheet… Ask me questions… ESD.70J Engineering Economy Module - Session 2
25
ESD.70J Engineering Economy Module - Session 2
Summary Random number generation is fairly straight forward in Excel At least two ways to run Monte Carlo simulation: Direct RAND() calls Using Data Table Descriptive statistics from simulations Mean, Max, Min, VARG curve ESD.70J Engineering Economy Module - Session 2
26
ESD.70J Engineering Economy Module - Session 2
Next class… Today’s session modeled demand uncertainty based on a uniformly distributed random variable This is not a particularly realistic model, though it is simple and sufficient for today’s purposes Next session we’ll explore alternative probability distributions from which to sample ESD.70J Engineering Economy Module - Session 2
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.