Issues running 2-level nominal response model
Posted: Fri Jul 03, 2020 10:53 am
Hi,
I am currently trying to use runmlwin to estimate a 2-level nominal response model (on multiply imputed data, 10 imputations, mlong format) in Stata but am running into problems. The model dependent variable is comprised of three, un-ordered categories - voting Labour, voting Conservative or voting for another party. Pano is the variable which indicates clustering and idnew has been created to indicate the ordering of observations within each of these clusters.
The syntax I am currently running is:
gen cons = 1
bysort pano: gen idnew = _n
sort pano idnew
label define gevote20171 1 "Conservative" 2 "Labour" 3 "Other"
label values gevote2017 gevote20171
. global MLwiN_path C:\Program Files\MLwiN v3.04\mlwin.exe
xi: mi estimate, cmdok noisily: runmlwin gevote2017 cons i.ed3cat gender ethnicity parentclass i.polinterest i.age country i.socialclass i.hhincome i.ordinarypeople i.immigrationecon immigrantnumber i.justice i.tradvalues i.nationalid i.news i.populism i.likemay i.likecorbyn i.likefarron i.likelucas i.keyissue, level2(pano: cons) level1(idnew: ) discrete(distribution(multinomial) link(mlogit) denominator(cons) basecategory(1)) nopause
This leads to the following error message being reported:
'The data must be sorted according to the order of the model hierarchy: pano idnew idnew. An error occurred when mi estimate executed runmlwin on m=1'.
When I go into the data viewer to check the structure of my data it appears to be structured appropriately by pano and then idnew, within pano. I'm not sure why the error message is suggesting three layers of sorting are needed, but suspect this may be related to the way I have specified the cons variable.
Apologies if I have not provided some important information - I am new to the forum so not sure exactly what is needed.
Any help in working out why I am running into this error/getting this model to run would be much appreciated.
Best wishes,
Lizzie
I am currently trying to use runmlwin to estimate a 2-level nominal response model (on multiply imputed data, 10 imputations, mlong format) in Stata but am running into problems. The model dependent variable is comprised of three, un-ordered categories - voting Labour, voting Conservative or voting for another party. Pano is the variable which indicates clustering and idnew has been created to indicate the ordering of observations within each of these clusters.
The syntax I am currently running is:
gen cons = 1
bysort pano: gen idnew = _n
sort pano idnew
label define gevote20171 1 "Conservative" 2 "Labour" 3 "Other"
label values gevote2017 gevote20171
. global MLwiN_path C:\Program Files\MLwiN v3.04\mlwin.exe
xi: mi estimate, cmdok noisily: runmlwin gevote2017 cons i.ed3cat gender ethnicity parentclass i.polinterest i.age country i.socialclass i.hhincome i.ordinarypeople i.immigrationecon immigrantnumber i.justice i.tradvalues i.nationalid i.news i.populism i.likemay i.likecorbyn i.likefarron i.likelucas i.keyissue, level2(pano: cons) level1(idnew: ) discrete(distribution(multinomial) link(mlogit) denominator(cons) basecategory(1)) nopause
This leads to the following error message being reported:
'The data must be sorted according to the order of the model hierarchy: pano idnew idnew. An error occurred when mi estimate executed runmlwin on m=1'.
When I go into the data viewer to check the structure of my data it appears to be structured appropriately by pano and then idnew, within pano. I'm not sure why the error message is suggesting three layers of sorting are needed, but suspect this may be related to the way I have specified the cons variable.
Apologies if I have not provided some important information - I am new to the forum so not sure exactly what is needed.
Any help in working out why I am running into this error/getting this model to run would be much appreciated.
Best wishes,
Lizzie