Menu

Force the use of Gibbs samplers

runjags
2016-01-10
2016-01-11
  • Robert McDonnell

    Hi Matt,

    First of all, thanks for runjags, it's fantastic. The fact I can 'open up' JAGS a little bit, particularly by extracting the samplers used afterwards, has made me aware of a little problem that I would love to fix.

    I have an IRT ideal-point model that I'm running with runjags. It's the standard Bayesian IRT ideal point, wee explained on this thread on the JAGS forum, which raises an almost identical problem.
    http://sourceforge.net/p/mcmc-jags/discussion/610037/thread/5c9e9026/

    Basically, this model should leave JAGS choosing Gibbs samplers but doesn't because the JAGS glm module cannot make the DAG from unobserved predictors. When I run it with runjags, it chooses Metropolis-Hastings and takes a long, long, long time. (autorun.jags wanted 20 million iterations!!)
    I've tried forcing runjags to choose Gibbs sampling through the use of the factories and modules arguments, and also by using set.factory("base::Slice", type="sampler", state=FALSE) of the JAGS options. However, it then chooses the base::RealSlicer sampler.

    Is there anyway to force runjags to use the glm::Albert-Chib-Gibbs sampler?

    Thanks,

    Robert

     
  • Matt Denwood

    Matt Denwood - 2016-01-11

    Hi Robert

    Thanks for the feedback - I'm glad you find runjags useful!

    The choice of sampler that JAGS makes is not something that is currently directly controllable by the user. What it basically does (as far as I'm aware) is to identify what it thinks is the most appopriate sampler from those available for each node, and to use that. The small amount of user-modification is to make some samplers unavailable (or available) via (un)loading modules. You can also often re-formulate your model and trigger another sampler to be used depending on the model formulation - the metropolis hastings is a 'fall-back' solution which makes me think that this might help in your case, but you would be better off asking on the JAGS forum as this is not strictly a runjags issue.

    It may be possible to allow some kind of directive in the model code to instruct JAGS to use a specific sampler - I know Martyn has suggested this before, and it would be a useful feature. I will look into it, but I am not so familiar with the JAGS source as Martyn is!

    Cheers,

    Matt

     
  • Robert McDonnell

    Thanks for the reply Matt. It is a JAGS issue and not a runjags issue as you say, but I thought I might be able to do this through runjags. I'll bring it up on the JAGS forums. Thanks again!

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.