4 for 4.0 — The Latest JAGS

This post is by Bob Carpenter.

I just saw over on Martyn Plummer’s JAGS News blog that JAGS 4.0 is out. Martyn provided a series of blog posts highlighting the new features:

1. Reproducibility: Examples will now be fully reproducible draw-for-draw and chain-for-chain with the same seed. (Of course, compiler, optimization level, platform, CPU, and OS can also affect numeric computations.) They also added unit testing. (How does anyone develop anything this complex without tests? I’d be lost.)

2. Better Error Messages: Examples with undefined array elements or directed cycles get flagged as such.

3. More R-like Features: This includes some nice variable arg length sum and product functions, but what really caught my eye is allowing integer arrays as indexes R-style (and as loop “bounds” as in R). It makes writing hierarchical models very neat. I don’t like that JAGS now allows the equality sign (=) for assignment—multiple ways to do things can be confusing for people reading the code, though this case is mostly harmless. I’ve always worried about efficiency in using arrays for loop bounds, but my worry’s probably misplaced.

4. Easter Eggs: This is straight from Martyn’s blog post:

One motivation for writing these blog posts was to draw users’ attention to new features that I wanted people to be aware of, even though they are not documented. There are other features – new distributions and samplers – that are currently undocumented and hence hidden. These will miraculously appear as “new” features as they are documented during the JAGS 4.x.y release series.

There’s always the source code!

3 thoughts on “4 for 4.0 — The Latest JAGS

  1. Bravo. Nearly everything mentioned has been something that has annoyed me in the past. For some reason I actually never considered they could be changed, I just accepted them as quirks.

    • It’s open source and the source is pretty clean for a project like this. And unlike OpenBUGS, JAGS is coded in C++, a language that more than a handful of people know.

      Before we built Stan, Matt Hoffman opened up the JAGS code and added some vectorization for logistic regressions that sped up some models considerably. So it is possible to modify productively.

      So I’m surprised more people haven’t jumped in to help with JAGS development. Someone could at least help Martyn with the doc!

Leave a Reply

Your email address will not be published. Required fields are marked *