runmlwin causing MLwiN to load all observations

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
anoopjain
Posts: 4
Joined: Thu Apr 16, 2020 3:25 pm

runmlwin causing MLwiN to load all observations

Post by anoopjain »

Hi There - I am trying to run a 5-level model in which individuals are nested in households, villages, districts, and states in India. However, when I execute my runmlwin code in Stata, it opens MLwiN and the MLwiN begins to read in all the data file observations as though I am loading a new sheet directly in to MLwiN. This does not happen when I run a 4-level model without the individuals. Any thoughts on why this might be occurring? My code is below. Thanks!

*4-LEVEL CODE (works fine)
xi: runmlwin santype1 constant,level4(hv024: constant, residuals(res_state)) level3(shdist: constant, residuals(res_dist)) level2(hv001: constant, residuals(res_clust)) ///
level1(case:, ) discrete(distribution(binomial) link(logit) denominator(constant)) mlwinsettings(optimat)nopause
xi: runmlwin santype1 constant,level4(hv024: constant, residuals(res_state1)) level3(shdist: constant, residuals(res_dist1)) level2(hv001: constant, residuals(res_clust1)) ///
level1(case:, ) discrete(distribution(binomial) link(logit) denominator(constant)) mlwinsettings(optimat) mcmc(on) initsprevious nopause
ge beta0 = _b[constant]

*5-LEVEL CODE (not working)
xi: runmlwin santype1 constant,level5(hv024: constant, residuals(res_state)) level4(NFHS5_Code: constant, residuals(res_dist)) level3(hv001: constant, residuals(res_clust)) ///
level2(case: constant, residuals(res_case)) level1(id:, ) discrete(distribution(binomial) link(logit) denominator(constant)) mlwinsettings(optimat)nopause
xi: runmlwin santype1 constant,level5(hv024: constant, residuals(res_state1)) level4(NFHS5_Code: constant, residuals(res_dist1)) level3(hv001: constant, residuals(res_clust1)) ///
level2(case: constant, residuals(res_case1)) level1(id:, ) discrete(distribution(binomial) link(logit) denominator(constant)) mlwinsettings(optimat) mcmc(on) initsprevious nopause
ge beta0 = _b[constant]
ChrisCharlton
Posts: 1348
Joined: Mon Oct 19, 2009 10:34 am

Re: runmlwin causing MLwiN to load all observations

Post by ChrisCharlton »

Would you be able to elaborate on the error that this is causing? The data should be loaded into MLwiN in both cases, however it may be that the data for the 5 level model is large enough that MLwiN has time to report the loading progress. Does the model fail to estimate, or are there problems when returning the results to Stata?
anoopjain
Posts: 4
Joined: Thu Apr 16, 2020 3:25 pm

Re: runmlwin causing MLwiN to load all observations

Post by anoopjain »

Hi Chris,

Thanks for the note. It's the same dataset for both the 4L and 5L models. However, for the 5L model, I get the red loading numbers on the bottom left of the screen. This isn't a problem save for the fact that it is taking >20 hours to load. It's confusing because MLwiN seems to be skipping this step with the 4L models! So to be clear, no "error" message. It's just the loading step is skipped in one set of models, but included in the other.
ChrisCharlton
Posts: 1348
Joined: Mon Oct 19, 2009 10:34 am

Re: runmlwin causing MLwiN to load all observations

Post by ChrisCharlton »

The loading procedure should be the same for both models, I think that you just don't see the loading message on the four level model because the data finishes loading before the message is displayed. The question is therefore why the data takes so much longer to load for the five level model. My suggestion would be to look at characteristics of the variables and level identifiers that are included in the five level, but not the four level model. MLwiN stores all of its data as numeric variables so if for example the level-5 identifier was a string variable in Stata then this would have to be converted into a numeric variable with string labels when it is loaded which can take a long time.
anoopjain
Posts: 4
Joined: Thu Apr 16, 2020 3:25 pm

Re: runmlwin causing MLwiN to load all observations

Post by anoopjain »

Hi Chris - Thanks so much for the note. You were spot on. I accidentally left the level 1 variable as a string, which caused the issue. I re-cleaned the data with that variable as a numeric and now the issue has been resolved. Thank you so much for your prompt help!
grippingfossil
Posts: 9
Joined: Fri Jan 13, 2023 2:58 am

Re: runmlwin causing MLwiN to load all observations

Post by grippingfossil »

ChrisCharlton wrote: Mon Oct 17, 2022 7:08 pm Would you be able to elaborate on the error that this is causing? The data should be loaded into MLwiN in both cases doodle cricket
however it may be that the data for the 5 level model is large enough that MLwiN has time to report the loading progress. Does the model fail to estimate, or are there problems when returning the results to Stata?
Many thanks for that's note. The problem arose because I unintentionally left the level 1 variable set to a string. The problem has been fixed as a result of my re-cleaning of the data with that variable as a numeric.
Post Reply