Help using Base SAS procedures

Logistic model classification output

Reply
N/A
Posts: 0

Logistic model classification output

I have a data set which is given as below:

remiss cell li temp
1.00 0.80 1.90 1.00
1.00 0.90 1.40 0.99
0.00 0.80 0.80 0.98
0.00 1.00 0.70 0.99
1.00 0.90 1.30 0.98
0.00 1.00 0.60 0.98
1.00 0.95 1.00 0.99
0.00 0.95 1.90 1.02
0.00 1.00 0.80 1.00
0.00 0.95 0.50 1.04
0.00 0.85 0.70 0.99
0.00 0.70 1.20 0.98
0.00 0.80 0.40 1.01
0.00 0.20 0.80 0.99
0.00 1.00 1.10 0.99
1.00 1.00 1.90 1.02
0.00 0.65 0.50 1.01
0.00 1.00 1.00 1.00
0.00 0.50 0.60 0.99
1.00 1.00 1.10 0.99
0.00 1.00 0.40 1.01
0.00 0.90 0.60 1.02
1.00 1.00 1.00 1.00
0.00 0.95 1.60 0.99
1.00 1.00 1.70 0.99
1.00 1.00 0.90 0.99
0.00 1.00 0.70 0.99

I’m trying to fit logistic regression model for the above data.

Here remiss is the dependent variable and ‘1’ denotes the event.
The following is the SAS code for the logistic model.

proc logistic data=work.remiss descending;
model remiss = li cell temp/ctable pprob=(0.05 to 0.95 by 0.05);
output out=work.out1 pred=P_hat predprobs=(i);
run;

The output sas dataset work.out1 also has the variables like observed response, predicted response, predicted probability etc.

One can get the SAS output for classification table at various probability levels starting from 0.05 to 0.95 which is requested in the pprob option in the model statement.

Using work.out1 dataset, I’m trying to predict the response, say 1 or 0, based on the predicted probability where the cutoff for the event is 0.5 and it is done using the following data step.

data out1_p (keep=_FROM_ P_hat P_pred);
set out1;
if P_hat ge 0.5 then P_pred=1;else P_pred=0;
run;

proc freq data=out1_p;
tables _from_*P_pred;
run;
quit;

Using Proc Freq, the classification table is seen as,

Correct: Event is 6 and Non Event is 15.
Incorrect: Event is 3 and Non Event is 3.

This is matched with SAS output for classification table when prob level=0.5

In the above data step, when the cutoff for the event is changed as 0.25 instead of 0.5, the classification table obtained after running the data step and proc freq is,

Correct: Event is 9 and Non Event is 12.
Incorrect: Event is 6 and Non Event is 0.

which is not matched with the SAS output for classification table when prob level=0.25.

Can anyone give the explanation why this is not matching with the SAS output for classification table? I have tried with another cutoff as 0.20 and this is also not matching with the output.
Ask a Question
Discussion stats
  • 0 replies
  • 106 views
  • 0 likes
  • 1 in conversation