Imputation of Multilevel Data PreviousNext
Mplus Discussion > Missing Data Modeling >
 Tanja Gabriele Baudson posted on Tuesday, January 21, 2014 - 4:15 pm
I have tried to make a multilevel imputation of missing data using Bayesian estimation. It does result in 20 imputed data files indeed, but I am not sure whether I have done it correctly, as the message "Unexpected end of file reached in data file" appears when I try to use these imputed data files. Here's the syntax:
usevar =
ZTJnp10 !cont. IV, level 1
nostudcl !cont. IV, level 2
aa_berer !cont. IV, level 2
knowkid !cont. IV, level 1
sexkid !cat. IV, level 1
langkid !cat. IV, level 1
ses1 !cat. IV, level 1
ses2 !cat. IV, level 1
ses3 !cat. IV, level 1
l_kog_5; !cont. DV

idvariable = id;

cluster = classno;

within = knowkid sexkid langkid ses1 ses2 ses3 ZTJnp10;

between = nostudcl aa_berer;

missing = all(-99999);


estimator = bayes;
type = twolevel;
bseed = 72114;
bconvergence = .01;

impute = knowkid (c) sexkid (c)
langkid (c)
ses1 (c) ses2 (c) ses3 (c)
ZTJnp10 aa_berer;
ndatasets = 20;
save = tjimp*.dat;
thin = 1000;



Thanks in advance,
 Linda K. Muthen posted on Tuesday, January 21, 2014 - 5:19 pm
The variables in the imputed data sets may not contain the same variables in the same order as the original data set. The order of the variables and the format of the imputed data sets is given at the end of the output where the data sets are imputed.
 Tanja Gabriele Baudson posted on Wednesday, January 22, 2014 - 2:14 am
Thanks, Linda, this helps already -- indeed, that was one of the problem.

However, now a new problem has occurred: apparently, the imputed files contain missing values, indicated by an asterisk (actually, I had assumed that the use of MI is to replace these missings?). I get the error message that I have variation within clusters at the between-level, which, in the past, was usually the case when the data was not read properly. As the original format was 15.5, whereas an asterisk is rather of a format 1.0. Could this be the problem, and if so, what syntax command will solve it?

Thanks for your patience.
 Linda K. Muthen posted on Wednesday, January 22, 2014 - 6:22 am
Please send the output where you imputed the data and the output where you are reading the imputed data and your license number to
 Alan Taylor posted on Monday, June 22, 2015 - 9:33 pm
I have struck the same problem as Tanja - using the Bayesian estimator to do H0 MI data with a latent variable model (but not multilevel) and obtaining asterisks in the output datasets.

I've also tried a very simple model based on observed variables,and lower levels of missing data than originally, but with the same result.

The tech 8 output says that the prior is improper for every parameter (44) in the case of the latent variable model.

I'd appreciate any advice you can give.
 Linda K. Muthen posted on Tuesday, June 23, 2015 - 6:39 am
The asterisks are missing values. Read the saved data according to the information at the end of the output regarding the saved data sets and use MISSING = *;
 Alan Taylor posted on Tuesday, June 23, 2015 - 5:19 pm
Thanks Linda. But I would expect the multiple imputation procedure to replace the missing values in the imputed datasets, not perpetuate them.

I've run the analysis again and checked that the values missing in the imputed datasets are those which are missing in the original dataset.

It seems that no imputation has taken place at all. That's just not right, is it.
 Linda K. Muthen posted on Tuesday, June 23, 2015 - 5:53 pm
Please send the output and your license number to You must be overlooking something.
 Alan Taylor posted on Tuesday, June 23, 2015 - 6:33 pm
Oh dear, I'm sorry, Linda. Yes, you're quite right. Looking at Example 11.7 in the manual, I was led to think that, when using the H0 method, I didn't need to use the impute= subcommand, but that imputed values would automatically be saved for all the variables in the model.

When I added that subcommand, all worked as it should.

Thanks for your comment, which led me to consider that option, and for your very prompt responses.
Back to top
Add Your Message Here
Username: Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Options: Enable HTML code in message
Automatically activate URLs in message