Dear all,
My question is how to organize data in order to impute a twolevel model with 5 repeated measures.
To sum up: We have been using Stata and RealComImpute. Level 1 = patient id, Level 2 = month.
Month is a repeated measure taken from the same patient at month 0 (baseline), 1, ..., 4.
Letting i denote the ith month (i = 0,...,4) and j = 1,...,n participants, our model is like:
y_ij = β_0 + β_1month_ij + β_2gender_j + ....+ u_0j + u_1j month_ ij + e_ ij
We have missing data for i = 3 and i = 4 only (~10% and 90% respectively). Data for the remaining months are complete.
y from month 2 is highly correlated with y from month 3 (r>0.90), y from month 2 is also highly correlated with y from month 4 (apparently  with r>0.70).
So, we would like to use y from month 2 as one of the predictors for y month 3 and 4.
In order to use y from month 2 as predictor, I created (in Stata) an additional column called pred_2, which contains y from month 2 for every subject.
In Stata, the final dataset would look like this:
*/ start 
clear
set seed 12345
set obs 1000
gene id = _n
gene age = round(runiform()*30)+20
gene gender = round(runiform())
gene covariate1 = runiform()
gene covariate2 = runiform()
forvalues i = 0/4 {
gene y`i' = round(rnormal(100,20))
}
replace y3 = . if runiform()<0.10
replace y4 = . if runiform()<0.90
gene pred_2 = y2
reshape long y, i(id) j(month)
gene cons = 1
sort month id
order id month y pred_2
realcomImpute y age gender covariate1 covariate2 pred_2 using mydata , numresponses(1) cons(cons) level2id(month)
*/ end 
Is this the correct set up for the twolevel imputation?
Look forward to hearing from you.
Tiago
How to impute a twolevel model with repeated measures

 Posts: 4
 Joined: Fri Feb 17, 2017 3:00 am

 Posts: 49
 Joined: Sun Sep 06, 2009 5:30 pm
Re: How to impute a twolevel model with repeated measures
As I understand it, your model is a repeated measures model where you have some responses missing for some individuals at some occasions (months). If you just set this up as a 2level model then there is typically no problem since the level 2 units (individuals) just have different numbers of level 1 measures. Any multilevel software that can handlerandom coefficients will fit this. Imputation only arises if one or more predictors has missing data, or if you happen to be using a standard MANOVA or SEM design that requires balance.
Harvey Goldstein
Harvey Goldstein

 Posts: 4
 Joined: Fri Feb 17, 2017 3:00 am
Re: How to impute a twolevel model with repeated measures
Thanks, Dr. Goldstein.
So, apparently there is no point in imputing responses in that repeated measure analysis? No gain in terms of standard errors?
Tiago
So, apparently there is no point in imputing responses in that repeated measure analysis? No gain in terms of standard errors?
Tiago

 Posts: 4
 Joined: Fri Feb 17, 2017 3:00 am
Re: How to impute a twolevel model with repeated measures
It took me some minutes only: Journal of Clinical Epidemiology 66 (2013) 1022e1028
Multiple imputation of missing values was not necessary before
performing a longitudinal mixedmodel analysis
Jos Twisk a,b, *, Michiel de Boer b , Wieke de Vente c , Martijn Heymans a,b
Multiple imputation of missing values was not necessary before
performing a longitudinal mixedmodel analysis
Jos Twisk a,b, *, Michiel de Boer b , Wieke de Vente c , Martijn Heymans a,b

 Posts: 4
 Joined: Fri Feb 17, 2017 3:00 am
Re: How to impute a twolevel model with repeated measures
Dear all,
After some days of reading, I've decided that I would like to see if MI will provide different results for my data. Assuming that I want to impute response variables (repeated measures), is the approach I pointed out above OK?
After some days of reading, I've decided that I would like to see if MI will provide different results for my data. Assuming that I want to impute response variables (repeated measures), is the approach I pointed out above OK?

 Posts: 1
 Joined: Sat May 12, 2018 12:54 pm
Re: How to impute a twolevel model with repeated measures
Thanks for sharing this information.