The DTREE Procedure |
Again consider the oil wildcatter's problem introduced in the section "Introductory Example". Suppose that the wildcatter is concerned that the probability of a dry well may be as high as 0.5.
The wildcatter
has learned that an insurance company is willing to offer him
a policy that, with a premium of $, will redeem
$ if the well is dry. He would like to include the
alternative of buying insurance into his analysis.
One way to do this is to include a stage for this decision in
the model.
The following DATA step reads this new decision problem into
the STAGEIN= data set named Dtoils4.
Notice the new stage named 'Insurance'
, which
represents the decision of whether or not to buy the insurance.
Also notice that the cost of the insurance is represented as
a negative reward of $.
/* -- create the STAGEIN= data set -- */ data Dtoils4; format Stage $12. Stype $2. Outcome $14. Succ $12. Premium dollar12.0; input Stage $12. Stype $4. Outcome $16. Succ $12. Premium dollar12.0; datalines; Drill D Drill Insurance . . . Not_Drill . . Insurance D Buy_Insurance Cost -$130,000 . . Do_Not_Buy Cost . Cost C Low Oil_Deposit . . . Fair Oil_Deposit . . . High Oil_Deposit . Oil_Deposit C Dry . . . . Wet . . . . Soaking . . ;
Probabilities associated with the uncertain events are given in the PROBIN= data set named Dtoilp4. Except for the order of the variables in this data set, it is the same as the Dtoilp1 data set given in the section "Introductory Example".
/* -- create the PROBIN= data set -- */ data Dtoilp4; input (V1-V3) ($) P1-P3 ; datalines; Low Fair High 0.2 0.6 0.2 Dry Wet Soaking 0.5 0.3 0.2 ;
The payoffs for this problem are now calculated to include the cost and value of the insurance. The following DATA step does this.
/* -- create PAYOFFS= data set -- */ data Dtoilu4; input (Cost Deposit Drill Insuran) ($16.) ; format Drill $9. Insuran $14. Payoff dollar12.0; /* determine the cost for this scenario */ if Cost='Low' then Rcost=150000; else if Cost='Fair' then Rcost=300000; else Rcost=500000; /* determine the oil deposit and the corresponding */ /* net payoff for this scenario */ if Deposit='Dry' then Return=0; else if Deposit='Wet' then Return=700000; else Return=1200000;
/* calculate the net return for this scenario */ if Drill='Not_Drill' then Payoff=0; else Payoff=Return-Rcost; /* determine redeem received for this scenario */ if Insuran='Buy_Insurance' and Deposit='Dry' then Payoff=Payoff+200000; /* drop unneeded variables */ drop Rcost Return; datalines; Low Dry Not_Drill . Low Dry Drill Buy_Insurance Low Dry Drill Do_Not_Buy Low Wet Not_Drill . Low Wet Drill Buy_Insurance Low Wet Drill Do_Not_Buy Low Soaking Not_Drill . Low Soaking Drill Buy_Insurance Low Soaking Drill Do_Not_Buy Fair Dry Not_Drill . Fair Dry Drill Buy_Insurance Fair Dry Drill Do_Not_Buy Fair Wet Not_Drill . Fair Wet Drill Buy_Insurance Fair Wet Drill Do_Not_Buy Fair Soaking Not_Drill . Fair Soaking Drill Buy_Insurance Fair Soaking Drill Do_Not_Buy High Dry Not_Drill . High Dry Drill Buy_Insurance High Dry Drill Do_Not_Buy High Wet Not_Drill . High Wet Drill Buy_Insurance High Wet Drill Do_Not_Buy High Soaking Not_Drill . High Soaking Drill Buy_Insurance High Soaking Drill Do_Not_Buy ;
The payoff table can be displayed with the following PROC PRINT statement:
/* -- print the payoff table -- */ title "Oil Wildcatter's Problem"; title3 "The Payoffs"; proc print data=Dtoilu4; run;
The table is shown in Output 5.1.1.
Output 5.1.1: Payoffs of the Oil Wildcatter's Problem with an Insurance OptionTo find the optimal decision, call PROC DTREE with the following statements:
/* -- PROC DTREE statements -- */ title "Oil Wildcatter's Problem"; proc dtree stagein=Dtoils4 probin=Dtoilp4 payoffs=Dtoilu4 nowarning ; variables / stage=Stage type=Stype outcome=(Outcome) reward=(Premium) successor=(Succ) event=(V1 V2 V3) prob=(P1 P2 P3) state=(Cost Deposit Drill Insuran) payoff=(Payoff); evaluate; summary / target=Insurance;
The VARIABLES statement identifies the variables in the input data sets. The yield of the optimal decision is written to the SAS log as:
NOTE: Present order of stages: Drill(D), Insurance(D), Cost(C), Oil_Deposit(C), _ENDST_(E). NOTE: The currently optimal decision yields 140000.
The optimal decision summary produced by the SUMMARY statements are shown in Output 5.1.2. The summary in Output 5.1.2 shows that the insurance policy is worth , but since it costs $, the wildcatter should reject such an insurance policy.
Output 5.1.2: Summary of the Oil Wildcatter's Problem
The DTREE Procedure
Optimal Decision Summary
|
Now assume that the oil wildcatter is risk averse and has an exponential utility function with a risk tolerance of $. In order to evaluate his problem based on this decision criterion, the wildcatter reevaluates the problem with the following statements:
reset criterion=maxce rt=1200000; summary / target=Insurance;
The output from PROC DTREE given in Output 5.1.3 shows that the decision to purchase an insurance policy is favorable in the risk-averse environment. Note that an EVALUATE statement is not necessary before the SUMMARY statement. PROC DTREE evaluates the decision tree automatically when the decision criterion has been changed using the RESET statement.
Output 5.1.3: Summary of the Oil Wildcatter's Problem with RT =
The DTREE Procedure
Optimal Decision Summary
|
Copyright © 2008 by SAS Institute Inc., Cary, NC, USA. All rights reserved.