Hi everyone,
I have a dataset similar to the one below:
DATA HAVE;
input ID Age Sex DM IHD Cholesterol Outcome;
DATALINES;
1 49 1 0 0 0 0
2 20 1 0 1 1 0
3 23 1 0 0 0 1
4 56 1 1 1 1 2
5 39 0 1 1 1 0
6 57 1 1 1 1 2
7 28 0 0 0 0 0
9 34 0 1 0 0 0
10 45 0 0 0 0 0
11 48 1 0 0 0 0
14 28 1 1 1 1 2
15 41 1 0 0 0 0
16 26 1 0 1 1 0
18 59 0 1 0 1 0
19 51 0 0 0 0 0
20 49 1 1 0 0 0
21 50 0 0 0 0 0
24 56 1 0 1 0 0
25 51 1 1 1 1 2
26 57 0 1 0 0 0
27 32 1 0 0 0 0
28 33 0 0 0 0 0
29 36 0 0 0 0 0
30 54 1 0 0 0 0
32 41 0 0 0 0 0
33 65 1 0 0 0 0
;
I am running a logistic regression with the dependant variable 'outcome'. As this variable has three ordered levels, this is essentially an ordinal logistic regression. I am also trying to get the classification table using ctable as below:
proc logistic data=have;
class Sex DM IHD Cholesterol Outcome/param=glm;
model Outcome=age Sex DM IHD Cholesterol Outcome/CLPARM=wald ctable;
run;
The attached data is only a small dataset so the estimates are nothing to worry about, but the classification table is not generated and a note is generated:
NOTE: Since there are more than 2 response levels, the following options have no effect --
CTABLE.
Not sure to solve this issue. I would appreciate very much any suggestion on how to obtain the classification table.
Best regards.
If you just want to obtain a predicted by actual classification table (sometimes called a "confusion" matrix), that is discussed in this note. If you want the area under the ROC curve (AUC) as a measure of model performance, a multinomial version of the usual AUC for binary response models is available with the MultAUC macro.
Since CTABLE is dependent on the cutpoint, things get difficult for a multinomial response variable. I suppose you could get the predicted probability for a case to be in each of the levels for a vector of cutpoints, and then present the results, but the post-processing code may not be simple. Perhaps someone out there has written a macro or even a datastep to do this. I think it would need the PREDPROBS= option in the OUTPUT statement, and a variety of cutpoint values for the various levels. You would have to then look at a table of correctly classified/incorrectly classified vs level. Seems that getting out sensitivity and specificity from a 2xK table would be difficult if not impossible as they may not be defined, but at least you would have a table.
SteveDenham
If you just want to obtain a predicted by actual classification table (sometimes called a "confusion" matrix), that is discussed in this note. If you want the area under the ROC curve (AUC) as a measure of model performance, a multinomial version of the usual AUC for binary response models is available with the MultAUC macro.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.