multilevel multinomial regression with 2 repeated measures

Welcome to the forum for runmlwin users. Feel free to post your question about runmlwin here. The Centre for Multilevel Modelling take no responsibility for the accuracy of these posts, we are unable to monitor them closely. Do go ahead and post your question and thank you in advance if you find the time to post any answers!

Go to runmlwin: Running MLwiN from within Stata >> http://www.bristol.ac.uk/cmm/software/runmlwin/
Post Reply
Iedema2012
Posts: 3
Joined: Tue Jul 10, 2012 9:37 am

multilevel multinomial regression with 2 repeated measures

Post by Iedema2012 »

Hi George,

How can we analyse responses in a two repeated measures design: scenario (3) X seriousness (3) nested within individuals (id)? The dependent variable is nominal with values 1, 2 and 3 (value 3 is answered scarcely and could perhaps be added to 2 in which case it could be done with a logistic regression). We were thinking of a multilevel multinomial regression with 2 repeated measures. We would like to know the effect of scenario, seriousness and their interaction.

In examples a repeated measure is usually specified as the first level nested within the second level of individuals. But here we have 2 repeated measures, 3 X 3, resulting in 9 within subjects measurements (see variable sequence below). The data look like this:

id sequence scenario seriousness response
1 1 1 1 3
1 2 1 2 2
1 3 1 3 2
1 4 2 1 1
1 5 2 2 2
1 6 2 3 1
1 7 3 1 2
1 8 3 2 2
1 9 3 3 1
2 1 1 1 2

Perhaps it seems as if we would like to analyse the repeated measures as random effects, but actually we prefer fixed effects because of the easier interpretation.
Do you know how to specify this model in runmlwin or in Stata (with gllamm)?
Thanks in advance!

Best wishes,
Jurjen

The Netherlands Institute for Social Research / SCP
The Hague The Netherlands
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: multilevel multinomial regression with 2 repeated measur

Post by GeorgeLeckie »

Hi Jurjen,

You want a two-level random intercept model where id are your level-1 units and idsequence are your level-2 units.
Enter scenario and seriousness as covariates

Yes, I would start by fitting the model as a logistic multilevel model in which case you can use the -xtemelogit- command unless it proves very slow. Once you are happy with that you could consider moving on to multinomial model using -runmlwin- or -gllamm-. Of course, you would first want to replicate the -xtmelogit- results unsing -runmlwin- or -gllamm- as a check to yourself that you know how to use these more advanced commands.

See each command's help file for examples of how to specify two-level logistic regression models.

Best wishes

George
Iedema2012
Posts: 3
Joined: Tue Jul 10, 2012 9:37 am

Re: multilevel multinomial regression with 2 repeated measur

Post by Iedema2012 »

Hi George,

Thanks a lot for the quick answer. However, I think I didn't make my problem clear enough. In your answer you mention a variable idsequence which is not in the example I gave. I mentioned the variables id and sequence. I think you meant sequence instead of idsequence. Then your answer would have red:
"You want a two-level random intercept model where id are your level-1 units and sequence are your level-2 units."
However, I don't quite understand this as each respondent (id) answered nine questions (sequence), so the only necessary correction for nesting is to nest the nine answers within respondent (id). There are no different sequences, each respondent answered the nine questions in one sequence. Nevertheless I gave the proposed model a try, initially with Stata's xtmelogit:

Code: Select all

* Code with Stata's xtmelogit (the higher level on the left, the lower level on the right).
recode response (2 3=0) (1=1) , into(response2)
xtmelogit response2 _Isce_1 _Isce_2 _Iser_1 _Iser_2 _Isc1Xse1 _Isc1Xse2 _Isc2Xse1 _Isc2Xse2 || sequence: || id:
This model would not converge (a lot of "flat or discontinuous region encountered" messages). Next I tried it with sequence nested within id (which seems to make a little more sense).
xtmelogit response2 _Isce_1 _Isce_2 _Iser_1 _Iser_2 _Isc1Xse1 _Isc1Xse2 _Isc2Xse1 _Isc2Xse2 || id: || sequence:

This model was very slow. The results showed a random-effect parameter for sequence of zero.
All other coefficients were exactly as the simpler model without sequence:

Code: Select all

xtmelogit response2 _Isce_1 _Isce_2 _Iser_1 _Iser_2 _Isc1Xse1 _Isc1Xse2 _Isc2Xse1 _Isc2Xse2 || id:
In conclusion, sequence seems not necessary as a separate level. I tried the multinomial variant of the model in runmlwin and in gllamm:

The model in runmlwin:

Code: Select all

gen cons=1
sort id level
gen resp=_n
runmlwin hulp cons _Isce_1 _Isce_2 _Iser_1 _Iser_2 _Isc1Xse1 _Isc1Xse2 _Isc2Xse1 _Isc2Xse2 ///
	, level2(id: cons) level1(resp2) ///
	discrete(distribution(multinomial) link(mlogit) denominator(cons) basecategory(3)) maxiterations(50) nopause
* With mcmc : more reliable results.
runmlwin hulp cons _Isce_1 _Isce_2 _Iser_1 _Iser_2 _Isc1Xse1 _Isc1Xse2 _Isc2Xse1 _Isc2Xse2 ///
	, level2(id: cons) level1(resp2) ///
	discrete(distribution(multinomial) link(mlogit) denominator(cons) basecategory(3)) ///
	mcmc(on) initsprevious nopause
The model in gllamm:

Code: Select all

gllamm response _Isce_1 _Isce_2 _Iser_1 _Iser_2 _Isc1Xse1 _Isc1Xse2 _Isc2Xse1 _Isc2Xse2  ///
      , i(id) fam(binom) link(mlogit) nip(12) adapt basecategory(3)
George, do you agree that the only correction necessary here is for nesting the nine answers within id?

Best wishes,
Jurjen
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: multilevel multinomial regression with 2 repeated measur

Post by GeorgeLeckie »

Yes sorry, my mistake. I did indeed mean sequence at level-1 nested within individuals at level-2!
So yest, the final runmlwin syntax you propose looks sensible given your data.
Best wishes
George
Iedema2012
Posts: 3
Joined: Tue Jul 10, 2012 9:37 am

Re: multilevel multinomial regression with 2 repeated measur

Post by Iedema2012 »

Hi George,

Thank you very much for your help.
You provide amazing service with the runmlwin project and this great forum.

Best wishes,
Jurjen
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: multilevel multinomial regression with 2 repeated measur

Post by GeorgeLeckie »

Thanks Jurjen for your kind comments
Good luck with your multilevel modelling
George
Post Reply