Exercise 7 1 : Decision Trees Monash University School of Information Management and Systems IMS3001 Business Intelligence Systems Semester 1, 2004 Tutorial Week 9 Purpose: This exercise is aimed at assisting you in using Excel spreadsheets in setting up, solving, and interpreting some models that are commonly present in BI systems. At the end of this exercise, you would have hands-on experience in using TreePlan, (http://www.treeplan.com/) an Excel Add-in, to set up and solve decision tree problems. A. Decision Trees A decision tree is one way of representing a decision problem. A decision tree presents the decision alternatives and states of nature (outcomes) in a sequential manner. A decision alternative is defined as a course of action or a strategy that can be chosen by the decision maker. The state of nature is an outcome over which the decision maker has little or no control. All decision trees are similar in that they contain decision nodes (or points) and state of nature of nodes (or points). These nodes are represented using the following symbols: = A decision node. Arcs (lines) originating from a decision node denote all decision alternatives available at that node. Of these, the decision maker must select only one alternative. = A state of nature (or chance) node. Arcs (lines) originating from a chance node denotes all states of nature that could occur at that node. Of these, only one state of the nature will occur To illustrate the use of decision trees in solving decision problems, let us consider the following example 1 : We use five steps to setup and solve the problem: B. Thompson Lumber Company Example John Thompson is the founder and president of Thompson Lumber Company, a profitable firm located in Portland, Oregon. He is faced with the problem of whether or not to expand his product line. Step 1: Clearly define the problem at hand John identifies his problem as follows: whether to expand his product line by manufacturing and marketing a new product, backyard storage sheds. Step 2: List all possible decision alternatives The decision alternatives that are available to John are: (1) a large plant to manufacture storage sheds, (2) a small plant to manufacture the storage sheds, or (3) no plant at all (i.e., he has the option of not developing the new product line). Step 3: Identify the possible future outcomes for each decision alternative John determines that there are only two possible outcomes: the market for storage sheds could be favourable, meaning that there is high demand for the product; or it could be unfavourable, meaning that there is a low demand for the sheds. Step 4: Identify the payoff (usually profit or cost) for each combination of alternatives and outcomes John wants to maximise his profits. He can use profit to evaluate each consequence. Not every decision, of course, can be 1 This exercise is based on the book: Render, B., Stair, R. and Balakrishnan, N. (2003) Managerial Decision Modeling with Spreadsheets, Prentice Hall. 1
based on money alone; any appropriate means of measuring benefit is acceptable. In decision theory, we call such payoffs or profits conditional values. John has already evaluated the potential profits associated with the various combinations of alternatives and outcomes. With a favourable market, he thinks a large facility would result in a net profit of $200,000. This net profit of $200,000 is a conditional value because John s receiving the money is conditional upon both his building a large factory and having a good market. The conditional value of market is unfavourable would be $180,000 net loss. A small plant would result in a net profit of $100,000 in a favourable market, but a net loss of $20,000 in unfavourable market. Finally, the alternative Do Nothing will result in $0 profit in either market. The easiest way to present this is by using a payoff table, or decision table as shown below: States of Nature Alternative Favourable Market ($) Unfavourable Market ($) Construct a large plant 200,000-180,000 Construct a small plant 100,000-20,000 Do nothing 0 0 Step 5: Apply a decision theory modelling technique and make your decision We can represent the problem using a decision tree. A simple decision tree is shown in Figure 1 below. Payoffs Construct a Large plant 1 Favorable Market Unfavorable Market $200,000 -$180,000 Construct a Small plant 2 Favorable Market Unfavorable Market $100,000 -$ 20,000 Do Nothing Figure 1. Thompson Lumber s decision tree $0 C. Folding Back a Decision Tree The process by which the tree is analysed to identify optimal decision is referred to as folding back the decision tree. We start with the payoffs (i.e. right extreme of the tree) and work our way back to the first decision node. In folding back the decision tree, we use the following rules: At each state of the nature (or chance) node, we compute the expected value using the probabilities of all possible outcomes at that node and the payoffs associated with these outcomes At each decision node, we select the alternative that yields the better expected value or payoff. If the expected values or payoffs represent profits, we select the alternative with the largest value. In contrast, if the expected values of payoffs represent costs, we select the alternative with the smallest value. The complete decision tree is presented in Figure 2. For convenience, the probability of each outcome is shown in parenthesis next to each state of mature. The EMV (Expected Monetary Value) at each state of nature nodes is then calculated and placed by that node. The EMV node at node 1 is $10,000. This represents the arc from the decision node to construct the large plant. The EMV at node 2 (if John decides to construct a small plant) is $40,000. Building no plant has, of course, a payoff of $0. 2
EMV = (0.5)($200,000)+(0.5)(-$180,000)=$10,000 Payoffs Construct a Large plant 1 Favourable Market Unfavourable Market $200,000 -$180,000 Construct a Small plant 2 Favourable Market Unfavourable Market $100,000 -$ 20,000 Do Nothing $0 EMV = (0.5)($100,000)+(0.5)(-$20,000)=$40,000 Figure 2. Completed decision tree for Thompson Lumber At this stage the decision tree has been folded back to just the first decision node and the three alternatives (arcs) originating from it. That is, all state if nature nodes and the outcomes from these nodes have been examined and collapsed into the EMVs. The reduced decision tree is shown in Figure 3. Construct a Large plant EMV = $10,000 Construct a Small plant EMV = $40,000 Do Nothing EMV = $0 Figure 3. Reduced decision tree for Thompson Lumber Figure 4. Initial decision tree from TreePlan Using the above rule, we now select the alternative with the highest EMV. In this case, it corresponds to the alternative to build a small plant. The resulting EMV is $40,000. D. Installing and Enabling TreePlan TreePlan is a program that helps you build a decision tree diagram with formulas for determining the optimal strategy. The TreePlan program consists of a single Excel add-in file, called TREEPLAN.XLA, which can be found on the CD-ROM that accompanies the book by Render, Stair and Balakrishnan 1. A free tryout version is also available from http://www.treeplan.com/ or from the IMS3001 Unit website. Loading Manually: To install TreePlan do the following: Open Excel. Click File>Open and use the browse window to find treeplan.xla file (either on your hard disk, the CD-ROM or disk). Open the file. Note that you will not see anything new on your Excel spreadsheet at this time. Click Tools in the Excel s main menu. You will see an option called Decision Tree. If you don t see this option, try installing treeplan.xla as Excel Add-in. To do this, Click on Tools>Add-ins. Then click Browse and use the window to locate the treeplan.xla file. Select the file by clicking on it. Then click OK. You will as option named TreePlan Decision Tree Add-in in the Add-in list. Make sure the box next to it is checked. Click OK. To subsequently prevent TreePlan from loading 3
automatically, click Tools>Add-ins, and uncheck the box next to this option, Click Tools in Excel s main menu. You will see an option called Decision Tree. E. Creating a Decision Tree Using TreePlan There are 6 steps to setup and solve a decision tree problem using TreePlan. Step 1: Starting TreePlan Start Excel and open a blank worksheet. Place the cursor in any blank cell (say cell A1). Select Tools>Decision Tree from Excel s main menu. Step2: Starting a new tree Select New Tree. As shown in Figure 4, this will create an initial decision tree with a single decision node (in cell B5 f the cursor was placed in cell A1). Two alternatives (named Decision 1 and Decision 2 are automatically created at this node. Step 3: Adding nodes and branches We now modify the initial decision tree to reflect the full decision tree problem for Thompson Lumber shown in Figure 1. To do so, we use TreePlan menus. To bring up the TreePlan menu, we select Tools>Decision Tree. The actual TreePlan menu is displayed each time depends on the location of the cursor when we bring up the menu, as follows: If the cursor is at a node in the tree (such as cell B5 in Figure 4, the menu shown in Figure 5a is displayed. If the cursor is at the terminal point in the tree (such as cells F3 and F8 in Figure 5b), the menu shown in Figure 5b is displayed. If the cursor is at any other location in the spreadsheet, the menu shown in Figure 5c. (a) (b) (c) Figure 5. TreePlan menus For the Thompson example, we begin by placing the cursor in cell B5 and bringing up the menu in Figure 5a. We then select Add Branch and click OK to get the third decision branch (named Decision 3). Next we move the cursor to the end of the branch for Decision 1 (i.e., to cell F3) and bring up the menu in Figure 5b. WE first select Change to Even Node (TreePlan refers to state of nature nodes as event nodes). Then we select Two under Branches to add two states of nature arcs, named Event 4 and Event 5, respectively. Since these are states of nature, we need to associate probability values to each event. TreePlan automatically assigns equal probability values by default. In this case, since there are two events, the default value assigned is 0.5. We now move the cursor to the end of the branch of Decision 2 and repeat the preceding step to create Event 6 ad Event 7. The structure of the decision tree, shown in Figure 6 is now similar to the shown in Figure 1. Step 4: Changing titles, probabilities, and payoffs We can change the default titles for all arcs in the decision tree to reflect the Thompson problem. For example, we can replace Decision 1 (in cell D4 of Figure 6) with Large Plant. Likewise, we can replace Event 4 (in cell H2 of Figure 6) with Fav Market. The changes are shown in Figure 7. We can also change the default probability values on the even arcs to the correct values, if needed. In Thompson s case, it turns out the actual event probabilities (0.5) are the same as the default probabilities. Finally, we enter the payoffs. TreePlan allows us to enter these values in one of two ways: 4
We can directly enter the payoffs at the end of each path in the decision tree. That is, we can enter the appropriate payoff values in cells K3, K8, K13, and K18, and K23, as shown in Figure 7. Allow TreePlan to compute the payoffs. Each time we create an arc (decision alternative or state of nature) in TreePlan, it assigns a default payoff of zero to that branch. We can edit these payoffs (or costs) for all alternatives and states of nature. For example, we leave cell D6 at $0 (default value) since there is no cost specified to build a large plant. However, we can change the entry in cell H4 to $200,000 to reflect the payoff if the market turns out to be favorable. TreePlan adds these entries (in cells D6 and H4) automatically and reports it as the payoff in cell K3. We can do likewise for all other payoffs in the decision tree. Step5: Identifying the best decision Once all expected values have been computes, TreePlan then selects the optimal decision alternative at each decision node. The selection is indicated within the node. Or example, the 2 in the decision node in cell B14 indicates that the second alternative (i.e., build a small plant) is the best choice for Thompson Lumber. The best EMV is $40,000 is shown next to this decision node (in cell A15). If the payoffs denote costs we can click on Options in any of the TreePlan menus to change the selection criterion from maximizing profits to minimizing costs. In this case TreePlan will select the alternative the smallest expected costs. Payoff value There are 2 states of nature at this node Probability value of Event 7 3 decision alternatives are available at this node Figure 6. Completed decision tree using TreePlan 5
EMV for Large Plant Best is Decision 2 Best EMV Figure 7. Solved decision tree using TreePlan - End of Tutorial - 6