Generalized additive models with jagam

jagam

Simon N. Wood has arXived a paper on  Just Another Gibbs Additive Modeller: Interfacing JAGS and mgcv. Simon is the author of the mgcv package for R, which provides functions for generalized additive (mixed) modelling and is distributed with base R as a recommended package.

Since R version 3.2.0, the mgcv package has included the jagam() function, which generates BUGS code and data for generalized additive models. The  jagam() function uses the same interface as the other functions in the mgcv package. The output of jagam can be analyzed directly by JAGS, or modified and incorporated into a larger Bayesian model. We are using jagam in a couple of projects and I highly recommend it if you want to include some smoothing in a hierarchical model.

Grid shading by simulated annealing (or what I did on my holidays)

The UK spy agency GCHQ is often in the news for the wrong reasons and has recently been on something of a charm offensive to improve its tarnished image. This campaign includes stencilling job adverts on the pavement in the trendy Shoreditch area of London  and, more recently, setting a series of incredibly difficult puzzles for the general public to solve. GCHQ director Robert Hannigan included a grid shading puzzle in his Christmas cards that received wide attention in the UK press. Continue reading

JAGS 4.1.0 is released

JAGS 4.1.0 was released at the weekend. The project page on Sourceforge has download links for the source, as well as binaries for Windows and Mac OS X.

This is a bug fix release. The main purpose was to fix some of the issues that arose in JAGS 4.0.0. Among these was a spurious warning about unused variables which confused a lot of people using the command line interface (This did not affect the R interfaces). Further improvements been made to the error messages about undefined variables and directed cycles. I have to thank users of the JAGS forums on Sourceforge for bringing problems to my attention.

So what’s next? I plan to continue working on the 4.x.y series for some time and my three priorities are

  1. Documentation
  2. Finalizing the glm module (and loading it by default)
  3. Optimization

So I will be pushing further releases as and when I reach milestones for these goals.

PyJAGS

Editors note: I am very pleased to announce that Tomasz Miąsko has created a Python interface to JAGS. The rest of this post is by Tomasz.

Nowadays Python users certainly cannot complain about a lack of MCMC packages. We have emcee, PyMC, PyMC3, and PyStan to mention a few. Recently this list was extended by one more; PyJAGS – a Python interface to JAGS. JAGS is a program for analysis of Bayesian hierarchical models using Markov Chain Monte Carlo (MCMC) simulation, quite often used from within the R environment with the help of the rjags package. The PyJAGS package offers Python users a high-level API to JAGS, similar to the one found in rjags. Current rjags users interested in migrating to Python should feel at home. Of course, other interested in doing Bayesian data analysis may also find PyJAGS useful. Continue reading