Keeping loaded data in mlwin and running several models with runmlwin

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
dorittalia
Posts: 3
Joined: Mon Oct 14, 2019 3:03 pm

Keeping loaded data in mlwin and running several models with runmlwin

Post by dorittalia »

Hi,

I am using runmlwin via Stata to run 4-level random intercept logistic models on a dataset with 811k observations. As such, it takes a few hours for the dataset to load into mlwin before the model runs. I have a null, age sex adjusted, and fully adjusted models I need to run; and then models with subgroups from the main dataset.

Is there a way to code runmlwin so that it only loads the data into mlwin once, and then can run several models on that same worksheet/data? Currently, it runs one model, and then starts to re-load all 811k observations - very inefficient considering how long it takes to load.

Thanks,
Dorit

dorittalia
Posts: 3
Joined: Mon Oct 14, 2019 3:03 pm

Re: Keeping loaded data in mlwin and running several models with runmlwin

Post by dorittalia »

Also this is my current runmlwin code for 2 of the models:

*null

runmlwin utilization cons, ///
level4(state: cons) ///
level3(district: cons) ///
level2(psu: cons) ///
level1(caseid: ) ///
discrete(distribution(binomial) link(logit) denominator(cons) pql2) ///
or nopause


*age and sex adjusted

runmlwin utilization cons i.age_categories i.female, ///
level4(state: cons) ///
level3(district: cons) ///
level2(psu: cons) ///
level1(caseid: ) ///
discrete(distribution(binomial) link(logit) denominator(cons) pql2) ///
or nopause

ChrisCharlton
Posts: 1147
Joined: Mon Oct 19, 2009 10:34 am

Re: Keeping loaded data in mlwin and running several models with runmlwin

Post by ChrisCharlton »

Unfortunately there is no automatic way to do this, although I am surprised at quite how long loading is taking for you. Two possible workarounds would be:
  • Open more than one instance of Stata and run a separate model in each. MLwiN is single-processor so there should be spare CPU capacity for this.
  • Use the viewfullmacro option to see the MLwiN script created by runmlwin and then adapt this to run your models (note that this will mean that your results are not automatically brought back to Stata after the model fit).

Post Reply