Page 2 of 2

Re: Binary covariate and run time errors using the nlevel imputation template

Posted: Wed Sep 12, 2018 2:03 pm
by madk1712
Hi Chris,

I've copied and pasted several chunks of code below where I can see errors. The two school-level variables I'm attempting to include are school average KS1 and KS2 scores (for 150 schools) which are normally distributed, albeit left-skewed. There are approximately 4 schools with missing KS1 and KS2 averages. Hopefully the code will be meaningful, but I can provide more if that would be helpful. I also downloaded the imputed datasets from these runs (with the school-level variables included), and the results are implausible for the level 1 variables with missing data.

Code: Select all

INFO:root:Compiling Model...
INFO:root:Running ..\..\..\eStat\bin\Release\eStat.exe
Index not valid integer Input string was not in a correct format.
Index not valid integer Input string was not in a correct format.
Index not valid integer Input string was not in a correct format.
Deterministic child has parent which is neither stochastic nor deterministic nor matrix element.
Deterministic child has parent which is neither stochastic nor deterministic nor matrix element.
Deterministic child has parent which is neither stochastic nor deterministic nor matrix element.
Deterministic child has parent which is neither stochastic nor deterministic nor matrix element.
Deterministic child has parent which is neither stochastic nor deterministic nor matrix element.

ERROR:root:sigma2_u2:
ERROR:root:0.0103558776067
ERROR:root:tau:
ERROR:root:nan
ERROR:root:sigma2_u1:
ERROR:root:0.0115536092272
ERROR:root:sigma2_u3:
ERROR:root:0.0281587281314
ERROR:root:deviance:
ERROR:root:nan
ERROR:root:u1:
ERROR:root:[ nan  nan  nan  nan  nan  nan  nan  nan  nan

ERROR:root:sigma2:
ERROR:root:nan
ERROR:root:tau has a non finite value, aborting
{'estoptions': {'Engine': 'eStat', 'nchains': '1', 'thinning': '1', 'burnin': '5000', 'defaultalg': 'Yes', 'iterations': '10000', 'outdata': 'imp4', 'makepred': 'No', 'seed': '4', 'defaultsv': 'Yes'}, 'invars': {'D': 'Normal', 'storeresid': 'No', 'C3': 'group', 'C2': 'school', 'y': 'post', 'x': 'cons,treatment,pre,ks1,schoolks2', 'C1': 'ta', 'NumLevs': '3'}, 'template': 'NLevelMod', 'dataset': 'CompleteData'}
Done

Exception in thread Thread-8:
Traceback (most recent call last):
  File "c:\Python27\lib\threading.py", line 801, in __bootstrap_inner
  File "c:\Python27\lib\threading.py", line 754, in run
  File "O:\repo\stat-jr\src\lib\EStat\engines\Python.py", line 13, in execpy
  File "<string>", line 400, in <module>
  File "O:\repo\stat-jr\src\lib\EStat\engines\Engine.py", line 21, in __getitem__
KeyError: 'Chains'

Re: Binary covariate and run time errors using the nlevel imputation template

Posted: Wed Sep 12, 2018 2:12 pm
by ChrisCharlton
Thanks for this. It looks like there is a numeric error when running the model of interest on the complete dataset (i.e. with rows containing missing values removed). Could you check whether you get the same behaviour when running the model directly? i.e. by creating a version of the dataset when the rows with missing are moved and then running the model either via the "NLevelMod" template, or via MLwiN.

Re: Binary covariate and run time errors using the nlevel imputation template

Posted: Wed Sep 12, 2018 3:49 pm
by madk1712
I've managed to successfully fit the MOI (with missing values removed) using the StatJR 'nlevelmod' template and both the eStat and JAGS estimation engines. I was getting poor mixing with the eStat engine on some of the variance parameters (ESS on some of these were in the hundreds rather than the tens of thousands), which wasn't repeated in JAGS, but this may be down to the default priors used.

Re: Binary covariate and run time errors using the nlevel imputation template

Posted: Wed Sep 12, 2018 4:01 pm
by ChrisCharlton
Thanks for checking that. In that case it's possible that there is a problem with the template used to generate the complete cases version of the data (CompleteCases). Could you try running this with the variables in your model of interest and confirm that the dataset it generates matches that one that you created?

Re: Binary covariate and run time errors using the nlevel imputation template

Posted: Thu Sep 13, 2018 8:15 am
by madk1712
I've checked the StatJR complete case template against the R procedure and they produce identical datasets.

Re: Binary covariate and run time errors using the nlevel imputation template

Posted: Thu Sep 13, 2018 1:11 pm
by ChrisCharlton
I'm not really sure where the difference is coming from then. Could you try running the model that worked for you using 2LevelImpute with the NLevelImpute template to confirm that this works and you get the same results as before? If it does it would be useful to know if any intermediate models (i.e. fewer classifications or co-variates) work.

Re: Binary covariate and run time errors using the nlevel imputation template

Posted: Mon Dec 12, 2022 10:47 am
by spiceagent11
Hi Chris,

Unfortunately, I still get the same error message......

Re: Binary covariate and run time errors using the nlevel imputation template

Posted: Thu Dec 21, 2023 9:58 pm
by spiceagent11
spiceagent11 wrote: Mon Dec 12, 2022 10:47 am Hi Chris,

Unfortunately, I still get the same error message.......
No reply?