New Contributor
Posts: 2

# How does SAS construct a ROC curve

I am requesting help in understanding ROC curves as generated by PROC LOGISTIC.

I am using the data in Kleinbaum DG and Klein M : Logistic Regression.

THE data set is Knee fracture or kneefr.

The outcome variable is fracture   and is binary.

The data set is located  at http://web1.sph.emory.edu/dkleinb/logreg3.htm#data

As kneefr.sas7bdat or kneefr,dta

The predictor variables are:

FLEX  [Flex the knee]  Binary  yes, no

WEIGHT ability to put weight on knee [yes no]

AGECAT  patients age greater or less then 55years

PATELLAR injury to patellar [yes no]

>>>>>>>>>>

THE CODE COPIED FROM KLEINBAUM and KLEIN

proc logistic data = kneefr descending;

model fracture = Flex weight agecat head patellar /pprob = .00 to .50 by .05 ctable;

run;

proc logistic data = kneefr descending;

model fracture = Flex weight agecat head patellar /outroc =cat;

run;

Proc Print Data=CAT (obs=10);

run;

SYMBOL = PLUS interpol = RC;

proc gplot data=CAT;

plot _SENSIT_*_1MSPEC_ ;

run;

>>>>>>>>>>>>>>>>>>>>>>>>>>>

MY QUESTIONS

1. I can understand that from a logistic regression and feeding in the data for an individual patient one obtains a ln(0dd) for that patient.  From this the probability of fracture for the individual.

1. I do not understand how SAS calculates predicted probabilities by .00 to .50 by 0.5. Nor do I understand what they mean in relation to the number of fractures and /or no fractures at a probability level  when printed as the ‘ctable’ or [cut off table].

1. The print out of the Cat data gives the probability for I assume each patient. Obs 10 for instance is given as 0.22898.  Does this mean given the cut off set at 0.300  this patient is in the positive class either as a TP or a FP.

1. I am using SAS university Edition and the code for Gplot does not run.   I note that with PROC PLOT a curve is produced. Is this because the University Edition does not support GPLOT?

Is this a correct assumption?

5 Is it possible to obtain a histogram of the _pos_ and _neg_ cases with the probability cut off values on the x axis.

I thank you in advance for any assistance.

Super User
Posts: 10,770

## Re: How does SAS construct a ROC curve

http://blogs.sas.com/content/iml/2011/07/29/computing-an-roc-curve-from-basic-principles.html

http://blogs.sas.com/content/iml/2011/06/03/a-statistical-application-of-numerical-integration-the-a...

I do not understand how SAS calculates predicted probabilities by .00 to .50 by 0.5. Nor do I understand what they mean in relation to the number of fractures and /or no fractures at a probability level  when printed as the ‘ctable’ or [cut off table].

It is not predict value, it is cutoff value.

1. The print out of the Cat data gives the probability for I assume each patient. Obs 10 for instance is given as 0.22898.  Does this mean given the cut off set at 0.300  this patient is in the positive class either as a TP or a FP.

it should be event=0. False Positive .

1. I am using SAS university Edition and the code for Gplot does not run.   I note that with PROC PLOT a curve is produced. Is this because the University Edition does not support GPLOT?

An alternative way is using PROC SGPLOT in UE.

Is this a correct assumption?

5 Is it possible to obtain a histogram of the _pos_ and _neg_ cases with the probability cut off values on the x axis.

Check URL.

Discussion stats