Problem with realcomimputeLoad in Stata
-
- Posts: 7
- Joined: Sat Aug 13, 2016 8:58 pm
Problem with realcomimputeLoad in Stata
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:
When load my original data in Stata, change the directory to the imputed data is stored, and type “realcomimputeLoad”, I get this error message:
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
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:
When load my original data in Stata, change the directory to the imputed data is stored, and type “realcomimputeLoad”, I get this error message:
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
-
- Posts: 1384
- Joined: Mon Oct 19, 2009 10:34 am
Re: Problem with realcomimputeLoad in Stata
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:
to see whether Stata is correctly finding the ado file?
Code: Select all
which realcomImputeLoad
-
- Posts: 7
- Joined: Sat Aug 13, 2016 8:58 pm
Re: Problem with realcomimputeLoad in Stata
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.
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.
But since we are at it, when I try to fit my model I get this error message in Stata.
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.
Last edited by Chrisstei78 on Sat Aug 13, 2016 10:24 pm, edited 1 time in total.
-
- Posts: 7
- Joined: Sat Aug 13, 2016 8:58 pm
Re: Problem with realcomimputeLoad in Stata
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.
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.
-
- Posts: 1384
- Joined: Mon Oct 19, 2009 10:34 am
Re: Problem with realcomimputeLoad in Stata
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?
-
- Posts: 7
- Joined: Sat Aug 13, 2016 8:58 pm
Re: Problem with realcomimputeLoad in Stata
I am checking the files after they have been imported into Stata.
-
- Posts: 1384
- Joined: Mon Oct 19, 2009 10:34 am
Re: Problem with realcomimputeLoad in Stata
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.
-
- Posts: 7
- Joined: Sat Aug 13, 2016 8:58 pm
Re: Problem with realcomimputeLoad in Stata
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.
Last edited by Chrisstei78 on Sun Aug 14, 2016 6:10 pm, edited 2 times in total.
-
- Posts: 1384
- Joined: Mon Oct 19, 2009 10:34 am
Re: Problem with realcomimputeLoad in Stata
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.
-
- Posts: 7
- Joined: Sat Aug 13, 2016 8:58 pm
Re: Problem with realcomimputeLoad in Stata
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!
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!
Last edited by Chrisstei78 on Mon Aug 15, 2016 9:37 am, edited 1 time in total.