3 level multilevel data, multiple imputation, stata, runmlwi
3 level multilevel data, multiple imputation, stata, runmlwi
Hi.
I am planning to use runmlwin from stata to analyse my longitudinal data ( multilevel 3 levels ), However, I have some missing values ( in my response and predictors). Does anyone know if I can use multiple imputation in Stata on my 3 level multilevel data and then use runmlwin?
Many many thanks!
Zahra
I am planning to use runmlwin from stata to analyse my longitudinal data ( multilevel 3 levels ), However, I have some missing values ( in my response and predictors). Does anyone know if I can use multiple imputation in Stata on my 3 level multilevel data and then use runmlwin?
Many many thanks!
Zahra

 Site Admin
 Posts: 432
 Joined: Fri Apr 01, 2011 2:14 pm
Re: 3 level multilevel data, multiple imputation, stata, run
Hello Zahra,
I don't think you can do multilevel multiple imputation in Stata. You can do singlelevel multiple imputation in Stata to create the multiple datasets (see mi manual). Alternatively, you could take a look at the free standalone REALCOM software which is also callable from within Stata as a means of generating multilevel multiple imputed datasets.
Once you have created your multiple datasets, you can then use the runmlwin command with the mi combine prefix to combine your results using Rubin's Rules in the usual way.
Best wishes
George
I don't think you can do multilevel multiple imputation in Stata. You can do singlelevel multiple imputation in Stata to create the multiple datasets (see mi manual). Alternatively, you could take a look at the free standalone REALCOM software which is also callable from within Stata as a means of generating multilevel multiple imputed datasets.
Once you have created your multiple datasets, you can then use the runmlwin command with the mi combine prefix to combine your results using Rubin's Rules in the usual way.
Best wishes
George
Re: 3 level multilevel data, multiple imputation, stata, run
Hi George,
Thank you for your reply.
I have a repeated measure data and have been reading this page http://www.stata.com/support/faqs/stati ... miimpute/
It seems that strategy number 3 is suitable for my data:
Use a multivariate normal model to impute all clusters simultaneously
the only thing is that it says at the end of the article that these strategies assume data are in 2 levels that is why I was wondering if I can use the same strategy for my 3 level data.
Do you have any advice?
Much appreciated,
Many thanks
zahra
Zahra
Thank you for your reply.
I have a repeated measure data and have been reading this page http://www.stata.com/support/faqs/stati ... miimpute/
It seems that strategy number 3 is suitable for my data:
Use a multivariate normal model to impute all clusters simultaneously
the only thing is that it says at the end of the article that these strategies assume data are in 2 levels that is why I was wondering if I can use the same strategy for my 3 level data.
Do you have any advice?
Much appreciated,
Many thanks
zahra
Zahra

 Site Admin
 Posts: 432
 Joined: Fri Apr 01, 2011 2:14 pm
Re: 3 level multilevel data, multiple imputation, stata, run
Yes, in principle
If you have, for example, two level1 measurements per level2 cluster and two level2 clusters per level3 supercluster, you could reshape your data from long form (one record per level1 unit) to wide form (one record per level2 cluster) and then reshape to wide form a second time (one record per level3 supercluster). Once you have imputed your data you would then reshape back to the original long form and fit your model of interest.
Clearly this approach won't work well if you have many units per cluster and imbalance
Best wishes
George
If you have, for example, two level1 measurements per level2 cluster and two level2 clusters per level3 supercluster, you could reshape your data from long form (one record per level1 unit) to wide form (one record per level2 cluster) and then reshape to wide form a second time (one record per level3 supercluster). Once you have imputed your data you would then reshape back to the original long form and fit your model of interest.
Clearly this approach won't work well if you have many units per cluster and imbalance
Best wishes
George
Re: 3 level multilevel data, multiple imputation, stata, run
Hi George
Many thanks for your answer,
I am very confused,
What is the best way to perform multiple imputation on a 3 level multilevel data so that I can analyse the imputed sets and fit models in mlwin?
I would have loved to use realcom but that only works for structure up to two levels ( I have 3)
I wanted to use mlwin macros but I read they only work if my missing values are at level 1 only, is that true? ( I have some level 2 predictors which are missing as well as level 1 predictors and response variables).
I was thinking of doing the multiple imputation in stata and then use runmlwin command to analyse the data in mlwin. But 1. I am not sure how multiple imputation on 3 level structure can be done in stata? and 2. if I can use runmlwin commands on the imputed sets even if they are not the outcome of realcom command in stata.
What do you suggest I should do?
I would greatly appreciate your input!
Sorry for lengthy question.
Zahra
Many thanks for your answer,
I am very confused,
What is the best way to perform multiple imputation on a 3 level multilevel data so that I can analyse the imputed sets and fit models in mlwin?
I would have loved to use realcom but that only works for structure up to two levels ( I have 3)
I wanted to use mlwin macros but I read they only work if my missing values are at level 1 only, is that true? ( I have some level 2 predictors which are missing as well as level 1 predictors and response variables).
I was thinking of doing the multiple imputation in stata and then use runmlwin command to analyse the data in mlwin. But 1. I am not sure how multiple imputation on 3 level structure can be done in stata? and 2. if I can use runmlwin commands on the imputed sets even if they are not the outcome of realcom command in stata.
What do you suggest I should do?
I would greatly appreciate your input!
Sorry for lengthy question.
Zahra

 Site Admin
 Posts: 432
 Joined: Fri Apr 01, 2011 2:14 pm
