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
Error importing model results from MLwiN
-
- Site Admin
- Posts: 432
- Joined: Fri Apr 01, 2011 2:14 pm
Re: Error importing model results from MLwiN
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
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
Re: Error importing model results from MLwiN
Hi George,
Sorry - I should have posted it before.
1) The runmlwin code is:
2) The screenshot of the MLwiN output is attached.
Best wishes,
Jamie
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
Best wishes,
Jamie
- Attachments
-
- mlwin full model.jpg (126.68 KiB) Viewed 11405 times
-
- Site Admin
- Posts: 432
- Joined: Fri Apr 01, 2011 2:14 pm
Re: Error importing model results from MLwiN
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
* Model 2
* Model 3
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
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
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
Re: Error importing model results from MLwiN
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
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
-
- Site Admin
- Posts: 432
- Joined: Fri Apr 01, 2011 2:14 pm
Re: Error importing model results from MLwiN
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:
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
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
Pint in Bristol sounds good!
George
Re: Error importing model results from MLwiN
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
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
-
- Site Admin
- Posts: 432
- Joined: Fri Apr 01, 2011 2:14 pm
Re: Error importing model results from MLwiN
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
Anyway very glad the problem is cleared up
We will look into improving the error checking to avoid duplicate variable names
Best wishes
George