BookmarkSubscribeRSS Feed
Fluorite | Level 6



I am running a multinomial logistic regression for categorial unordered data (the outcome variable outcome has c=3 categories) with random effects in proc glimmix.

I was astonished to see that independent of the choice of the reference category the G Matrix always displays the covariance of the first two categories (with different values of course).


proc glimmix data= data.out  method= quad;
class outcome predictor id;
model outcome(ref= first)= predictor/ dist=multinomial link=glogit s  cl corrb covb ;
random predictor /sub=id group=outcome G type=UN gcorr ;     
freq count;

With ref= first, the estimated G Matrix looks like this

  Effect       Group        predictor     Row        Col1        Col2        Col3        Col4

  predictor    outcome 1    0               1      0.5963      0.5751
  predictor    outcome 1    1               2      0.5751      2.1189
  predictor    outcome 2    0               3                              0.4547     -0.3464
  predictor    outcome 2    1               4                             -0.3464      0.4129

  and with ref= last, I get following estimated G Matrix

  Effect       Group        predictor     Row        Col1        Col2        Col3        Col4

  predictor    outcome 1    0               1      0.6290     -0.4144
  predictor    outcome 1    1               2     -0.4144      0.2730
  predictor    outcome 2    0               3                              0.9821      0.7721
  predictor    outcome 2    1               4                              0.7721      1.3127


I would have expected that the G Matrix only contains non-reference categories?

Do you have any clue why this happens ? In the attachment, you find the original data set.


Thanks in advance.


Fluorite | Level 6

The design matrix for the random effects consists of the predictor variable (binary variable) which is extended for the non-reference categories. Thus the G Matrix is a block diagonal matrix with 2 blocks (one for predictor=0 and one for predictor=1) and each block should show the variance/covariance among the non-reference categories. At least that's what I find in 'Applied mixed models in medicine' by Prescott and Brown. Thus, for ref= first (i.e. outcome=1) the G Matrix should only contain outcome=2 and outcome=3 within the blocks and for ref= last (i.e. outcome=3), each block should contain the covariance of the random variable for outcome=1 and outcome=2. 

Could it be that the labels in the G Matrix are wrong? Or is there any other plausible explanation?

Thanks in advance!

Super User

What does SAS show as the design matrix in the output compared to your text or expected matrix? My guess is it doesn't line up. Look at how SAS parametrizes variables in the class statement. 

Fluorite | Level 6

Thanks for the hint!! Indeed, the design matrix for the fixed as well as for the random effects looks completely different than described in Prescott and Brown.

In the SAS/Stat user's guide for proc glimmix, I was not able to find how the design matrix (for fixed and random effects) and consequently also not how the G Matrix are constructed for dist= mult and link=glogit. So I read out the disignmatrix and tried to figure out a pattern, but the only thing I was able to see was that the reference category seems to be always coded like the first non-reference category ....  By the way, the options for 'outdesign' as described in the user manual do not properly work, e.g. nomiss resulted in an error message.  


Do you have any idea where I can find a detailed description on the construction of the design matrix in proc glimmix for the respective distribution?


Thanks in advance!






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
  • 4 replies
  • 2 in conversation