Programming the statistical procedures from SAS

How to set up cut-off value in PROC LOGISTIC

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 6
Accepted Solution

How to set up cut-off value in PROC LOGISTIC

When I use proc logistic with SCORE statement,

I wonder if there is a way of setting the cut-off value to help decision?

 

I also saw a PRIOREVENT statement in the proc logistic,

I wonder what doese this statement mean?


Accepted Solutions
Solution
‎12-03-2016 01:24 PM
Grand Advisor
Posts: 9,451

Re: How to set up cut-off value in PROC LOGISTIC

No. If you put validate table in score statement, you can generate Confuse Matrix.


data train valid;
 set sashelp.class;
 if _n_ le 12 then output train;
  else output valid;
run;

proc logistic data=train;
model sex=weight height age/ ctable;
score data=valid out=score;
run;

proc tabulate data=score;
class f_sex i_sex;
table f_sex,i_sex;
run;

View solution in original post


All Replies
Grand Advisor
Posts: 9,451

Re: How to set up cut-off value in PROC LOGISTIC


proc logistic data=sashelp.class;
model sex=weight height age/ ctable;
run;
Occasional Contributor
Posts: 6

Re: How to set up cut-off value in PROC LOGISTIC

Thanks Ksharp,

 

As I have both training and validation set, I would be more interested in the confusion matrix for my validation data. 

 

If you use proc logist data=taining; model y = x1 x2 x3 / CTABLE pprob=0.3; score data= validation; run;, then the confusion matrix from output would be probably for the training set instead of validation set. Am I right? So How can I create a confusion matrix for my validation data?

 

 

Solution
‎12-03-2016 01:24 PM
Grand Advisor
Posts: 9,451

Re: How to set up cut-off value in PROC LOGISTIC

No. If you put validate table in score statement, you can generate Confuse Matrix.


data train valid;
 set sashelp.class;
 if _n_ le 12 then output train;
  else output valid;
run;

proc logistic data=train;
model sex=weight height age/ ctable;
score data=valid out=score;
run;

proc tabulate data=score;
class f_sex i_sex;
table f_sex,i_sex;
run;

Occasional Contributor
Posts: 6

Re: How to set up cut-off value in PROC LOGISTIC

Thanks KSharp,

 

When I modified my input like the following:

proc logistic data=train des;
model default=&selected PLOTS / CTABLE pprob=0.5;
score data=valid
out=scoval
outroc=roc;
run;

 

I will have the following warning message:

WARNING: Some plots have more than 5000 observations and are suppressed. Specify the
PLOTS(MAXPOINTS=NONE) option in the PROC LOGISTIC statement to display the plots.

 

However, this message will disappear if I remove the CTABLE STATMENT. 

Grand Advisor
Posts: 9,451

Re: How to set up cut-off value in PROC LOGISTIC

You can use the following to suppress these warning info.


ods select none;
proc logistic.........

ods select all;

SAS Super FREQ
Posts: 3,306

Re: How to set up cut-off value in PROC LOGISTIC

It looks like there is a complete explanation and example for multinomial response in the SAS note 

Usage Note 22603: Producing an actual-by-predicted table (confusion matrix) for a multinomial respon...

Most of the syntax and ideas should translate to the case of a binary response, since binary is a special case of multinomial.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 254 views
  • 3 likes
  • 3 in conversation