2LevelImpute

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/
richardparker
Posts: 61
Joined: Fri Oct 23, 2009 1:49 pm

Re: 2LevelImpute

Post by richardparker »

Hi - thanks for letting us know - sorry you're still having problems.

We've been trying to further diagnose the issue. Could you please try the following, and let us know if it remedies the situation?

Open the following folder in Windows Explorer (or the equivalent if your copy of Stat-JR is installed in a different location):

C:\StatJR\src\apps\tree

Then shift and right-click, and choose to 'Open Command Window Here'.

Type the following (or similar - see below) at the prompt:

tree 2> C:\Users\MyName\Documents\errors.txt

...so here please enter a path to a directory to which you have write access (i.e. I have write access to C:\Users\MyName\Documents), and then type an (arbitrary) name of a txt file (which will be written out by Stat-JR).

Once you press return, the Stat-JR TREE interface should open, and you will be able to run your imputation. Hopefully this will resolve the issue, but either way we would be very grateful if you could please let us know the outcome, and we can then liaise further.

Best wishes,

Richard
shakespeare
Posts: 70
Joined: Thu Feb 14, 2013 11:12 pm

Re: 2LevelImpute

Post by shakespeare »

Fourth follow-up: Simplified my model by taking out the random slopes and only retaining random intercepts. McAfee is still off. Same error message:

Traceback (most recent call last):
File "webtest.py", line 416, in go
File "C:\StatJR\packages\Python_script.py", line 71, in run
self.eng.run('script.py')
File "O:\StatJR\estat\trunk\src\lib\EStat\engines\Engine.py", line 43, in decorated
File "O:\StatJR\estat\trunk\src\lib\EStat\engines\Python.py", line 16, in run
File "", line 259, in
File "c:\Python27\lib\multiprocessing\pool.py", line 554, in get
CompileError: error: c:\users\sc014459\appdata\local\temp\1\tmpsykg2l\dteyh9:
The process cannot access the file because it is being used by another process

Ran this before I saw your response, so I'll give your suggestion a try and see what happens.
shakespeare
Posts: 70
Joined: Thu Feb 14, 2013 11:12 pm

Re: 2LevelImpute

Post by shakespeare »

I think there's something amiss, or I'm not fully comprehending. I can navigate to C:\StatJR\src\apps\tree and open the command window. However, typing the command specified leads to an error message that indicates it is not a command, program or batch file, so it seems like it's trying to run errors.txt. TREE never opens. I tried several different folders to which I have write access without success. I would appreciate further guidance. Thx.
richardparker
Posts: 61
Joined: Fri Oct 23, 2009 1:49 pm

Re: 2LevelImpute

Post by richardparker »

Hi - when you shift & right-click then choose to 'Open Command Window Here' in C:\StatJR\src\apps\tree, it should change the directory appropriately, so the prompt now appears as follows:

C:\StatJR\src\apps\tree>

Then typing, at the prompt:

tree 2> C:\Users\MyName\Documents\errors.txt

...(or the equivalent write-accessible location for you) should open TREE.

I've attached a screenshot of how it looks for me.

Hope that helps?

Best wishes,

Richard
Attachments
screenshot.png
screenshot.png (6.54 KiB) Viewed 25600 times
ededededed
Posts: 1
Joined: Mon Sep 15, 2014 8:30 am

Re: 2LevelImpute

Post by ededededed »

Hello, I am having a similar problem here. I've tried most of what I can read in the forum, but I still can't resolve it. My error message is this:

Thanks,



==============
Traceback (most recent call last):
File "webtest.py", line 416, in go
File "C:\StatJR\packages\Python_script.py", line 71, in run
self.eng.run('script.py')
File "O:\StatJR\estat\trunk\src\lib\EStat\engines\Engine.py", line 43, in decorated
File "O:\StatJR\estat\trunk\src\lib\EStat\engines\Python.py", line 16, in run
File "", line 189, in
File "O:\StatJR\estat\trunk\src\apps\cmdtest\cmdtest.py", line 128, in RunStatJR
File "C:\StatJR\packages\CustomC.py", line 890, in run
self.runcode(str(self.eng.outputs['modelcode.cpp'].content), self.vars[chainnum], self.data)
File "C:\StatJR\packages\CustomC.py", line 563, in runcode
extra_compile_args = ['-w', '-O3', '-std=c++11'])
File "c:\Python27\lib\site-packages\scipy\weave\inline_tools.py", line 361, in inline
File "c:\Python27\lib\site-packages\scipy\weave\inline_tools.py", line 491, in compile_function
File "c:\Python27\lib\site-packages\scipy\weave\ext_tools.py", line 373, in compile
File "c:\Python27\lib\site-packages\scipy\weave\build_tools.py", line 279, in build_extension
File "c:\Python27\lib\site-packages\numpy\distutils\core.py", line 169, in setup
File "c:\Python27\lib\distutils\core.py", line 169, in setup
CompileError: error: Command "g++ -O2 -Wall -DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSION__=0x0900 -IC:\StatJR\src\lib\EStat\templates -IC:\StatJR\src\apps\tree\include -IC:\StatJR\src\apps\tree\include\scxx -IC:\StatJR\src\apps\tree\tree.exe\numpy\core\include -IC:\StatJR\src\apps\tree\include -IC:\StatJR\src\apps\tree\PC -c C:\StatJR\src\apps\tree\include\scxx\weave_imp.cpp -o c:\users\uqelucio\appdata\local\temp\scipy-uqelucio-1lcc42\python27_intermediate\compiler_6d1da47feb68aa1f945eb2a5466ab74156c185360ea2983102d7d097cc6d956f\Release\weave_imp.o -w -O3 -std=c++11" failed with exit status 1
richardparker
Posts: 61
Joined: Fri Oct 23, 2009 1:49 pm

