Page 1 of 2

Problem with realcomimputeLoad in Stata

Posted: Sat Aug 13, 2016 9:16 pm
by Chrisstei78
Hello,

I have exported data from Stata to RealcomImpute and created 10 imputated datasets. My model has 14 response variables (all level 1), and 16 explanatory variables (2 on level 1 and 14 on level 2).

The impvals.txt file in my directory shows this content:
screen 3.jpg
screen 3.jpg (68.01 KiB) Viewed 4901 times
When load my original data in Stata, change the directory to the imputed data is stored, and type “realcomimputeLoad”, I get this error message:
screen 4.jpg
screen 4.jpg (90.02 KiB) Viewed 4901 times
I have rebooted the computer to no avail. I have also double-checked if the ado has been installed. I am using Stata 12.1.

Any idea what could have gone wrong? Any suggestions would be greatly appreciated!

Christoph

Re: Problem with realcomimputeLoad in Stata

Posted: Sat Aug 13, 2016 9:30 pm
by ChrisCharlton
It might just be that you have the case slightly wrong. If you look at http://missingdata.lshtm.ac.uk/stata/re ... teLoad.ado you will see that the correct command name is realcomImputeLoad (note the capital I). If correcting this doesn't help can you run the command:

Code: Select all

which realcomImputeLoad
to see whether Stata is correctly finding the ado file?

Re: Problem with realcomimputeLoad in Stata

Posted: Sat Aug 13, 2016 9:48 pm
by Chrisstei78
Thanks, Chris! This is silly mistake.

But since we are at it, when I try to fit my model I get this error message in Stata.
screen 5.jpg
screen 5.jpg (44.23 KiB) Viewed 4894 times
However, I can estimate the models when I change the dependent variable.

Does that indicate something with the imputation of the main dependent variable went wrong? Can I simply ignore this with the commandv"esampvaryok"?

I imputed 10 datasets twice, with the same imputation model but different burn-in and iteration specifications. When I load them into Stata the result is the same.

Re: Problem with realcomimputeLoad in Stata

Posted: Sat Aug 13, 2016 10:11 pm
by Chrisstei78
UPDATE:

I checked all ten imputations of the dependent variable and found that missing values have not been imputed in the second one, but in all other imputations.

Here is the imputation trace graph for the relevant variable.
Monitor.jpg
Monitor.jpg (42.09 KiB) Viewed 4892 times

Re: Problem with realcomimputeLoad in Stata

Posted: Sat Aug 13, 2016 10:35 pm
by ChrisCharlton
That is pretty puzzling, as the program should be doing exactly the same steps for each imputed data set. If the model doesn't take too long to run you could try imputing with a different interval between imputations, or with more imputed data-sets to see if there is a pattern. Are you checking the raw files saved from Realcom-Impute, or the data-sets after they have been loaded into Stata?

Re: Problem with realcomimputeLoad in Stata

Posted: Sat Aug 13, 2016 10:53 pm
by Chrisstei78
I am checking the files after they have been imported into Stata.

Re: Problem with realcomimputeLoad in Stata

Posted: Sat Aug 13, 2016 11:04 pm
by ChrisCharlton
Would you also be able to check the files saved from Realcom-Impute (imputeiter1000, imputeiter2000, ...)? These are plain text files and should contain the imputed data. If these look okay then there may be a problem with the Stata command, in which case depending on your level of Stata knowledge I would suggest either manually replicating the contents of realcomImputeLoad.ado to identify the problem or contacting the author, Jonathan Bartlett.

Re: Problem with realcomimputeLoad in Stata

Posted: Sun Aug 14, 2016 12:23 pm
by Chrisstei78
When I open imputeiter.1000 and 2000 in Firefox I cannot spot any fundamental difference. Is the first response variable (in the order they have been imported into RealcomImpute) listed in the first column from the left side? If so, then the variable looks similar and okay in both imputeiter.1000 and 2000.

Re: Problem with realcomimputeLoad in Stata

Posted: Sun Aug 14, 2016 1:03 pm
by ChrisCharlton
The ordering of the variables in the imputation file should match the first row in your impvals.txt file, and in your case there should be 14 of them. The ordering of the rows should be the same as in your original data. If the positions that were originally missing in your input data have sensible looking values in both imputeiter files then it is likely that the RealcomImputeLoad command has failed to correctly load that file.

Re: Problem with realcomimputeLoad in Stata

Posted: Sun Aug 14, 2016 10:13 pm
by Chrisstei78
I see, thanks. Then all my imputed datasets look similar and complete when inspected outside of Stata.

I produced a further set of 10 imputed datasets with different iteration specifications. The result for the problematic variable above is the same, and it again occurred in imputed dataset 2 when I re-import it into Stata.

Just in case this cannot be resolved, would it be possible to produce a higher number of imputed datasets (let's say 11) and then tell stata to exclude the one with reduced numbers of cases? How would I do that? Although this may not be ideal, it may at least be a temporary work-around.

Many thanks for your prompt response even on a weekend!