DIC for single-level models?

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!

Go to runmlwin: Running MLwiN from within Stata >> http://www.bristol.ac.uk/cmm/software/runmlwin/
Post Reply
dimension3
Posts: 8
Joined: Thu Nov 03, 2016 11:17 am

DIC for single-level models?

Post by dimension3 »

Hi there,

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

Code: Select all

runmlwin COUNT X, ///
	        level1(gid) ///
	        discrete(distribution(poisson) offset(lexposure)) nopause mlwinsettings(optimat)
Can I obtain a DIC for such a model? If I add

Code: Select all

mcmc(cc chain(5000) refresh(500) thin(10))  initsb(b) initsv(V)  ///
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?

Thanks for your help!

Benjamin
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: DIC for single-level models?

Post by ChrisCharlton »

If I change the first Poisson example in Chapter 11 of the MCMC guide from http://www.bristol.ac.uk/cmm/software/r ... /examples/ to be single level it works correctly for me and reports a DIC:

Code: Select all

. 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.
dimension3
Posts: 8
Joined: Thu Nov 03, 2016 11:17 am

Re: DIC for single-level models?

Post by dimension3 »

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.
Post Reply