Re: 2LevelImpute

Post by richardparker »

Hi - the extract you sent is missing a message from the compiler to tell us where the problem is, so if possible it would be great if you could please track that down. E.g. if you could run it again, and scroll up the command window to see if any further error messages are returned (if the error comes from g++ then there should be at least a line of C++ code, along with an error message from the compiler).

Many thanks,

Richard
richardparker
Posts: 61
Joined: Fri Oct 23, 2009 1:49 pm

Re: 2LevelImpute

Post by richardparker »

Hi again,

It's come to our attention that a new version of MinGW, released 26th August 2014, no longer requires the workaround previously described on this page (now updated - the old workaround is described at the bottom): http://www.bristol.ac.uk/cmm/software/s ... er-statjr/

So it may be, if you downloaded MinGW very recently, that that was the source of your problem. In which case it's simply a case of undoing the workaround.

Best wishes,

Richard
odukesucl
Posts: 4
Joined: Thu Oct 02, 2014 2:03 pm

Re: 2LevelImpute

Post by odukesucl »

Hi,

Having installed Stat JR and worked through the 2levelImpute tutorial, I have a few questions:

1) Does the template allow an ordinal/multinomial response variable for the MOI?
2) Again, in the MOI, is it possible to implement an unstructured covariance matrix for the random effects e.g. allow random intercept and slopes to be correlated?
3) In the imputation model, can a random slope be added? As I understand it, this would make sense with longitudinal data.
4) Can the imputed datasets be exported to another software package, as they can be with REALCOM IMPUTE?

Thanks
richardparker
Posts: 61
Joined: Fri Oct 23, 2009 1:49 pm

Re: 2LevelImpute

Post by richardparker »

Hi - thanks for your queries - I've answered them below:

1) Does the template allow an ordinal/multinomial response variable for the MOI?

The answer is currently no, but you can, of course, use the imputed datasets generated by the 2LevelImpute template to fit models via other means.

2) Again, in the MOI, is it possible to implement an unstructured covariance matrix for the random effects e.g. allow random intercept and slopes to be correlated?

The default is for the covariance matrix to be unstructured, so that is possible.

3) In the imputation model, can a random slope be added? As I understand it, this would make sense with longitudinal data.

Adding random slopes in the imputation model would not be appropriate. All the variables with missing data are multivariate Normal responses in the imputation model and this is sufficient for imputing missing values at level 1 and 2. Random slopes are only relevant in the MOI.

4) Can the imputed datasets be exported to another software package, as they can be with REALCOM IMPUTE?

The imputed datasets are available for download as .dta (Stata format) files (as Imputation_Model_impute_datafile_chain0_iter0, etc - see below for details of the nomenclature). In the TREE interface, having run your model you can either download all the outputs (via the green Download button which will appear after you press Run - wait for the model run to finish, though, before doing so), or download individual datasets (such as the imputed datasets produced by the 2LevelImpute template) via the Dataset menu in the black bar at the top. Currently, the former strategy does not add a .dta extension to the imputed datasets, so you will have to add this yourself.

As outlined on the final page of the eBook, the nomenclature of the imputed datasets depends on both the inputs you have chosen, and the number of processors on your machine. For example, if I chose Number of imputed data sets: 5, and Number of iterations between imputations: 500, on my machine with four processors, then I would see "...chain0_iter0", "...chain1_iter0", "...chain2_iter0", "...chain3_iter0", "...chain0_iter500", "...chain1_iter500", "...chain2_iter500", and "...chain3_iter500". Here it has ran a chain / thread on each of the four available processors, and derived a dataset from each by taking the first iteration post-burnin. However, since this number is less than the requested 5 imputed datasets I asked for, it has also constructed four more datasets taken from the 500th iteration post-burnin (since I specified Number of iterations between imputations: 500). However, it will only use the first of these ("...chain0_iter500") to make up the five datasets it needs for the MOI.

Hope that helps,

Best wishes,

Richard
odukesucl
Posts: 4
Joined: Thu Oct 02, 2014 2:03 pm

Re: 2LevelImpute

Post by odukesucl »

Hi,

This is all very helpful, thank you. However, I'm not sure I understand your answer to question 3. In a longitudinal setting, observations at times points closer together usually more highly correlated than observations further apart in time. Wouldn't we want to preserve this structure in the imputed data, by imputing with a random effect for time?

Thanks
Post Reply