Page 1 of 1
MCMC error
Posted: Mon Aug 18, 2014 12:05 pm
by luisrvaz
Hi,
I am carrying out a bivariate response model using -runmlwin-. The code is as follows:
Code: Select all
xi: runmlwin (mean_reach cons soc_net type_121 have_current mental_health, eq(1)) ///
(effectiveness cons type_121, eq(2)), ///
level2(SHA: (cons, eq(1)) (cons, eq(2))) ///
level1(service: (cons, eq(1)) (cons, eq(2))) nopause
xi: runmlwin (mean_reach cons soc_net type_121 have_current mental_health, eq(1)) ///
(effectiveness cons type_121, eq(2)), ///
level2(SHA: (cons, eq(1)) (cons, eq(2))) ///
level1(service: (cons, eq(1)) (cons, eq(2))) ///
mcmc(on) initsprevious
However, when running the second MCMC part of the code, an error message returns reading
error while obeying batch file
C:\Users\mcxlv1\AppData\Local\Temp\ST_000000cp.tmp at line
number 259:
MCMC 0 500 1 5.8 50 10 C1499] C1500]111114
Any help understanding what might have gone wrong would be appreciated.
Many thanks,
Luis
Re: MCMC error
Posted: Mon Aug 18, 2014 12:26 pm
by GeorgeLeckie
Hi Luis,
Not immediately obvious what the problem is. Does the following two-level bivariate response model work for you?
Best wishes
George
Syntax:
Code: Select all
* Load the data
use http://www.bristol.ac.uk/cmm/media/runmlwin/tutorial, clear
* Fit the model by IGLS
runmlwin ///
(normexam cons girl, eq(1)) ///
(standlrt cons girl, eq(2)), ///
level2(school: (cons, eq(1)) (cons, eq(2))) ///
level1(student: (cons, eq(1)) (cons, eq(2))) ///
nopause
* Fit the model by MCMC
runmlwin ///
(normexam cons girl, eq(1)) ///
(standlrt cons girl, eq(2)), ///
level2(school: (cons, eq(1)) (cons, eq(2))) ///
level1(student: (cons, eq(1)) (cons, eq(2))) ///
mcmc(on) initsprevious ///
nopause
Output
Code: Select all
. * Load the data
. use http://www.bristol.ac.uk/cmm/media/runmlwin/tutorial, clear
.
. * Fit the model by IGLS
. runmlwin ///
> (normexam cons girl, eq(1)) ///
> (standlrt cons girl, eq(2)), ///
> level2(school: (cons, eq(1)) (cons, eq(2))) ///
> level1(student: (cons, eq(1)) (cons, eq(2))) ///
> nopause
MLwiN 2.31 multilevel model Number of obs = 4059
Multivariate response model
Estimation algorithm: IGLS
-----------------------------------------------------------
| No. of Observations per Group
Level Variable | Groups Minimum Average Maximum
----------------+------------------------------------------
school | 65 2 62.4 198
-----------------------------------------------------------
Run time (seconds) = 2.10
Number of iterations = 3
Log likelihood = -10263.911
Deviance = 20527.822
------------------------------------------------------------------------------
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
normexam |
cons_1 | -.1612301 .0572912 -2.81 0.005 -.2735188 -.0489415
girl_1 | .261202 .0402489 6.49 0.000 .1823155 .3400885
-------------+----------------------------------------------------------------
standlrt |
cons_2 | -.1142065 .0469738 -2.43 0.015 -.2062735 -.0221395
girl_2 | .155753 .0401182 3.88 0.000 .0771227 .2343833
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
Level 2: school |
var(cons_1) | .1613726 .0311917 .1002379 .2225073
cov(cons_1,cons_2) | .0917669 .0213467 .0499282 .1336056
var(cons_2) | .0913072 .019033 .0540031 .1286112
-----------------------------+------------------------------------------------
Level 1: student |
var(cons_1) | .8394563 .0187846 .8026391 .8762734
cov(cons_1,cons_2) | .4990042 .0158479 .467943 .5300655
var(cons_2) | .8985292 .0201032 .8591278 .9379307
------------------------------------------------------------------------------
.
. * Fit the model by MCMC
. runmlwin ///
> (normexam cons girl, eq(1)) ///
> (standlrt cons girl, eq(2)), ///
> level2(school: (cons, eq(1)) (cons, eq(2))) ///
> level1(student: (cons, eq(1)) (cons, eq(2))) ///
> mcmc(on) initsprevious ///
> nopause
MLwiN 2.31 multilevel model Number of obs = 4059
Multivariate response model
Estimation algorithm: MCMC
-----------------------------------------------------------
| No. of Observations per Group
Level Variable | Groups Minimum Average Maximum
----------------+------------------------------------------
school | 65 2 62.4 198
-----------------------------------------------------------
Burnin = 500
Chain = 5000
Thinning = 1
Run time (seconds) = 23.7
Deviance (dbar) = 20272.58
Deviance (thetabar) = 20158.25
Effective no. of pars (pd) = 114.33
Bayesian DIC = 20386.91
------------------------------------------------------------------------------
| Mean Std. Dev. ESS P [95% Cred. Interval]
-------------+----------------------------------------------------------------
normexam |
cons_1 | -.1643378 .0600507 221 0.003 -.2823821 -.0454367
girl_1 | .2621391 .0405411 1943 0.000 .1849588 .34239
-------------+----------------------------------------------------------------
standlrt |
cons_2 | -.1155206 .0480626 385 0.008 -.2112595 -.0225297
girl_2 | .1558245 .0403793 2074 0.000 .0790241 .2364237
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Mean Std. Dev. ESS [95% Cred. Int]
-----------------------------+------------------------------------------------
Level 2: school |
var(cons_1) | .1729842 .0344736 3558 .1169745 .2514282
cov(cons_1,cons_2) | .0982398 .023249 3267 .0603594 .1506764
var(cons_2) | .0976112 .0206698 2658 .0650132 .1460618
-----------------------------+------------------------------------------------
Level 1: student |
var(cons_1) | .8398604 .0188513 5116 .8047218 .8778029
cov(cons_1,cons_2) | .4995166 .0161975 4812 .4681756 .5326727
var(cons_2) | .8998426 .020322 4673 .8613644 .9406142
------------------------------------------------------------------------------
Re: MCMC error
Posted: Mon Aug 18, 2014 1:05 pm
by luisrvaz
Hi George,
Yes, this model seems to work fine. Presumably the problem is to do with the data then? The IGLS model works.
Many thanks,
Luis
Re: MCMC error
Posted: Mon Aug 18, 2014 4:06 pm
by ChrisCharlton
This may be a starting value issue. Do the IGLS results look sensible (i.e. no parameters have a value of zero, etc)?
Re: MCMC error
Posted: Tue Aug 19, 2014 8:00 am
by luisrvaz
Hi Chris,
The IGLS output is as follows, and is sensible I think:
Code: Select all
MLwiN 2.30 multilevel model Number of obs = 106
Multivariate response model
Estimation algorithm: IGLS
-----------------------------------------------------------
| No. of Observations per Group
Level Variable | Groups Minimum Average Maximum
----------------+------------------------------------------
SHA | 10 6 10.6 20
-----------------------------------------------------------
Run time (seconds) = 3.96
Number of iterations = 4
Log likelihood = -767.8653
Deviance = 1535.7306
------------------------------------------------------------------------------
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
mean_reach |
cons_1 | 8.505443 2.035181 4.18 0.000 4.516561 12.49432
soc_net_1 | 5.722118 2.270977 2.52 0.012 1.271086 10.17315
type_121_1 | 6.279435 1.768567 3.55 0.000 2.813107 9.745763
have_curre~1 | 4.123179 2.0874 1.98 0.048 .0319506 8.214407
mental_hea~1 | 4.455556 2.073707 2.15 0.032 .3911659 8.519947
-------------+----------------------------------------------------------------
effectiveness|
cons_2 | 42.13049 1.804684 23.35 0.000 38.59338 45.66761
type_121_2 | 7.038652 2.074887 3.39 0.001 2.971948 11.10536
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
Level 2: SHA |
var(cons_1) | 10.55678 7.644933 -4.427016 25.54057
cov(cons_1,cons_2) | -11.41561 7.48183 -26.07973 3.248507
var(cons_2) | 12.55333 10.33496 -7.702825 32.80948
-----------------------------+------------------------------------------------
Level 1: service |
var(cons_1) | 64.05847 9.320689 45.79026 82.32669
cov(cons_1,cons_2) | -10.17931 8.600607 -27.03619 6.677567
var(cons_2) | 107.8221 15.51508 77.41306 138.2311
------------------------------------------------------------------------------
I wondered whether the issue could be to do with the cluster variables, having a small number of level 2 groups i.e. 10 Strategic Health Authorities?
Luis
Re: MCMC error
Posted: Tue Aug 19, 2014 12:15 pm
by GeorgeLeckie
Hi Luis,
The starting value for the level-2 covariance implies a level-2 correlation of effectively -1 which is on the boundary on the feasibly parameter space
. display -11.41561/sqrt(10.55678*12.55333)
-.99163972
You could try manually specifying a less extreme starting value.
Yes, 10 clusters would be considered by many as rather low for a multilevel analysis.
Best wishes
George
Re: MCMC error
Posted: Wed Aug 20, 2014 2:36 pm
by luisrvaz
Hi George,
I tried to specify less extreme starting values than the IGLS model produced, however, after changing the matrix with the stored initial values, the model still produces the same error. Is it possible that it is a similar error obeying batch file to the one listed on the following site:
http://www.bristol.ac.uk/cmm/software/s ... rrors.html
I wondered what might be happening as it specifically mentions lines C1499 and C1500?
Many thanks,
Luis
Re: MCMC error
Posted: Thu Aug 21, 2014 3:58 pm
by ChrisCharlton
C1499 and C1500 are where the starting values for the residuals and residual s.e. are being stored. You may be able to get a more informative error message if you remove the nopause option from your -runmlwin- call, and then after MLwiN displays the equation click abort macro and then try running the model via the start button.