New Year, New JAGS

JAGS 3.2.0 has been released. The source tarball and the windows installer are on Sourceforge.  Binary packages for other platforms should be available in due course, according to the schedules of the various binary maintainers.

Full details details of the changes can be found in the NEWS file that comes with the distribution, but I would like to highlight two important changes.

Binomial Bug

This release fixes an unpleasant bug in the Binomial distribution, introduced in JAGS 3.0.0 which gave the wrong likelihood when the size parameter is unobserved.  An example of a model that fails is:

model {
   Y ~ dbin(p, N)
   N ~ dpois(lambda)
   p <- 0.5
   lambda ~ dgamma(0.001, 0.001)

When Y is observed, the posterior for N should centred around 2*Y, but JAGS 3.0.0 and 3.1.0 gave incorrect posteriors. Thanks to Richard Barker for pointing this out.

In fact, the posterior distribution of N can be expressed in closed form in this case. With a slight abuse of BUGS notation:

N | Y, p, lambda ~ Y + dpois(lambda*(1 - p))

JAGS 3.2.0 includes a new ShiftedCount sampler, which recognizes this closed form solution and samples directly from the posterior.  Likewise, the new ShiftedMultinomial sampler draws N efficiently when it has a prior multinomial distribution, e.g.

model {
   for (i in 1:ncat) {
      Y[i] ~ dbin(p, N[i])
   N ~ dmulti(prob[], Ntotal)
   p <- 0.5
   prob[1:ncat] ~ ddirch(alpha[])

It should be noted that OpenBUGS has had a shifted Poisson sampler for many years, so JAGS is playing catch up here

Binary GLMs

Those of you have have used the Holmes-Held sampler from the glm module will know that it can be numerically unstable, and crashes with a frustrating message about this being a “known problem”.  I have spent quite a lot of time improving the implementation of this algorithm and I hope that this problem has now been resolved.


5 thoughts on “New Year, New JAGS

    • Yes. This was supposed to be release 3.1.1 since the changes only concern the modules. But when I was testing the release with the clang compiler I found a (very minor) bug in the library. Fixing that bumped the release number to 3.2.0 but I forgot to update the NEWS file.

  1. Hello,

    I am a new user of JAGS, but already a big fan. Release 3.2.0 works great with our models (although apparently only this release). I would like to start running JAGS on our cluster, which is Mac based. Would it be possible to release the compiled Mac version of 3.2.0 soon? Thanks!

    • Bill is working on new binary packages for Mac OS X. This is an incredibly hard job because he has to support the same wide range of platforms as R, namely PowerPC (32-bit) and Intel (32-bit and 64-bit) based Macs on Mac OS X 10.5 (Leopard), 10.6 (Snow Leopard) and 10.7 (Lion).

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s