Error message running any model with updated mlwin using runmlwin STATA 13

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
ginamartin
Posts: 7
Joined: Thu Nov 03, 2016 12:06 pm

Error message running any model with updated mlwin using runmlwin STATA 13

Post by ginamartin »

Hello,

I have just updated my version of mlwin and ran the adoupdate which appeared to work fine. Now when I try to run even the simplest model(see below) I get an error message ("variable cons not found"). Any help with this would be much appreciated!

Thank you,
Gina

runmlwin coping cons, ///
level2(IntZone: cons ) ///
level1(SEQNO: cons ) nopause)

. . adoupdate runmlwin
(note: adoupdate updates user-written files; type -update- to check for updates to official
Stata)

Checking status of specified packages...

[5] runmlwin at http://fmwww.bc.edu/repec/bocode/r:
installed package is up to date

(no packages require updating)

. runmlwin coping cons, ///
> level2(IntZone: cons ) ///
> level1(SEQNO: cons ) nopause

variable cons not found
ChrisCharlton
Posts: 1384
Joined: Mon Oct 19, 2009 10:34 am

Re: Error message running any model with updated mlwin using runmlwin STATA 13

Post by ChrisCharlton »

Can you confirm that you definitely do have a variable defined in your open data file called cons? If so, could you let us know what the names are of the other variables in the data, in case there is some conflict. It might also be worth trying some of the -runmlwin- examples available via help runmlwin to see whether the problem also occurs there.
ginamartin
Posts: 7
Joined: Thu Nov 03, 2016 12:06 pm

Re: Error message running any model with updated mlwin using runmlwin STATA 13

Post by ginamartin »

Thank you Chris. I am new to runmlwin. I ran the help tutorial Two-level random-intercept model, analogous to xtreg (fitted using IGLS) which works fine. I created a variable cons =1 and now no longer get that message. I do get the error message:
The data must be sorted according to the order of the model hierarchy: IntZone SEQNO.

The variables in my data set are (in this order) IntZone, SEQNO, AGE,AGECAT,coping, cons. I sorted both the IntZone and SEQNO ascending but still get the error message. My data appears to be organised in the same fashion as the tutorial data.

Thank you,
Gina
ChrisCharlton
Posts: 1384
Joined: Mon Oct 19, 2009 10:34 am

Re: Error message running any model with updated mlwin using runmlwin STATA 13

Post by ChrisCharlton »

MLwiN requires that the data is sorted according to the level hierarchy, i.e.

Code: Select all

school student
1      1
1      2
1      3
1      4
2      1
2      2
2      3
2      4
3      1
3      2
3      3
3      4
This is because MLwiN uses a change in the ID to signify a new higher level unit rather than the codes themselves. -runmlwin- can sort the data for you with the forcesort option, however it is generally advisable for you to do this yourself prior to calling the command so that you can be sure that the data is as you expect. If you sorted your variables separately then it is possible that they do not match the form above, as the level-1 IDs need to be sorted within the level-2 IDs.
ginamartin
Posts: 7
Joined: Thu Nov 03, 2016 12:06 pm

Re: Error message running any model with updated mlwin using runmlwin STATA 13

Post by ginamartin »

Thank you Chris! It is working now.

Gina
Post Reply