The HPDECIDE Procedure

Getting Started: HPDECIDE Procedure

The HPDECIDE procedure can adjust posterior probabilities from a modeling procedure to make decisions. This fictitious example shows how to use the HPDECIDE procedure to adjust posterior probabilities from the DISCRIM procedure, and how to use a revenue matrix and cost constants to make decisions.

In a population of men who consult urologists for prostate problems, 70% have benign enlargement of the prostate, 25% have an infection, and 5% have cancer. A sample of 100 men is taken, and two new diagnostic measures, X and Y, are taken on each patient. The training set also includes the diagnosis that is made by reliable, conventional methods. For each patient, three treatments are available: antibiotics, surgery, or no treatment. Antibiotics are effective against infection, but they might have moderately bad side effects. Antibiotics have no effect on benign enlargement or cancer. Surgery is effective for all diseases but has potentially severe side effects such as impotence.

The first step is to create the sample of 100 men. To simulate the measurements of diagnostics X and Y, this example uses the SAS random number generator. Because you specify the initial seed to the random number generator, all your results will be identical to those presented in this example.

The following statements create the Prostate data set. The first 70 observations represent benign tumors, the next 25 represent infections, and the final 5 represent cancer.

data Prostate;
    length dx $14;
    dx='Benign';
    mx=30; sx=10;
    my=30; sy=10;
    n=70;
    link generate;
    dx='Infection';
    mx=70; sx=20;
    my=35; sy=15;
    n=25;
    link generate;
    dx='Cancer';
    mx=50; sx=10;
    my=50; sy=15;
    n=5;
    link generate;
    stop;
generate:
    do i=1 to n;
    x=rannor(12345)*sx+mx;
    y=rannor(0) *sy+my;
    output;
    end;
run;

The following statements run the DISCRIM procedure, which assumes that all prior probabilities are equal (1/3 for this example). In this example, the DISCRIM procedure misidentifies some of the benign tumors as cancer or an infection. Also, it misidentifies some of the infections as benign tumors.

 proc discrim data=prostate out=outdis short;
     class dx;
     var x y;
 run;

Because PROC DISCRIM misidentifies some of the data, you want to create a data set that contains prior probabilities and revenue information. The revenue information indicates the benefit of each treatment. The cost of each treatment, such as bad side effects, will be specified later in a DECISION statement. The following DATA step creates the revenue matrix:

data rx(type=revenue);
    input dx $14. eqprior prior nothing antibiot surgery;
    datalines;
    Benign        0.3333 70 0 0 5
    Infection     0.3333 25 0 10 10
    Cancer        0.3333 5 0 0 100
;

The variable eqprior defines an equal prior probability for each diagnosis, and the variable prior uses information that is known from the sample data set. The other variables define the revenue of each treatment option. The revenue (benefit) of doing nothing in either case is 0, and the benefit of taking antibiotics is relevant only if the patient has an infection. Surgery can remove a benign tumor, but it has very little benefit because it is not necessary. Surgery completely removes an infection, so it has the same value as antibiotics. Finally, surgery can remove a cancerous tumor and therefore is an immense benefit to the patient.

The following statements assign a treatment to each patient. In the DECISION statement, you specify the costs of treatment. The cost of doing nothing is 0, the cost of antibiotics is 5, and the cost of surgery is 20.

 proc hpdecide data=outdis out=decOut outstat=decSum;
     target dx;
     posteriors benign infection cancer;
     decision decdata=rx
     oldpriorvar=eqprior priorvar=prior
         decvars=nothing antibiot surgery
         cost= 0 5 20;
 run;

 proc print data=decSum;
 run;

Figure 1 shows the fit statistics information.

Figure 1: Fit Statistics

Obs_PROF__APROF_
14704.7


The data set decOut indicates that only one benign tumor was misidentified, but the number of infections that were misidentified as benign is similar to the results from the DISCRIM procedure. All the cancerous tumors were identified and assigned the treatment of surgery, as was the lone misidentified benign tumor. The total profit for all patients, identified in the data set decSum, is 470.

Because medical decisions are personal, the costs that are associated with each treatment can vary considerably from patient to patient. Some patients regard the side effects of surgery as more severe than other patients. Likewise, the costs of antibiotics might vary because of the patients’ insurance plans. The following statements assume a higher cost for surgery and leave the other costs constant:

 proc hpdecide data=outdis out=decOut2 outstat=decSum2;
     target dx;
     posteriors benign infection cancer;
     decision decdata=rx
     oldpriorvar=eqprior priorvar=prior
         decvars=nothing antibiot surgery
         cost= 0 5 50;
 run;

 proc print data=decSum2;
 run;

Figure 2 shows the fit statistics information that results from the higher cost of surgery.

Figure 2: Fit Statistics with Higher Cost of Surgery

Obs_PROF__APROF_
12852.85


Notice that the misclassified benign tumor is now correctly classified. However, one of the cancer cases is identified as benign; this is a costly mistake. Notice in decOut that the total profit has been reduced from 470 to 285.

Last updated: July 02, 2020