Page 1 of 1

Keeping loaded data in mlwin and running several models with runmlwin

Posted: Tue Mar 17, 2020 12:05 am
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

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

Posted: Tue Mar 17, 2020 12:09 am
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

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

Posted: Tue Mar 17, 2020 10:12 am
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).