Welcome to the forum for runmlwin users. Feel free to post your question about runmlwin 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!
To compare the model-fit of a single-level and a multilevel mode, I would like to use MCMC estimation for a single-level model to obtian a DIC estimate. Specifically, my model is
for some reason, MLwiN crashes ("Windows promt: MLwiN stopped working"). As soon as I add another level, MCMC estimation works. Do I need to specify MCMC estimation differently when only fitting a single-level model?
. use "http://www.bristol.ac.uk/cmm/media/runmlwin/mmmec1.dta", clear
. describe
Contains data from http://www.bristol.ac.uk/cmm/media/runmlwin/mmmec1.dta
obs: 354
vars: 8 21 Oct 2011 12:19
size: 5,664
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
storage display value
variable name type format label variable label
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
nation byte %9.0g nation
region byte %9.0g
county int %9.0g
obs int %9.0g
exp float %9.0g
cons byte %9.0g
uvbi float %9.0g
pcons byte %9.0g
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
Sorted by:
.
. generate logexp = ln(exp)
.
. quietly runmlwin obs cons uvbi, ///
> level1(county:) ///
> discrete(distribution(poisson) offset(logexp)) nopause
.
. runmlwin obs cons uvbi, ///
> level1(county:) ///
> discrete(distribution(poisson) offset(logexp)) ///
> mcmc(chain(50000) refresh(500)) initsprevious nopause
MLwiN 3.0 multilevel model Number of obs = 354
Poisson response model
Estimation algorithm: MCMC
Burnin = 500
Chain = 50000
Thinning = 1
Run time (seconds) = 6
Deviance (dbar) = 3449.51
Deviance (thetabar) = 3447.55
Effective no. of pars (pd) = 1.96
Bayesian DIC = 3451.47
------------------------------------------------------------------------------
obs | Mean Std. Dev. ESS P [95% Cred. Interval]
-------------+----------------------------------------------------------------
cons | -.0701726 .0109846 9069 0.000 -.0916578 -.0485091
uvbi | -.0572096 .0026464 9120 0.000 -.0624605 -.0521433
------------------------------------------------------------------------------
It is therefore likely that your problem is due to the data that you are using. Can you provide more information regarding this? Have you tried removing the mlwinsettings(optimat) setting as it may be that MLwiN needs a larger matrix size for the single-level model.
Hi Chris,
thanks so much for the quick answer. Your comment regarding mlwinsettings(optimat) solved my problem. This option needs to be specified in the model that is estimated with maximum likelihood to generate the initial values and the model that estimates the DIC. In fact, also not specifying this option works but it is definitely wrong to only specify it in the 2nd model like I did.