Imputation files not found
-
- Posts: 7
- Joined: Mon Aug 22, 2016 10:19 pm
Imputation files not found
Hello,
I ran what appeared to be a successful imputation procedure, but when I type realcomImputeLoad in stata, I am getting the following error:
file imputeiter100. not found
If it's helpful to diagnose this error, here is my model in stata:
realcomImpute bmi bmixsplinea1 bmixsplinea2 bmixsplinea3 bmixsplinea4 bmixsplinea5 bmiat18 ///
splinea1 splinea2 splinea3 splinea4 splinea5 parous HDL ///
parousxsplinea1 parousxsplinea2 parousxsplinea3 parousxsplinea4 parousxsplinea5 ///
post_preg_ind post_time h3 ses ///
using TestMIInput.dat, replace numresponses(7) ///
level2id(pid) cons(cons)
When I ran the MCMC, I obtained the attached log and it saved the attached impvals.txt file. It also created a storedata.mat file which as far as I can tell doesn't contain anything in it. Was there some issue in creating the imputed datasets? How were they supposed to be stored? As far as I can tell, the documentation doesn't get into this level of detail.
Thank you,
Amanda
I ran what appeared to be a successful imputation procedure, but when I type realcomImputeLoad in stata, I am getting the following error:
file imputeiter100. not found
If it's helpful to diagnose this error, here is my model in stata:
realcomImpute bmi bmixsplinea1 bmixsplinea2 bmixsplinea3 bmixsplinea4 bmixsplinea5 bmiat18 ///
splinea1 splinea2 splinea3 splinea4 splinea5 parous HDL ///
parousxsplinea1 parousxsplinea2 parousxsplinea3 parousxsplinea4 parousxsplinea5 ///
post_preg_ind post_time h3 ses ///
using TestMIInput.dat, replace numresponses(7) ///
level2id(pid) cons(cons)
When I ran the MCMC, I obtained the attached log and it saved the attached impvals.txt file. It also created a storedata.mat file which as far as I can tell doesn't contain anything in it. Was there some issue in creating the imputed datasets? How were they supposed to be stored? As far as I can tell, the documentation doesn't get into this level of detail.
Thank you,
Amanda
- Attachments
-
- impvals.PNG (51.9 KiB) Viewed 90964 times
-
- Imputation log.PNG (63.9 KiB) Viewed 90964 times
-
- Posts: 1384
- Joined: Mon Oct 19, 2009 10:34 am
Re: Imputation files not found
When you run the imputation Realcom-Impute should save a file containing the imputed responses for each chosen imputation. The names of these files should correspond with the text in the fourth line of the impvals.txt file and should be in the same directory as this file. The storedata.mat file should contain the state of the software when you last used it, in theory allowing you to carry on from that point at a later date, this is not however used by external software. If the imputeiter* files are missing then it may that these was an estimation problem. The output that you posted seems to contain a lot of zeros, so it might be worth looking at the earlier output to see whether there were any further messages from when it was running the MCMC chains. It may also be worth checking the MCMC trajectories to ensure that they look okay.
-
- Posts: 7
- Joined: Mon Aug 22, 2016 10:19 pm
Re: Imputation files not found
Hello Chris,
Thank you for the fast reply. It does seem like there might have been estimation problems, although I did not see anything in the log to indicate this. When I click "view results" I do get error messages (attached). I did monitor one of the MCMC trajectories while it was running, but could not find anywhere in the documentation that explained what to look for in these trajectories. I've attached an example of one. Is there other documentation I could use to learn more about how to evaluate these trajectories?
I've tried many different versions of this model with different predictor variables and haven't yet been able to sucessfully run it without some type of error. Are there any tips for getting the model to fit? I'm predicting a level 2 variable (BMI at age 18) and I have values for BMI at other ages, as well as other variables that will end up in my final model. There are some missing values for BMI at other ages, although not many, so I included them as response variables.
Thank you,
Amanda
Thank you for the fast reply. It does seem like there might have been estimation problems, although I did not see anything in the log to indicate this. When I click "view results" I do get error messages (attached). I did monitor one of the MCMC trajectories while it was running, but could not find anywhere in the documentation that explained what to look for in these trajectories. I've attached an example of one. Is there other documentation I could use to learn more about how to evaluate these trajectories?
I've tried many different versions of this model with different predictor variables and haven't yet been able to sucessfully run it without some type of error. Are there any tips for getting the model to fit? I'm predicting a level 2 variable (BMI at age 18) and I have values for BMI at other ages, as well as other variables that will end up in my final model. There are some missing values for BMI at other ages, although not many, so I included them as response variables.
Thank you,
Amanda
- Attachments
-
- MCMC trajectory.jpg (24.06 KiB) Viewed 90960 times
-
- Imputation log view results.PNG (86.3 KiB) Viewed 90960 times
-
- Posts: 1384
- Joined: Mon Oct 19, 2009 10:34 am
Re: Imputation files not found
It looks like something definitely is going wrong there, you shouldn't get any error messages while estimating and the value of the beta you are monitoring is staying extremely close to zero. I would suggest that you initially check the files that have been output from Stata for use in Realcom-Impute to ensure that they match what you expect from your data. I would also suggest checking that the value used to correspond to "missing" within these files matches that specified within Realcom-Impute before you start the iterations. For general advice on MCMC and interpreting the chains see the first chapter of the MLwiN MCMC guide (http://www.bris.ac.uk/cmm/media/softwar ... mc-web.pdf)
-
- Posts: 7
- Joined: Mon Aug 22, 2016 10:19 pm
Re: Imputation files not found
Hello Chris,
Thank you for that information, that will be very helpful. In an effort to try to figure out what might be going wrong, I tried to simplify the problem. I ran MI again with just two variables, BMI at age 18 which is missing for about 44% of people and current BMI which I made sure was not missing for anyone. I am now getting an immediate error upon running the MCMC despite confirming that the missing value was set to 9999 in the dataset and in REALCOM. I also tried it with a few other non-missing predictors in the model as well. I feel like there must be something very basic that I'm missing, any suggestions are greatly appreciated!
Here is my stata code:
sort pid
replace bmiat18=9999 if missing(bmiat18)
drop if bmi==.
realcomImpute bmiat18 bmi ///
using TestMIInput2.dat, replace numresponses(1) ///
level2id(pid) cons(cons)
Thank you for that information, that will be very helpful. In an effort to try to figure out what might be going wrong, I tried to simplify the problem. I ran MI again with just two variables, BMI at age 18 which is missing for about 44% of people and current BMI which I made sure was not missing for anyone. I am now getting an immediate error upon running the MCMC despite confirming that the missing value was set to 9999 in the dataset and in REALCOM. I also tried it with a few other non-missing predictors in the model as well. I feel like there must be something very basic that I'm missing, any suggestions are greatly appreciated!
Here is my stata code:
sort pid
replace bmiat18=9999 if missing(bmiat18)
drop if bmi==.
realcomImpute bmiat18 bmi ///
using TestMIInput2.dat, replace numresponses(1) ///
level2id(pid) cons(cons)
- Attachments
-
- Imputation.PNG (42.19 KiB) Viewed 90954 times
-
- Error in imputation.PNG (53.6 KiB) Viewed 90954 times
-
- Posts: 1384
- Joined: Mon Oct 19, 2009 10:34 am
Re: Imputation files not found
The interface for setting the missing value can sometimes be confusing. Can you confirm that you clicked the button labelled "set missing value to:" after typing in the new value, as I think that the error message you are getting is suggesting that it isn't seeing any missing data?
-
- Posts: 7
- Joined: Mon Aug 22, 2016 10:19 pm
Re: Imputation files not found
Hello Chris,
Unfortunately, I did try that and received the same error. I've also tried a few different missing values (ex. STATA's default -9.999e+29, 9999, and 99999) and also have tried running the model with different response and auxiliary variables to see if was something wrong with the variables I'm using, but am having the same problem. Is there anything else you would suggest I try?
Thank you,
Amanda
Unfortunately, I did try that and received the same error. I've also tried a few different missing values (ex. STATA's default -9.999e+29, 9999, and 99999) and also have tried running the model with different response and auxiliary variables to see if was something wrong with the variables I'm using, but am having the same problem. Is there anything else you would suggest I try?
Thank you,
Amanda
-
- Posts: 1384
- Joined: Mon Oct 19, 2009 10:34 am
Re: Imputation files not found
If you have access to MLwiN you could try working through the example in the Realcom-Impute manual (http://www.bris.ac.uk/media-library/sit ... tation.pdf) to see whether you get the same problems there. If not then if you are able to replicate the problem using a publicly available dataset then we can look into it further and see whether there is an undiscovered bug in the software.
-
- Posts: 7
- Joined: Mon Aug 22, 2016 10:19 pm
Re: Imputation files not found
Hello Chris,
I tried to use a publicly available dataset and I did not receive the error about missing data, but it is having the estimation problem that I initially wrote about:
. realcomImputeLoad
file impvals.txt not found
Perhaps it just isn't a very good example and if so please let me know an example that should run (I tried having less missing data and it was still a problem). Here is the STATA code I used:
/*Use a publicly available multilevel STATA dataset*/
use http://www.stata-press.com/data/r12/productivity.dta
/*Create a level-2 (state-level) variable with missing data*/
/*Mean unemployment by state*/
by state, sort: egen meanunemp = mean(unemp)
/*Missing at random conditional on "public" variable*/
replace meanunemp=. if public>50000
/*Create dataset for REALCOM-Impute*/
gen cons = 1
sort state
cd "H:\HUNT\Datasets_intermediate" //Same folder that REALCOM-Impute starts in
realcomImpute meanunemp public gsp ///
using TestMIInput.dat, replace numresponses(1) ///
level2id(state) cons(cons)
realcomImputeLoad
Thank you,
Amanda
I tried to use a publicly available dataset and I did not receive the error about missing data, but it is having the estimation problem that I initially wrote about:
. realcomImputeLoad
file impvals.txt not found
Perhaps it just isn't a very good example and if so please let me know an example that should run (I tried having less missing data and it was still a problem). Here is the STATA code I used:
/*Use a publicly available multilevel STATA dataset*/
use http://www.stata-press.com/data/r12/productivity.dta
/*Create a level-2 (state-level) variable with missing data*/
/*Mean unemployment by state*/
by state, sort: egen meanunemp = mean(unemp)
/*Missing at random conditional on "public" variable*/
replace meanunemp=. if public>50000
/*Create dataset for REALCOM-Impute*/
gen cons = 1
sort state
cd "H:\HUNT\Datasets_intermediate" //Same folder that REALCOM-Impute starts in
realcomImpute meanunemp public gsp ///
using TestMIInput.dat, replace numresponses(1) ///
level2id(state) cons(cons)
realcomImputeLoad
Thank you,
Amanda
- Attachments
-
- Monitor Graphs.PNG (27.26 KiB) Viewed 90941 times
-
- REALCOM window.PNG (48.91 KiB) Viewed 90941 times
-
- Posts: 1384
- Joined: Mon Oct 19, 2009 10:34 am
Re: Imputation files not found
I just tried replicating your example and it seemed to work for me:
Code to set up imputation in Stata:
Realcom-Impute output:
Code to load imputed data into Stata:
Can you confirm that you are setting the output directory (via the Impute button in Realcom) to be the same as Stata is using?
Code to set up imputation in Stata:
Code: Select all
. /*Use a publicly available multilevel STATA dataset*/
. use http://www.stata-press.com/data/r12/productivity.dta
(Public Capital Productivity)
.
. /*Create a level-2 (state-level) variable with missing data*/
. /*Mean unemployment by state*/
. by state, sort: egen meanunemp = mean(unemp)
.
. /*Missing at random conditional on "public" variable*/
. replace meanunemp=. if public>50000
(113 real changes made, 113 to missing)
.
. /*Create dataset for REALCOM-Impute*/
. gen cons = 1
. sort state
. cd "O:\Realcom-stata" //Same folder that REALCOM-Impute starts in
O:\Realcom-stata
. realcomImpute meanunemp public gsp ///
> using TestMIInput.dat, replace numresponses(1) ///
> level2id(state) cons(cons)
1 responses: meanunemp
2 auxiliary variables: public gsp
(note: file TestMIInput.dat not found)
Data saved to TestMIInput.dat
(note: file TestMIInput_wts.dat not found)
Code: Select all
User selected O:\Realcom-stata\TestMIInput.dat
c_nimpute =
1
c_naux =
4
c_vartype =
1
ans =
2
c_betaconstraint =
0
1
fid =
3
Imputation_method =
0
Multivariate estimation using Gibbs and MH sampling - Normal/probit models
Independence assumed with standard probit model for unordered categories
Nov 14 2006
Two-level responses version
NRTYPE =
1
BETASTART =
0
0
0
BETASTART_2 =
Empty matrix: 1-by-0
SIGMASTART =
1.3530
Burn in = 100 Sample = 1000
no level 1, level 2 units = 816, 48
iteration 10
iteration 20
iteration 30
iteration 40
iteration 50
iteration 60
iteration 70
iteration 80
iteration 90
iteration 100
iteration 110
iteration 120
iteration 130
iteration 140
iteration 150
iteration 160
iteration 170
iteration 180
iteration 190
iteration 200
iteration 210
iteration 220
iteration 230
iteration 240
iteration 250
iteration 260
iteration 270
iteration 280
iteration 290
iteration 300
iteration 310
iteration 320
iteration 330
iteration 340
iteration 350
iteration 360
iteration 370
iteration 380
iteration 390
iteration 400
iteration 410
iteration 420
iteration 430
iteration 440
iteration 450
iteration 460
iteration 470
iteration 480
iteration 490
iteration 500
iteration 510
iteration 520
iteration 530
iteration 540
iteration 550
iteration 560
iteration 570
iteration 580
iteration 590
iteration 600
iteration 610
iteration 620
iteration 630
iteration 640
iteration 650
iteration 660
iteration 670
iteration 680
iteration 690
iteration 700
iteration 710
iteration 720
iteration 730
iteration 740
iteration 750
iteration 760
iteration 770
iteration 780
iteration 790
iteration 800
iteration 810
iteration 820
iteration 830
iteration 840
iteration 850
iteration 860
iteration 870
iteration 880
iteration 890
iteration 900
iteration 910
iteration 920
iteration 930
iteration 940
iteration 950
iteration 960
iteration 970
iteration 980
iteration 990
iteration 1000
iteration 1010
iteration 1020
iteration 1030
iteration 1040
iteration 1050
iteration 1060
iteration 1070
iteration 1080
iteration 1090
iteration 1100
Error using save
Unable to write file storedata: permission denied.
Error in mcmcdriver (line 1192)
Error in gui_2levmixresp>pushbutton16_RunMCMC_Callback (line 264)
Error in gui_mainfcn (line 96)
Error in gui_2levmixresp (line 46)
Error in @(hObject,eventdata)gui_2levmixresp('pushbutton16_RunMCMC_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
Code: Select all
. realcomImputeLoad
10 multiple imputations successfully loaded
Style: wide
last mi update 31aug2016 16:19:12, 0 seconds ago
Obs.: complete 703
incomplete 113 (M = 10 imputations)
---------------------
total 816
Vars.: imputed: 1; meanunemp(113)
passive: 0
regular: 0
system: 1; _mi_miss
(there are 12 unregistered variables)