Oil Wildcatter's Problem in Risk Averse Setting
/**************************************************************/
/* S A S S A M P L E L I B R A R Y */
/* */
/* NAME: DTREE2 */
/* TITLE: Oil Wildcatter's Problem in Risk Averse Setting */
/* (dtree2) */
/* PRODUCT: OR */
/* SYSTEM: ALL */
/* KEYS: DTREE */
/* PROCS: DTREE, PRINT, FORMAT, GPLOT */
/* DATA: */
/* */
/* SUPPORT: UPDATE: */
/* REF: Example 2 from the DTREE chapter */
/* MISC: */
/* */
/**************************************************************/
goptions hpos=80 vpos=32;
/* -- create the STAGEIN= data set -- */
data Dtoils4;
format _STNAME_ $12. _OUTCOM_ $15. _SUCCES_ $12.;
input _STNAME_ $ _STTYPE_ $ _OUTCOM_ $
_SUCCES_ $ ;
datalines;
Divestment Decision No_Divestment Insurance
. . 10%_Divestment Insurance
. . 20%_Divestment Insurance
. . 30%_Divestment Insurance
. . 40%_Divestment Insurance
. . 50%_Divestment Insurance
. . 60%_Divestment Insurance
. . 70%_Divestment Insurance
. . 80%_Divestment Insurance
. . 90%_Divestment Insurance
. . 100%_Divestment .
Insurance Decision Buy_Insurance Cost
. . Do_Not_Buy Cost
Cost Chance Low Oil_Deposit
. . Fair Oil_Deposit
. . High Oil_Deposit
Oil_Deposit Chance Dry .
. . Wet .
. . Soaking .
;
/* -- create the PROBIN= data set -- */
data Dtoilp4;
input _EVENT1 $ _PROB1 _EVENT3 $ _PROB3 ;
datalines;
Low 0.2 Dry 0.5
Fair 0.6 Wet 0.3
High 0.2 Soaking 0.2
;
/* -- create the PAYOFFS= data set -- */
data Dtoilu4(drop=i j k l);
length _STATE1-_STATE4 $16. ;
format _VALUE_ dollar12.0;
/* define and initialize arrays */
array DIVEST{11} $16. _TEMPORARY_ ('No_Divestment',
'10%_Divestment',
'20%_Divestment',
'30%_Divestment',
'40%_Divestment',
'50%_Divestment',
'60%_Divestment',
'70%_Divestment',
'80%_Divestment',
'90%_Divestment',
'100%_Divestment' );
array INSUR{3} $16. _TEMPORARY_ ('Do_Not_Buy',
'Buy_Insurance',
' ' );
array COST{4} $ _TEMPORARY_ ('Low',
'Fair',
'High',
' ' );
array DEPOSIT{4} $ _TEMPORARY_ ('Dry',
'Wet',
'Soaking',
' ' );
do i=1 to 10; /* loop for each divestment */
_STATE1=DIVEST{i};
/*
* determine the percentage of ownership retained
* for this scenario
*/
PCT=1.0-((i-1)*0.1);
do j=1 to 2; /* loop for insurance decision */
_STATE2=INSUR{j};
/*
* determine the premium need to pay for this
* scenario
*/
if _STATE2='Buy_Insurance' then PREMIUM=130000;
else PREMIUM=0;
do k=1 to 3; /* loop for each well cost */
_STATE3=COST{k};
/* determine the cost for this scenario */
if _STATE3='Low' then _COST_=150000;
else if _STATE3='Fair' then _COST_=300000;
else _COST_=500000;
do l=1 to 3; /* loop for each deposit type */
_STATE4=DEPOSIT{l};
/*
* determine the oil deposit and the
* corresponding net payoff for this scenario
*/
if _STATE4='Dry' then _PAYOFF_=0;
else if _STATE4='Wet' then _PAYOFF_=700000;
else _PAYOFF_=1200000;
/* determine redeem received for this scenario */
if _STATE2='Buy_Insurance' and _STATE4='Dry' then
REDEEM=200000;
else REDEEM=0;
/* calculate the net return for this scenario */
_VALUE_=(_PAYOFF_-_COST_-PREMIUM+REDEEM)*PCT;
/* drop unneeded variables */
drop _COST_ _PAYOFF_ PREMIUM REDEEM PCT;
/* output this record */
output;
end;
end;
end;
end;
/* output an observation for the scenario 100%_Divestment */
_STATE1=DIVEST{11};
_STATE2=INSUR{3};
_STATE3=COST{4};
_STATE4=DEPOSIT{4};
_VALUE_=0;
output;
run;
/* -- print the payoff table -- */
title "Oil Wildcatter's Problem";
title3 "The Payoffs";
proc print data=Dtoilu4;
run;
/* -- PROC DTREE statements -- */
title "Oil Wildcatter's Problem";
proc dtree stagein=Dtoils4
probin=Dtoilp4
payoffs=Dtoilu4
criterion=maxce rt=1200000
nowarning;
evaluate;
summary / target=Divestment;
summary / target=Insurance;
quit;
/* create a data set for the return corresponds to each */
/* divestment possibilities and the insurance options */
data Data2g;
input INSURE DIVEST VALUE;
datalines;
1 0 45728
0 0 44499
1 10 46552
0 10 48021
1 20 46257
0 20 49907
1 30 44812
0 30 50104
1 40 42186
0 40 48558
1 50 38350
0 50 45219
1 60 33273
0 60 40036
1 70 26927
0 70 32965
1 80 19284
0 80 23961
1 90 10317
0 90 12985
1 100 0
0 100 0
;
/* -- define a format for INSURE variable -- */
proc format;
value sample 0='Do_Not_Buy' 1='Buy_Insurance';
run;
/* -- define title -- */
title h=3 "Oil Wildcatter's Problem";
/* define legend -- */
legend1 frame cframe=white label=none
cborder=black position=center ;
/* define symbol characteristics of the data points */
/* and the interpolation line for returns vs divestment */
/* when INSURE=0 */
symbol1 c=cyan i=join v=dot l=1 h=1;
/* define symbol characteristics of the data points */
/* and the interpolation line for returns vs divestment */
/* when INSURE=1 */
symbol2 c=green i=join v=square l=2 h=1;
/* -- define axis characteristics -- */
axis1 minor=none label=('Divestment (in percentage)');
axis2 minor=none label=(angle=90 rotate=0 'Certainty Equivalent');
/* set graphics options */
goptions htext=1.5;
/* plot VALUE vs DIVEST using INSURE as third variable */
proc gplot data=Data2g ;
plot VALUE*DIVEST=INSURE / haxis=axis1
vaxis=axis2
legend=legend1
name="dt2"
frame
cframe=white ;
format INSURE SAMPLE.;
run;
quit;