Solved
Contributor
Posts: 24

# Multilevel model for 3x2 contingency table

Hello,

how can I efficiently model multilevel models for discrete proportions that result from a 3x2 contingency table? The hierarchical structure does not result from longitudinal data but from different study centers; the random effects should be allowed to have an unstructured correlation matrix. I'm not interested in the main effects, so I just need the interaction of both factors.

I tried proc glimmix with a poisson distribution but that approach failed to converge:

proc glimmix data= data method= quad;
class  a b center;
model count= a*b / d= poisson ddfm=none;  /* count is the count per cell, a (3 categories) and b (2 categories) are the factors*/
random a*b / sub= center g type=un ;
run;

Thanks for any hints!

M

Accepted Solutions
Solution
‎08-15-2016 11:52 AM
Posts: 2,655

## Re: Multilevel model for 3x2 contingency table

For a 3x2 table, consider a multinomial distribution. A good start might be Example 45.13 Response Surface Comparisons with Multiplicty Adjustments in the SAS/STAT14.1 documentation.  The second part looks at a cumulative logit.  My thought is to consider the factor with 3 levels as the response variable, and the 2 level factor as an independent variable.  The example shows how to code for a random center effect.  I really wouldn't try to put a structure on that.  Try:

``````proc glimmix data= data method= quad;
class  a b center;
model a= b / d=multinomial link=cumlogit ddfm=none;
random intercept / sub= center g ;
run``````

Probably have to drag odds ratios into this for comparisons.  See how this works, and come back with what you find.

Steve Denham

All Replies
Frequent Contributor
Posts: 98

## Re: Multilevel model for 3x2 contingency table

You should be careful including only an interaction term, without the main effects, in any model. While it's not invalid to do so, the interpretation may not be exactly what you expect, especially in a non-randomized setting.

In any case, without seeing what your data look like, or exactly what sort of errors GLIMMIX gave you, it's hard to give a lot of specific advice. For me, I would try fitting the model in PROC NLMIXED or PROC MCMC. I find it is easier to diagnose convergence or other performance issues in mixed models under those frameworks, and forcing you to actually write out the likelihood function is a good way of making you think about whether or not you are fitting the model you think you are.

Solution
‎08-15-2016 11:52 AM
Posts: 2,655

## Re: Multilevel model for 3x2 contingency table

For a 3x2 table, consider a multinomial distribution. A good start might be Example 45.13 Response Surface Comparisons with Multiplicty Adjustments in the SAS/STAT14.1 documentation.  The second part looks at a cumulative logit.  My thought is to consider the factor with 3 levels as the response variable, and the 2 level factor as an independent variable.  The example shows how to code for a random center effect.  I really wouldn't try to put a structure on that.  Try:

``````proc glimmix data= data method= quad;
class  a b center;
model a= b / d=multinomial link=cumlogit ddfm=none;
random intercept / sub= center g ;
run``````

Probably have to drag odds ratios into this for comparisons.  See how this works, and come back with what you find.

Steve Denham

☑ This topic is solved.