stata imputed data in mlwin

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 >>
Post Reply
Posts: 8
Joined: Wed Mar 15, 2017 4:57 pm

stata imputed data in mlwin

Post by rodrigowu » Wed Mar 15, 2017 5:13 pm

Hi folks,

I met some problem when I used runmlwin with multiply imputed data (done by stata mi command).
My command is like this, a very simple one:
sort commid idind2 wave
mi est, cmdok noi sav(mlw, replace): runmlwin phi cons, level3(commid: cons) level2(idind2: cons) level1(wave) discrete(distribution(binomial) ///
link(logit) denom(cons) mql1) forcesort

but error message showed:
"The data must be sorted according to the order of the model hierarchy: commid idind2 wave.
an error occurred when mi estimate executed runmlwin on m=1
no results will be saved"

I read the post and followed all solutions on it: ... php?t=1030
However, I received another error message:
"mi estimate: omitted terms vary
The set of omitted variables or categories is not consistent between m=1 and
m=2; this is not allowed. To identify varying sets, you can use mi xeq to run
the command on individual imputations or you can reissue the command with mi
estimate, noisily
no results will be saved"

Actually, checking one by one, the numbers of obs. in the equation for m1 and the equation for m2 is the same.
Why I was told "omitted terms vary"? Is it not allowed to use stata-imputed data in Mlwin?
thank you very much!

Posts: 1111
Joined: Mon Oct 19, 2009 10:34 am

Re: stata imputed data in mlwin

Post by ChrisCharlton » Fri Mar 17, 2017 9:57 am

In order to narrow down where this might be happening can you confirm whether the same problem occurs if you use Stata's built-in logit command?

Posts: 8
Joined: Wed Mar 15, 2017 4:57 pm

Re: stata imputed data in mlwin

Post by rodrigowu » Tue Mar 21, 2017 3:46 pm

Hi Chris,

Thank you very much for your reply.
I can confirm that there is no such problem if I use melogit command in Stata. The problem of Stata is the low-efficient maximum likelihood estimation, which can take dozens of days to estimate random slopes. MCMC in MLwin would be faster than ML. I should have used Realcom-imputed data in MLwin, but I have used Stata-imputed data in other models. It seems inappropriate to use different imputed data in one project. That is why I am keen to transfer Stata-imputed data to MLwin.

Site Admin
Posts: 427
Joined: Fri Apr 01, 2011 2:14 pm

Re: stata imputed data in mlwin

Post by GeorgeLeckie » Thu Mar 23, 2017 2:27 pm

Dear Rodrigo,

Suggest you run the mo estimate command with the noisily option and inspect each set of model results.

It may well be the case that one of your variance components gets stuck on zero on one or more iterations.

mi estimate then complains as it assumes that the parameter stuck on zero has been omitted from the model altogether, hence the error message.

However, more generally, I don't think you would want to report the results of a multilevel model where one of the variance components was stuck on zero; the results are not trustworthy. For the same reason, you would not want to include those model results in the set which you aggregate over using Rubin's rules to generate the combined estimates.

Suggest you explore the above and consider simplifying your model if you are getting variance parameters stuck on zero.

Best wishes


Posts: 8
Joined: Wed Mar 15, 2017 4:57 pm

Re: stata imputed data in mlwin

Post by rodrigowu » Thu Mar 23, 2017 6:36 pm

Dear George,

Thank you very much for your help. I will look through these iterations as you suggested.

Best wishes,


Post Reply