Error importing model results from 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 >> http://www.bristol.ac.uk/cmm/software/runmlwin/
Post Reply
Jamoo
Posts: 36
Joined: Wed Oct 05, 2011 2:33 pm

Error importing model results from MLwiN

Post by Jamoo »

Hi,

I have a model which runs fine in MLwiN but then does not import back into Stata. The specific error (displayed in Stata) is as follows:

runmlwin has encountered an error importing the model results from MLwiN. Check that the model has run properly in MLwiN.

I've checked MLwiN and the model seems to fit fine (all the estimates turn green for example), and when I step through the macro, no error messages are displayed.

I am not sure where to start with sorting this out, so any guidance would be appreciated.

Thanks

Jamie
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: Error importing model results from MLwiN

Post by GeorgeLeckie »

Hi Jamie,

Can you post the following on the forum so that we can see what might be the problem?

(1) Paste the runmlwin syntax;

(2) Paste a screen shot of the MLwiN Equations window for the converged model.

Best wishes

George
Jamoo
Posts: 36
Joined: Wed Oct 05, 2011 2:33 pm

Re: Error importing model results from MLwiN

Post by Jamoo »

Hi George,

Sorry - I should have posted it before.

1) The runmlwin code is:

Code: Select all

runmlwin deltabmi cons gmcbmi1c sqgmcbmi1c gmcage1 gmcboy gmcbmi1cXgmcboy black asian other ///
		gmcsocial gmcprivate gmcunemployed gmcsinglepar gmcidaci07 gmcvillages gmctowns gmcbuilt ///
		gmcnprogperpm gmcnperprog gmcpcsessions proggmcsdbmi1c proggmcsdbmi1c if bmichangesample==1, ///
		level2(numprogid: cons, residuals(u)) level1(pid: cons) nopause   
2) The screenshot of the MLwiN output is attached.

Best wishes,

Jamie
Attachments
mlwin full model.jpg
mlwin full model.jpg (126.68 KiB) Viewed 9812 times
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: Error importing model results from MLwiN

Post by GeorgeLeckie »

Hi Jamie,

The model looks standard enough and I can see no obvious problems in the MLwiN Equations Window screen shot.

Looking at your syntax, I suspect that the problem lies with either

if bmichangesample==1

or the

, residuals(u)

part of your command.


To see whether this is the case, which if any of the following three models work for you?


* Model 1

Code: Select all

runmlwin deltabmi cons gmcbmi1c sqgmcbmi1c gmcage1 gmcboy gmcbmi1cXgmcboy black asian other ///
gmcsocial gmcprivate gmcunemployed gmcsinglepar gmcidaci07 gmcvillages gmctowns gmcbuilt ///
gmcnprogperpm gmcnperprog gmcpcsessions proggmcsdbmi1c proggmcsdbmi1c if bmichangesample==1, ///
level2(numprogid: cons) level1(pid: cons) nopause 
* Model 2

Code: Select all

keep if bmichangesample==1
runmlwin deltabmi cons gmcbmi1c sqgmcbmi1c gmcage1 gmcboy gmcbmi1cXgmcboy black asian other ///
gmcsocial gmcprivate gmcunemployed gmcsinglepar gmcidaci07 gmcvillages gmctowns gmcbuilt ///
gmcnprogperpm gmcnperprog gmcpcsessions proggmcsdbmi1c proggmcsdbmi1c, ///
level2(numprogid: cons, residuals(u)) level1(pid: cons) nopause 
* Model 3

Code: Select all

keep if bmichangesample==1
runmlwin deltabmi cons gmcbmi1c sqgmcbmi1c gmcage1 gmcboy gmcbmi1cXgmcboy black asian other ///
gmcsocial gmcprivate gmcunemployed gmcsinglepar gmcidaci07 gmcvillages gmctowns gmcbuilt ///
gmcnprogperpm gmcnperprog gmcpcsessions proggmcsdbmi1c proggmcsdbmi1c, ///
level2(numprogid: cons) level1(pid: cons) nopause
Jamoo
Posts: 36
Joined: Wed Oct 05, 2011 2:33 pm

Re: Error importing model results from MLwiN

Post by Jamoo »

Hi George,

Thanks for taking a look at this. All three scenarios gave the same error as before.

Best wishes and thanks for your time, next time I'm in Bristol (that's right isn't it?) I'll buy you a pint.

Jamie
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: Error importing model results from MLwiN

Post by GeorgeLeckie »

Hi Jamie,

If even Model 3 gave the same error message then try running the following commands to see whether the issue is to do with the IDs:

Code: Select all

* Model 4
keep if bmichangesample==1
egen templev2id = group(numprogid)
sort templev2id
gen templev1id = _n

runmlwin deltabmi cons gmcbmi1c sqgmcbmi1c gmcage1 gmcboy gmcbmi1cXgmcboy black asian other ///
gmcsocial gmcprivate gmcunemployed gmcsinglepar gmcidaci07 gmcvillages gmctowns gmcbuilt ///
gmcnprogperpm gmcnperprog gmcpcsessions proggmcsdbmi1c proggmcsdbmi1c, ///
level2(templev2id : cons) level1(templev1id : cons) nopause
If even this model gives the same error then please email me the data and dofile and we will have a look behind the scenes to see what might be the problem.

Pint in Bristol sounds good!

George
Jamoo
Posts: 36
Joined: Wed Oct 05, 2011 2:33 pm

Re: Error importing model results from MLwiN

Post by Jamoo »

Hi,

On running your code, I discovered what the error was. I managed to repeat the same variable twice "proggmcsdbmi1c". Serves me right for having incomprehensible variable names.

runmlwin deltabmi cons gmcbmi1c sqgmcbmi1c gmcage1 gmcboy gmcbmi1cXgmcboy black asian other ///
gmcsocial gmcprivate gmcunemployed gmcsinglepar gmcidaci07 gmcvillages gmctowns gmcbuilt ///
gmcnprogperpm gmcnperprog gmcpcsessions proggmcsdbmi1c proggmcsdbmi1c, ///
level2(templev2id : cons) level1(templev1id : cons) nopause

Thanks again for all your help though, pint offer still stands of course.

Jamie
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: Error importing model results from MLwiN

Post by GeorgeLeckie »

Oh dear, I should have spotted that as well!

Anyway very glad the problem is cleared up

We will look into improving the error checking to avoid duplicate variable names

Best wishes

George
Post Reply