Re: 3 level multilevel data, multiple imputation, stata, run
Hi Zahra,
Creating and analysing the multiple imputed datasets are two distinct steps. So you can create the datasets using one package (e.g., realcom or Stata) and analyse them using another (e.g., MLwiN or Stata).
Once you have created the imputed datasets all you need do is fit your model of interest separately to each of the imputed data sets and then combine your results using Rubin's rules. You can either do this manually or, if you have fitted the models using a Stata command (e.g., mixed or runmlwin) by using the mi combine prefix in Stata.
So the only hard thing is how to create the imputed datasets. Your data are threelevel with some missing values on variables at level2 or level3. As you point out runmlwin can only impute missing values at level1 and only for continuous or binary variables.
RealCom is currently restricted to twolevel datasets. So you will need to impute your data using some other approach.
The easiest approach would be to break your original data into three separate datasets one at each level and then create, say, five multiple imputed datasets at each level. This gives you 15 datasets. Merge the three levels bak together for each of the five imputations giving you five imputed datasets. Then more onto the analysis step. This approach is clearly not ideal so acknowledge the limitations in your write up.
Best wishes
George
Creating and analysing the multiple imputed datasets are two distinct steps. So you can create the datasets using one package (e.g., realcom or Stata) and analyse them using another (e.g., MLwiN or Stata).
Once you have created the imputed datasets all you need do is fit your model of interest separately to each of the imputed data sets and then combine your results using Rubin's rules. You can either do this manually or, if you have fitted the models using a Stata command (e.g., mixed or runmlwin) by using the mi combine prefix in Stata.
So the only hard thing is how to create the imputed datasets. Your data are threelevel with some missing values on variables at level2 or level3. As you point out runmlwin can only impute missing values at level1 and only for continuous or binary variables.
RealCom is currently restricted to twolevel datasets. So you will need to impute your data using some other approach.
The easiest approach would be to break your original data into three separate datasets one at each level and then create, say, five multiple imputed datasets at each level. This gives you 15 datasets. Merge the three levels bak together for each of the five imputations giving you five imputed datasets. Then more onto the analysis step. This approach is clearly not ideal so acknowledge the limitations in your write up.
Best wishes
George
Re: 3 level multilevel data, multiple imputation, stata, run
Many thanks for your advice!
So if I do as you suggested, break my original dataset to 3 datasets, do 5 MI for each in stata, merge the three levels bak together for each of the five imputations, will I be able to use stata runmlwin commands to do the analysis and fit the models in mlwin?
Do you know of any example which has gone through these steps? a link, a book or etc?
Many many thanks!
Zahra
So if I do as you suggested, break my original dataset to 3 datasets, do 5 MI for each in stata, merge the three levels bak together for each of the five imputations, will I be able to use stata runmlwin commands to do the analysis and fit the models in mlwin?
Do you know of any example which has gone through these steps? a link, a book or etc?
Many many thanks!
Zahra

 Site Admin
 Posts: 432
 Joined: Fri Apr 01, 2011 2:14 pm
Re: 3 level multilevel data, multiple imputation, stata, run
Dear Zahra,
Yes, you can use runmlwin with the mi combine prefix in the same way as you would for any other Stata estimation command
The Stata Multiple Imputation manual provides full details
http://www.stata.com/manuals13/mi.pdf
Best wishes
George
Yes, you can use runmlwin with the mi combine prefix in the same way as you would for any other Stata estimation command
The Stata Multiple Imputation manual provides full details
http://www.stata.com/manuals13/mi.pdf
Best wishes
George
Re: 3 level multilevel data, multiple imputation, stata, run
Hi,
I have five imputed data sets and am using mi est together with runmlwin to run crossclassified model on imputed data sets and combine results using Rubin's rules (code below). But the mi est doesn't seem to work with mcmc estimation and I got this error message "model did not converge on m=1". It worked on individual imputed data set, using only runmlwin, but when I add mi prefix to combine the results, I got the error message. Can you help me understand why this happen? and is there any other way to run this analysis? thanks a lot!
I have five imputed data sets and am using mi est together with runmlwin to run crossclassified model on imputed data sets and combine results using Rubin's rules (code below). But the mi est doesn't seem to work with mcmc estimation and I got this error message "model did not converge on m=1". It worked on individual imputed data set, using only runmlwin, but when I add mi prefix to combine the results, I got the error message. Can you help me understand why this happen? and is there any other way to run this analysis? thanks a lot!
Code: Select all
recast float POST, force
recast float PRE, force
gen cons=1
mi convert wide,clear
sort SCHID PID TID
runmlwin POST cons PRE, level3(SCHID: cons) level2(PID: cons) level1(TID: cons) nopause mlwinpath(C:\mlwin.exe)
estimates store m1igls
mi est,cmdok:runmlwin POST cons PRE, level3(SCHID: cons) level2(PID: cons) level1(TID: cons) mcmc(cc) initsmodel(m1igls) nopause mlwinpath(C:\mlwin.exe)

 Posts: 1252
 Joined: Mon Oct 19, 2009 10:34 am
Re: 3 level multilevel data, multiple imputation, stata, run
I suspect that the cause of this error is that you are estimating your model of interest with MCMC which doesn't set e(converged) to 1 when it has finished iterating. The mi estimate command checks this returned value before carrying on with running the models. You should be able to work around this by searching for the following line in runmlwin.ado:
and changing it to:
Code: Select all
ereturn scalar mcmcdiagnostics = ("`diagnostics'"~="nodiagnostics")
Code: Select all
ereturn scalar mcmcdiagnostics = ("`diagnostics'"~="nodiagnostics")
ereturn scalar converged = 1