Gibbs or Metropolis Hastings sampling

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
scarpent
Posts: 12
Joined: Thu Apr 19, 2012 6:43 am

Gibbs or Metropolis Hastings sampling

Post by scarpent »

Dear George and Chris,

I am running a discrete-time event history model with logit link function to estimate the probability of leaving social assistance.
I have 160624 person-months nested within individuals and cross-classified in 574 welfare agencies.
I use MCMC estimation with IGLS estimations for the nested model as priors.

I wonder which type of sampling is used by MLwiN (which is invoked by Stata via runmlwin): A Gibbs or Metropolis-Hasting sampling method or a hybrid Metropolis and Gibbs sampling method?
p. 134 in the MCMC user guide I find that for non-normal models Metropolis sampling is the default for some parameters.

Best wishes,

Sarah
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: Gibbs or Metropolis Hastings sampling

Post by GeorgeLeckie »

Hi Sarah,

The easiest way to check this is to look in the

Model > MCMC > MCMC Methods

dialogue box for the relevant MCMC model saved in an MLwiN worksheet

You can use the runmlwin saveworksheet() option to save a worksheet.

Try doing this for different models (e.g., a continuous response model and a binary response model) and you will see how the MLwiN defaults change for different models.

Best wishes

George
scarpent
Posts: 12
Joined: Thu Apr 19, 2012 6:43 am

Re: Gibbs or Metropolis Hastings sampling

Post by scarpent »

Thanks, George

I found indeed the Advanced MCMC Methodology Options in the saved worksheet.

Best wishes,

Sarah
kathrynmbarker
Posts: 9
Joined: Fri Sep 22, 2017 10:27 pm

Re: Gibbs or Metropolis Hastings sampling

Post by kathrynmbarker »

Hello, I am also trying to determine which type of sampling is used by MLwiN (via runmlwin in Stata) in my binary response model: A Gibbs or Metropolis-Hasting sampling method or a hybrid Metropolis and Gibbs sampling method.

Per this forum, I'm attempting to save an MLwiN worksheet and have used both the saveworksheet() option as well as the stata command savewsz. In both instances, I receive the error message "file X could not be opened". Code for the former command here:

Code: Select all

sort nhood_w1 scid modmax_groupid aid
xi: quietly runmlwin pregfw2 i.race i.parent_highestedu ///
i.region cons, level4(nhood_w1:cons) level3(scid: cons) ///
level2(modmax_groupid:cons) level1(aid:) ///
discrete(dist(binomial) link(logit) denom(cons) pql2) nopause 
xi: runmlwin pregfw2 i.race i.parent_highestedu ///
i.region cons, level4(nhood_w1:cons) level3(scid: cons) ///
level2(modmax_groupid:cons) level1(aid:) ///
discrete(dist(binomial) link(logit) denom(cons)) mcmc(cc) initsprevious ///
saveworksheet (E:\Kate\Paper2\test.wsz) nopause 
Alternatively, if I move the saveworksheet bit after the estimation command, and simply use

Code: Select all

runmlwin saveworksheet (E:\Kate\Paper2\test.wsz)
I get the following error message: option level1() required

I'm using MLwiN version 3.00 and Stata 13.1 I must admit I'm a novice, so beginner-level advice on how to remedy this issue would be greatly appreciated. Thank you!
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: Gibbs or Metropolis Hastings sampling

Post by ChrisCharlton »

I just tried the option in the form of your first example and it worked for me, is it possible that the location that you are specifying as the output directory does not exist?

The second example will not work as you need to provide the full model specification to be able to create the worksheet. The -savewsz- command that you mentioned is intended for converting data saved in the Stata .dta format into an MLwiN worksheet file, however this will only contain the data and not any specified models.

To find the MCMC method being used the easiest method is probably to remove the nopause option from your command. This leaves MLwiN open after setting up the model so that you can inspect it. Once you are happy with the settings you can use the resume button to run the model and return to Stata.

As you have a binary logit model the MCMC estimation method will be Metropolis-Hastings. If you want to estimate the model using Gibbs you have to use the probit link function, and then the model is estimated using a latent variable for the response (see Albert and Chib: http://www.tandfonline.com/doi/abs/10.1 ... 3.10476321).
kathrynmbarker
Posts: 9
Joined: Fri Sep 22, 2017 10:27 pm

Re: Gibbs or Metropolis Hastings sampling

Post by kathrynmbarker »

Thanks, Chris!
namphan1998
Posts: 3
Joined: Mon Dec 11, 2017 3:02 am

Re: Gibbs or Metropolis Hastings sampling

Post by namphan1998 »

Thank you for the informative responde!!

Keep up the good work, i really appreciate it!
Post Reply