IndE 311: Stochastic Models and Decision Analysis Winter 2007 Lab 1: Using spreadsheets to build and analyze decision trees The objective of the lab is to familiarize you with two Excel add-ins (TreePlan & Sensit) to build and analyze decision trees. Part 0: Get ready Go to class web page (http://courses.washington.edu/inde311), then select “Labs”. Download the two add-ins (TreePlan and SensIt): Right-click on each link, select ‘Save Target as…’ and save the two files on the desktop. Open Microsoft Excel, select Tools -> Add-Ins… Select Browse and point to the two add-ins (on the desktop now) one by one. Verify that the add-ins are installed by checking if your Tools menu contains “Decision Tree” and “Sensitivity Analysis”, i.e. as below: Page 1 of 10 Part 1: Create a decision tree using TreePlan Consider the first Goferbroke Co. problem in the text book (no seismic survey) Step 1: In Microsoft Excel, select decision tree from the Tools menu and click on New Tree. See Figure 1.1. Figure 1.1 This creates the default decision tree as shown in figure 1.2 with a single (square) decision node with two branches. Figure 1.2 Note: To change the type of any node in TreePlan, select the cell containing the node (B5 in figure 2) and choose Decision Tree from the Tools menu. This brings up a dialogue box that allows you to change the types of node. Page 2 of 10 Step 2: Click on the cells to change the labels. Change labels for “Decision 1” and “Decision 2” (cells D2 & D7 in figure 2) to “Drill” and “Sell” respectively. Step 3: Click on the cell containing the terminal node at the end of the drill branch (F3 in Figure 1.2), and choose Decision Tree from the Tools menu. This brings up the TreePlan dialog as shown in figure 1.3 Figure 1.3 Choose the “change to event node” option on the left and select two branches on the right then click OK. This results in the decision tree with the nodes and branches shown in Figure 1.4 (after replacing the default labels “Event 1” and “Event 2” with “Oil” and “Dry”, respectively) Figure 1.4 Step 4: Change the net cash flows and prior probabilities of each branch by click on the default values and replace them with correct numbers. Initially, each branch would show a default value of 0 for the net cash flow being generated. Each of the two branches leading from event node would display default values of 0.5 for their prior probabilities. They should be changed as following: D6 = -100, D14 = 90, H1 = 0.25, H4 = 800, H6 = 0.75, H9 = 0 Page 3 of 10 At each stage in constructing a decision tree, TreePlan automatically solves for the optimal policy with the current tree when using Bayes’ Decision rule. See figure 1.5. The number inside each decision node indicates which branch should be chosen (assuming the branches emanating from that node are numbered consecutively from top to bottom). Figure 1.5 Part 2: Calculate posterior probabilities using Excel Open a new sheet to practice calculating posterior probabilities using Bayes’ theorem. Remember that we were given P(FSS|oil) and P(USS|dry), but wanted the posterior probabilities. This can be done in Excel using the following template (formulas shown here). Try building it yourself, while paying attention to how Bayes’ theorem is applied. Figure 2.1 The result should look similar to this: Figure 2.2 Page 4 of 10 Part 3: Create the decision tree for the full Goferbroke Co. problem (With the seismic survey) Practice what you learned on Part 1 on the full Goferbroke problem. Remember to use the posterior probabilities you found in Part 2. Take your time. The result should look like Figure 3.1. Figure 3.1 Page 5 of 10 Part 4a: Prepare worksheet for sensitivity analysis To perform the sensitivity analysis, we need to ‘consolidate’ the problem data. That is, we want to collect all problem parameters to one place and refer to them in the decision tree. So, on the right side of your decision tree, you want to have your data entered in a format as in Figure 4.1. Figure 4.1 Now we want the data in the decision tree taken from these values, such that they are updated any time a change is made in the ‘consolidated’ data. Note that in Figure 4.1, the posterior probabilities are functions of the prior probabilities (constructed as in Part 2) and will be updated once a change is made in any of the prior probabilities. You should now have all cells shaded in Figure 4.2 as a function of your consolidated data. 0.142857 Oil 670 Drill 800 -100 -15.7143 0.7 670 0.857143 Dry FSS -130 2 0 0 -130 60 Sell 60 90 60 Do Survey 0.5 -30 123 Oil 670 Drill 800 -100 270 0.3 670 0.5 Dry USS -130 1 0 0 -130 270 1 Sell 123 60 90 60 0.25 Oil 700 Drill 800 -100 100 700 0.75 Dry Don't do survey -100 1 0 0 -100 100 Sell 90 90 90 Figure 4.2 Page 6 of 10 Now you can also get the Expected Payoff (result of your decision tree) at the bottom of your consolidated data, and summarize the optimal decision policy using a set of formulas, for example as in Figure 4.3, Figure 4.3 which would give, with the current data, the following result in Figure 4.4: Now it should be very easy for you to try different values for the costs, probabilities and other parameters and see how these affect your decision! In the next part, we’ll let a sensitivity analysis package, SensIt, test different values for us. Page 7 of 10 Part 5: Use Sensit to create three types of sensitivity analysis graphs Plot is used to generate a graph that shows how an output cell varies for different values of a single data cell. Select Sensitivity Analysis Plot from the Tool Menu, brings up the Plot dialogue box shown in Figure 5.1. The left side of the Plot dialogue box is used to specify the data cell that will be varied (the prior probability of oil in cell V9) and the o utput cell of interest (the expected payoff in cell X5). The right side of the Plot dialogue box is used to specify the range of values to be considered for the single data cell (the prior probability of oil). Clicking OK generates the graph shown in Figure 5.2. Figure 5.1 Expected Payoff SensIt - Sensitivity Analysis - Plot 700 600 500 400 300 200 100 0 0 0.2 0.4 0.6 0.8 1 Prior Probability of oil Figure 5.2 Page 8 of 10 Spider Graph can be used investigate how a cell value changes (e.g. the expected payoff) under percentage changes of a certain set of cells (e.g. costs or revenues in cells V4:V7). Select Sensitivity Analysis -> Spider from the Tool Menu. In the dialog box shown in Figure 5.3, fill in the values of interest. Click OK. . Figure 5.3 The resulting spider graph would look similar to Figure 5.4 Expected Payoff Value Sensit - Sensitivity Analysis - Spider 200 190 180 170 160 150 140 130 120 110 100 90 40% 60% 80% 100 % Cost of survey Cost of drill Revenue if oil Revenue if sell Revenue if dry 120 % 140 % 160 % % Change in Input Value Figure 5.4 Page 9 of 10 Tornado graph: add three columns for the data set that defines the range (low, base, and high) to test for the data cells as shown in Figure 5.5 Figure 5.5 Selecting Sensitivity Analysis ->Tornado from the Tool menu, which brings up the dialog box shown in Figure 5.6. After filling in the values of interest, click OK Figure 5.6 The resulting tornado graph is shown in Figure 5.7. Figure 5.7 Investigate the three charts generated. We will talk about what they represent during the lab. Page 10 of 10