imputation model specification

Welcome to the forum for Stat-JR users. Feel free to post your question about Stat-JR here. The Centre for Multilevel Modelling take no responsibility for the accuracy of these posts, we are unable to monitor them closely. Do go ahead and post your question and thank you in advance if you find the time to post any answers!

We will add further support to the Stat-JR website, such as FAQs and tutorials, as soon as it is available; the Stat-JR website can be found here: http://www.bristol.ac.uk/cmm/software/statjr/
yongjookim78
Posts: 45
Joined: Tue Jan 10, 2017 3:36 am

imputation model specification

Post by yongjookim78 »

Hello,

While reading through the manual "imputation for multilevel models with missing data using Stat-JR," I've got a quick question.

On page 7, it is said that "Typically these response variables are any that have missing values. Those variables without missing values, if they are to be used in the MOI, can be declared as either response or explanatory variables in the imputation model."

In my dataset, most variables in MOI had missing information including outcome and independent variables, except age and gender.
Then, when I specify imputation models for each variable with any missing values, should I ONLY include variables without any missing values as explanatory variables (i.e., age and gender)? Or, can I include variables with missing values as explanatory variables (to provide more information)?

Thank you for your help in advance!

Best wishes,
Yongjoo
ChrisCharlton
Posts: 1348
Joined: Mon Oct 19, 2009 10:34 am

Re: imputation model specification

Post by ChrisCharlton »

The templates currently available in Stat-JR will only impute values for variables defined as responses in the imputation model. This means that any other variables with missing values will continue to do so while the model is estimated. Stat-JR should listwise delete the data on these variables, however to be on the safe side I would suggest doing so yourself prior to loading the data if you want to include them as explanatory variables in the imputation model. It is common when specifying the imputation model to include all variables containing missing values as responses.
yongjookim78
Posts: 45
Joined: Tue Jan 10, 2017 3:36 am

Re: imputation model specification

Post by yongjookim78 »

Thank you for your kind and detailed explanation, Chris! Very helpful!
I've got a couple follow-up questions:

First, I've been using "NLevelImpute" template, which is downloaded from this website (http://www.bristol.ac.uk/cmm/software/statjr/downloads/) and uploaded to Stat-JR. I couldn't find a right one among the default templates in Stat-JR, so used that one (NLevelImpute). I am wondering whether this is the right one.

Second, thank you and I will try your approach (putting all relevant variables with missing values as response for imputation models). Then, would the order of those procedures (i.e., imputation model for outcome, and then imputation models for independent variables) might matter?

Thank you again!

Best wishes,
Yongjoo
ChrisCharlton
Posts: 1348
Joined: Mon Oct 19, 2009 10:34 am

Re: imputation model specification

Post by ChrisCharlton »

Yes, that is the correct template. As the imputation templates are still new and under development we are currently keeping them available as a separate downloads to the main software.

The examples that I have seen would have one imputation model with both the outcome and the explanatory variables as responses in a multivariate model. In the NLevelImpute template you specify the model of interest and imputation template at the same time and this follows this approach. I am not however an expert in this and would suggest looking at resources such as http://missingdata.org.uk/ and the materials provided by Harvey Goldstein for further guidance.
yongjookim78
Posts: 45
Joined: Tue Jan 10, 2017 3:36 am

Re: imputation model specification

Post by yongjookim78 »

Really helpful and thank you so much!
Best wishes,
Yongjoo
yongjookim78
Posts: 45
Joined: Tue Jan 10, 2017 3:36 am

Re: imputation model specification

Post by yongjookim78 »

Hi Chris,

Thank you again and just got another question while running Stat-JR with "NLevelImpute.py" template.

Based on your advice, I specified both MOI and imputation models. When I designate multiple response variables for imputation models, Stat-JR automatically provide an interface through which I can specify an imputation model for each specific response variable. For, there was one MOI and many imputation models assigned.

Then, based on the manual for "2LevelImpute" (as there was no specific manual for "NLevelImpute"), I worked on the next procedures:
- use conditional marginal algorithm? => YES
- number of imputed data set => 10
- number of iterations before first imputation => 1000
- number of iterations between subsequent imputations => 50
- length of burnin for MOI => 100
- number of iterations for MOI => 250

Then, clicked "NEXT" and "RUN."

However, at the upper right window, the icon was still "Ready" rather than "working" or any other signs.

I am wondering what is a good way to move to the next stages (and what I may need to do after)?

Thank you very much again!

Best,
Yongjoo
ChrisCharlton
Posts: 1348
Joined: Mon Oct 19, 2009 10:34 am

Re: imputation model specification

Post by ChrisCharlton »

Could you look in the black command window that opens when you start Stat-JR to see whether there are any messages there? It could be that one of the sub-templates called by NLevelImpute is producing an error, which would halt the main run. If you haven't already done so I would suggest that you run through some of the simpler examples in the Stat-JR manual, as well as the 2LevelImpute example in http://www.bristol.ac.uk/cmm/media/soft ... statjr.pdf to ensure that the rest of the system is working correctly on your machine.
yongjookim78
Posts: 45
Joined: Tue Jan 10, 2017 3:36 am

Re: imputation model specification

Post by yongjookim78 »

I am not sure how I can post the screen shot of the command window, but at the last line, it said that
"IOError: [Errno 2] No such file or directory: 'C:\\StataJR\\templates\\CompleteCases.py'

If you could let me know how I can attach a file in this post, I can upload it quickly!

Thank you again!
Yongjoo
ChrisCharlton
Posts: 1348
Joined: Mon Oct 19, 2009 10:34 am

Re: imputation model specification

Post by ChrisCharlton »

This indicates that one of the sub-templates (CompleteCases.py) used by NLevelImpute is missing. This should have been in the same zip file as NLevelImpute, however for it to be found you need to place it (alongside the other included templates) into a location that Stat-JR knows about. This can either be "C:\Stat-JR\templates" or "C:\Users\<your user name>\.statjr\templates" depending on whether you want it to be available to all Stat-JR users on your computer or just you.

For future reference there should be a tab labelled "Attachments" below the text editor when writing your messages on the forum which allows you to upload related files.
yongjookim78
Posts: 45
Joined: Tue Jan 10, 2017 3:36 am

Re: imputation model specification

Post by yongjookim78 »

Thank you for letting me know about them all! Based on your guideline, I copied and pasted the sub-templates to the Stat-JR template folder in my window system. Now the status is as follows:

1. template: NLevelImpute.py
2. classifications: 3
3. MOI: specified
4. imputation models: specified for each variable with missing values. Just to be safe and easy, I only included age and sex, both of which are complete data without any missing values.
5. conditional marginal alrorithm => Yes
6. # of imputed datasets => 10
7. # of iterations before first imputation => 1000
8. # of iterations btw subsequent imputations => 50
9. length of burnin for MOI => 100
10. # of iterations for MOI => 250

Then, I clicked "NEXT" and "RUN". This time, I saw that the "Ready" sign quickly turned to "Working" and then got back to "Ready."

Based on this, I am wondering what is the next procedure that I need to do (or that is supposed to come along)?
I am checking with the manual, but I am not sure how I can go through the next steps (i.e., MI estimation with imputed dataset).
In the "dataset" menu, there appears the original dataset that I uploaded, and "CompleteData" which seems to be the imputed one.

Thank you so much for all your great supports and would appreciate your help again!

Best wishes,
Yongjoo
Post Reply