# GLLAMM help please? 3-level, random coefficient at level 3

#### Jamie Lorenz

##### New Member
Dear Talk Stats,

I have a question regarding the use of gllamm for multi-level modelling of ordinal variables in STATA.

A brief description of my data and aim.

I have individuals nested in schools nested in cities i.e. 3-levels. My dependent variable is 4-options from 1 to 4 on levels of satisfaction i.e. it is ordinal. My key independent variables are: individual (level-1) disadvantage; level of school (level-2) disadvantage; and level of city (level-3) disadvantage.

My main aim is to test whether the effect of school disadvantage on individual's satisfaction is dependent on/moderated by the level of disadvantage in a city in which the school is "nested" i.e. whether there is an interaction effect between school (level-2) disadvantage AND city (level-3) disadvantage, after controlling for individual-level (level 1) disadvantage. So I want to include a level-2 * level-3 interaction in the model.

Crucially, my outcome is ordinal so, as far as I have been able to tell from reading, I have to use gllamm along with the link(ologit) function.

So, I believe I need to use a random-coefficient model where the effect of "school disadvantage" (at level 2) is allowed to have different coefficients at (level 3).

So, here is the syntax I was thinking of using, where school(lvl2)disad*city(lvl3)disad is the level2 * level3 interaction term.

generate cons = 1
eq inter: cons

Does this look right? In particular:

- I've had trouble working out the nrf() values. I used nrf(1 2) as I am specifying one random-effect at level-2 (i.e. a random-intercept for school_lvl2) AND two random-effects at level-2 (i.e. a random-intercept and -coefficient for city_lvl3)

- Is the eqs() option specified correctly. I used eqs(inter inter slope) because of random-intercept at level-2 and random-intercept and random-coefficient at level-3

All advice would be hugely appreciated.