## Cross-level interaction specification in multilevel logit

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/
Markov9chain
Posts: 2
Joined: Sat Dec 15, 2018 1:09 pm

### Cross-level interaction specification in multilevel logit

Hello,
I have a rather stupid doubt that I could not solve on my own and I hope you could help me.
By reading the provided guides on multilevel modeling for binary responses I understood that the standard command for a multilevel model with random slope and random intercept would be:

Code: Select all

`````` runmlwin y cons X_1 X_2 z_3, level2(country: cons X_1) ///
level1(id:) ///
however it is not yet clear to me what the following variation means in terms of equation:

Code: Select all

``````  runmlwin y cons X_1 X_2 , level2(country: cons z_3) ///
level1(id:) ///
Where z_3 is a contextual effect, say GDP and level 1 IDs are individuals. I could find that it is not a random slope model but it just models the heteroskedasticity, do you have any references for this kind of commands?
Finally, in the case of a cross-level interaction am I obliged to insert the main effect of z_3? would the following model have a random slope?

Code: Select all

``````  runmlwin y cons X_1 X_2 X_1*z_3, level2(country: cons X_1 ) ///
level1(id:) ///
Thank you for any suggestion you could provide.

GeorgeLeckie
Posts: 423
Joined: Fri Apr 01, 2011 2:14 pm

### Re: Cross-level interaction specification in multilevel logit

Hi,

Yes, your first code and interpretation is correct.

In your second code you should include the fixed effect of z3. Including z3 in the random part of the model allows the between-country variance to be a function of country characteristics z3. A heteroskedastic relationship. There is no random slope interpretation here. See Chapter 7 of the MLwiN User Manual (especially Section 7.2).

In you third code, yes you need to include the main effect of z3 in the fixed part of the model.

Best wishes

George

Markov9chain
Posts: 2
Joined: Sat Dec 15, 2018 1:09 pm

### Re: Cross-level interaction specification in multilevel logit

Dear George,

I am sorry for going OT, but I have a further problem with the option simulate after the following command:

Code: Select all

``````     runmlwin Y cons (X1 X2 …. Xn, contrast(1/2)) , ///
level2(country: (cons, contrast(1/2)) ) ///
level1(id:) ///
discrete(distribution(multinomial) link(ologit) denominator(cons) basecategory(3)) nopause simulate(yhat) ///
mcmc(orthogonal b(10000) c(30000) t(1))initsprevious
``````
merge: after merge, not all observations matched
(merged result left in memory)
r(9);

I don't know whether I can reproduce the error in a sample dataset.

the variable y_hat is produced for the exact double of the original observations. I guess its because I am using a multinomial model, not sure why though. I would need this prediction for computing the R-squared (Snijders and Bosker (2011) pag 311) but I do not think I can trust its variance, can I? Do you know any strategy for solving this error?

Thank you for your time and the incredible job you did with Mlwin.