BookmarkSubscribeRSS Feed
Andrea_Peng
Obsidian | Level 7

Hi, 

I am trying to use proc logit to predict a multinomial variable (polyshaptria) with 3 levels (1,2,3). The code is as follow:

 

proc logistic data=triathlon_pct;
class polyshaptria;
model polyshaptria =pctPoly_bysurg age sex/ link=glogit;  
output out=pred predicted=pred;   
run;
quit;

 

As polyshaptria has 3 level, I assume the predicted probability will distributed consistently with each level (sas will give three predicted probability for each polyshaptria level). That is if the polyshaptria is 1, SAS gives three probability for it corresponding to level 1,2,3. However, the predicted probability of level 1 is always larger than the other two levels. It doesn't make sense. See the data below:

polyshaptria_LEVEL_pred_prob
110.40541
120.37396
130.22063
110.39646
120.36705
130.23648
210.45166
220.44938
230.09896

 

 

For polyshaptria=2, pred_prob should get the largest when _level_=2. But it's still largest when _level_=1.

 

Can anyone explain the reasons? How SAS predicted multinomial logistic model?

 

Thanks,

Andrea

3 REPLIES 3
Rick_SAS
SAS Super FREQ

For polyshaptria=2, pred_prob should get the largest when _level_=2. But it's still largest when _level_=1.

 

No, that is not correct. Just because the observed value is 2 does not mean that the predicted value will be 2. The predicted value is based on the values of the explanatory variables. Some observations will be inevitably be misclassified 

 

I suggest you change from the PREDICTED= option to the PREDPROBS=(INDIVIDUAL_ option. That will create an output data set that is the same size as the input data. The variables _FROM_ and _INTO_ in the output data set show the observed and predicted categories for each observation, You can use PROC FREQ to display a misclassification table, as follows:

 

proc logistic data=sashelp.cars;
class origin;
model origin = mpg_city weight / link=glogit;  
output out=pred predprobs=(individual);   
run;
quit;

proc freq data=pred;
tables _FROM_*_INTO_;
run;
Andrea_Peng
Obsidian | Level 7

Hi Rick,

 

Thanks!

 

I did have a look at the misclassification. The proportion is huge (around 50%). That's the reason I want to know how proc logistic works when predicting using glogit.

 

Rick_SAS
SAS Super FREQ

Just look at the documentation, which has all the details in the "Details" Chapter. You might start with these two sections:
The generalized logit model

Link functions

 

Wikipedia also has a nice overview article on multinomial logistic regression.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
What is ANOVA?

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.

Discussion stats
  • 3 replies
  • 2152 views
  • 0 likes
  • 2 in conversation