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/
ChrisCharlton
Posts: 1348
Joined: Mon Oct 19, 2009 10:34 am

Re: imputation model specification

Post by ChrisCharlton »

If it is working correctly then there should be no further inputs required after clicking the Run button. What should happen is that is runs for a few minutes while it fits the imputation model and model of interest, and then when it is completed you should get tables of coefficients for both the complete case and the imputed versions of the data. If it is stopping before it gets to this point then it is likely that there is another problem, in which case I would recommend looking for errors in the command interface window, or testing with simpler templates to ensure that the rest of the system is working as expected.
yongjookim78
Posts: 45
Joined: Tue Jan 10, 2017 3:36 am

Re: imputation model specification

Post by yongjookim78 »

This is really helpful and thank you very much! It is clear that it did not work well as it stopped running only after a few seconds with the attached command produced. By the way, as you suggested, I would try to run it by using a simpler template (i.e., 2LevelImpute.py) and get it back to you! Thank you again!
Best,
Yongjoo
Attachments
STATJR_TREE_screen3.png
STATJR_TREE_screen3.png (28.73 KiB) Viewed 19010 times
ChrisCharlton
Posts: 1348
Joined: Mon Oct 19, 2009 10:34 am

Re: imputation model specification

Post by ChrisCharlton »

This error suggests to me that there may be an incompatibility with one or more of your variable names and the Stat-JR system. Would it be possible to let me know what the names of the variables you are using are so that I can confirm this? In general you will want to avoid underscores in variable names as these are often used by the system to separate out information in derived variable names.
yongjookim78
Posts: 45
Joined: Tue Jan 10, 2017 3:36 am

Re: imputation model specification

Post by yongjookim78 »

Oh I think you got the point! Actually I often create categorical variables with "_cat" (i.e., smk_3cat, drnk_high, edu_3cat, marri_3cat...), which are included as the response variables for imputation models. Also, some variables (i.e., hlth_5cat) are also included as explanatory variables for imputation models. Will try again (maybe both ways - 2LevelImpute & NLevelImpute) and keep you updated! This has been so helpful and thank you!
Best,
Yongjoo
yongjookim78
Posts: 45
Joined: Tue Jan 10, 2017 3:36 am

Re: imputation model specification

Post by yongjookim78 »

Hi again!
Today, I've tried it again based on your advice yesterday as follows:

1) recoded all variables without "_" (i.e., smk3cat, drnkhigh, edu3cat)

2) chose simpler template (i.e., 2LevelImpute)

3) specified both MOI and imputation models. For imputation models, I've included explanatory variables which included missing information as well. I also included explanatory variables which were used as "response for imputation models". For instance, in one model, BMI was used as response for imputation model, and then in other models (for smk3cat and edu3cat), BMI was used as explanatory variables.

Then, I've got error message, saying "KeyError: 'model'" as attached.

I am wondering whether:
- I can include variables with missing information as explanatory variables for imputation models
- I can include variables, which were used as response in one model, as explanatory variables for other imputation models.

(If neither are allowed, then the choice of explanatory variables for imputation models might be too narrow i.e., only age and sex).

Thank you again!
Best,
Yongjoo
Attachments
STATJR_TREE_screen2.png
STATJR_TREE_screen2.png (43.41 KiB) Viewed 19004 times
STATJR_TREE_screen1.png
STATJR_TREE_screen1.png (53.49 KiB) Viewed 19004 times
yongjookim78
Posts: 45
Joined: Tue Jan 10, 2017 3:36 am

Re: imputation model specification

Post by yongjookim78 »

Re my issue posted just now, I tried to re-specify imputation models with "age" as the only explanatory variable for all imputation model responses.
However, still, I've encountered the same issue "KeyError: model" with the "ready" sign turned "idle."
Would appreciate your help!
Best,
Yongjoo
Attachments
STATJR_TREE_screen3.png
STATJR_TREE_screen3.png (35.35 KiB) Viewed 19003 times
yongjookim78
Posts: 45
Joined: Tue Jan 10, 2017 3:36 am

Re: imputation model specification

Post by yongjookim78 »

Instead of "2LevelImpute" template (which I encountered issues posted above), I've tried to use NLevelImpute with following options:

1. Number of higher level classifications => 3
Higher level classification A: region (highest)
Higher level classification B: psun (second highest)
Higher level classification C: idfamn (second lowest)

2. Use conditional marginal algorithm? => Yes
3. Number of imputed data sets => 20
4. Number of iterations before first imputation => 1000
5. Number of iterations between subsequent imputations => 50
6. Length of burnin for MOI: => 100
7. Number of iterations for MOI: => 250

After I clicked "run", it worked for about 10-20 seconds, then the sign turned to "Ready(7s)" with nothing presented in the Stat-JR window. The screen shot of the command window is attached! Would appreciate your help!!

Best,
Yongjoo
Attachments
STATJR_TREE_screen1.png
STATJR_TREE_screen1.png (40.73 KiB) Viewed 19002 times
ChrisCharlton
Posts: 1348
Joined: Mon Oct 19, 2009 10:34 am

Re: imputation model specification

Post by ChrisCharlton »

It's possible that an old problem has been reintroduced in MinGW. Could you try applying step 3 from http://www.bristol.ac.uk/cmm/software/s ... er-statjr/ and let us know if that fixes it? You might only need the second point, so you could try that first and then do both if it doesn't fix things.
yongjookim78
Posts: 45
Joined: Tue Jan 10, 2017 3:36 am

Re: imputation model specification

Post by yongjookim78 »

Got it! Will do that and get it back to you, Chris! Thank you again!
Best,
Yongjoo
yongjookim78
Posts: 45
Joined: Tue Jan 10, 2017 3:36 am

Re: imputation model specification

Post by yongjookim78 »

Hi Chris,

Re your advice on MinGW, I've done the second point of the Step 3 (http://www.bristol.ac.uk/cmm/software/s ... er-statjr/).

Just in case, the first point didn't work (maybe my MinGW is already up-do-dated?) I am attaching the related command output just in case!

Best,
Yongjoo
Attachments
STATJR_screen1.png
STATJR_screen1.png (61.88 KiB) Viewed 18991 times
Post Reply