### Example 7.1 Oil Wildcatter’s Problem with Insurance

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 \$130,000, will redeem \$200,000 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 \$130,000.

```/* -- create the STAGEIN= data set                  -- */
data Dtoils4;
format Stage \$12. Stype \$2. Outcome \$14.
input Stage \$12. Stype \$4. Outcome \$16. Succ \$12.
datalines;
Drill       D   Drill           Insurance              .
.           .   Not_Drill       .                      .
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 */
Payoff=Payoff+200000;

/* drop unneeded variables */
drop Rcost Return;
```
```datalines;
Low             Dry             Not_Drill       .
Low             Wet             Not_Drill       .
Low             Soaking         Not_Drill       .
Fair            Dry             Not_Drill       .
Fair            Wet             Not_Drill       .
Fair            Soaking         Not_Drill       .
High            Dry             Not_Drill       .
High            Wet             Not_Drill       .
High            Soaking         Not_Drill       .
;
```

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 7.1.1.

Output 7.1.1: Payoffs of the Oil Wildcatter’s Problem with an Insurance Option

 Oil Wildcatter's Problem The Payoffs

Obs Cost Deposit Drill Insuran Payoff
1 Low Dry Not_Drill   \$0
2 Low Dry Drill Buy_Insurance \$50,000
3 Low Dry Drill Do_Not_Buy \$-150,000
4 Low Wet Not_Drill   \$0
5 Low Wet Drill Buy_Insurance \$550,000
6 Low Wet Drill Do_Not_Buy \$550,000
7 Low Soaking Not_Drill   \$0
8 Low Soaking Drill Buy_Insurance \$1,050,000
9 Low Soaking Drill Do_Not_Buy \$1,050,000
10 Fair Dry Not_Drill   \$0
11 Fair Dry Drill Buy_Insurance \$-100,000
12 Fair Dry Drill Do_Not_Buy \$-300,000
13 Fair Wet Not_Drill   \$0
14 Fair Wet Drill Buy_Insurance \$400,000
15 Fair Wet Drill Do_Not_Buy \$400,000
16 Fair Soaking Not_Drill   \$0
17 Fair Soaking Drill Buy_Insurance \$900,000
18 Fair Soaking Drill Do_Not_Buy \$900,000
19 High Dry Not_Drill   \$0
20 High Dry Drill Buy_Insurance \$-300,000
21 High Dry Drill Do_Not_Buy \$-500,000
22 High Wet Not_Drill   \$0
23 High Wet Drill Buy_Insurance \$200,000
24 High Wet Drill Do_Not_Buy \$200,000
25 High Soaking Not_Drill   \$0
26 High Soaking Drill Buy_Insurance \$700,000
27 High Soaking Drill Do_Not_Buy \$700,000

To 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)
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 7.1.2. The summary in Output 7.1.2 shows that the insurance policy is worth \$240,000 - \$140,000 = \$100,000, but since it costs \$130,000, the wildcatter should reject such an insurance policy.

Output 7.1.2: Summary of the Oil Wildcatter’s Problem

 Oil Wildcatter's Problem

The DTREE Procedure
Optimal Decision Summary

Order of Stages
Stage Type
Drill Decision
Insurance Decision
Cost Chance
Oil_Deposit Chance
_ENDST_ End

Decision Parameters
Decision Criterion: Maximize Expected Value (MAXEV)
Optimal Decision Yields: \$140,000

Optimal Decision Policy
Up to Stage Insurance
Alternatives or Outcomes Cumulative Reward Evaluating Value

Now assume that the oil wildcatter is risk averse and has an exponential utility function with a risk tolerance of \$1,200,000. 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 7.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 7.1.3: Summary of the Oil Wildcatter’s Problem with RT = 1,200,000

 Oil Wildcatter's Problem

The DTREE Procedure
Optimal Decision Summary

Order of Stages
Stage Type
Drill Decision
Insurance Decision
Cost Chance
Oil_Deposit Chance
_ENDST_ End

Decision Parameters
Decision Criterion: Maximize Certain Equivalent Value (MAXCE)
Risk Tolerance: \$1,200,000
Optimal Decision Yields: \$45,728

Optimal Decision Policy
Up to Stage Insurance
Alternatives or Outcomes Cumulative Reward Evaluating Value