Extending JAGS: A tutorial on adding custom distributions to JAGS (with a diffusion model example)

We demonstrate how to add a custom distribution into the general-purpose, open-source, cross-platform graphical modeling package JAGS (“Just Another Gibbs Sampler”). JAGS is intended to be modular and extensible, and modules written in the way laid out here can be loaded at runtime as needed and do not interfere with regular JAGS functionality when not loaded. Writing custom extensions requires knowledge of C++, but installing a new module can be highly automatic, depending on the operating system. As a basic example, we implement a Bernoulli distribution in JAGS. We further present our implementation of the Wiener diffusion first-passage time distribution, which is freely available at https://sourceforge.net/projects/jags-wiener/.

[1]  David B. Dunson,et al.  Bayesian Data Analysis , 2010 .

[2]  Andrew Thomas,et al.  WinBUGS - A Bayesian modelling framework: Concepts, structure, and extensibility , 2000, Stat. Comput..

[3]  Martyn Plummer,et al.  JAGS: A program for analysis of Bayesian graphical models using Gibbs sampling , 2003 .

[4]  Andrew Gelman,et al.  Data Analysis Using Regression and Multilevel/Hierarchical Models , 2006 .

[5]  Johan Wagemans,et al.  The concavity effect is a compound of local and global effects , 2007, Perception & psychophysics.

[6]  Andreas Voss,et al.  Fast-dm: A free program for efficient diffusion model analysis , 2007, Behavior research methods.

[7]  Eric-Jan Wagenmakers,et al.  An EZ-diffusion model for response time and accuracy , 2007, Psychonomic bulletin & review.

[8]  Francis Tuerlinckx,et al.  Fitting the ratcliff diffusion model to experimental data , 2007, Psychonomic bulletin & review.

[9]  Paul De Boeck,et al.  Random Item IRT Models , 2008 .

[10]  Francis Tuerlinckx,et al.  Diffusion model analysis with MATLAB: A DMAT primer , 2008, Behavior research methods.

[11]  J. Vandekerckhove Extensions and applications of the diffusion model for two-choice response times , 2009 .

[12]  Eric-Jan Wagenmakers,et al.  Methodological and empirical developments for the Ratcliff diffusion model of response times and accuracy , 2009 .

[13]  J Frank Michael Fitting drift-diffusion models in a hierarchical Bayesian framework: methods and applications , 2011 .

[14]  M. Lee,et al.  Hierarchical diffusion models for two-choice response times. , 2011, Psychological methods.

[15]  Han Lin Shang,et al.  The BUGS book: a practical introduction to Bayesian analysis , 2013 .

[16]  Thomas V. Wiecki,et al.  HDDM: Hierarchical Bayesian estimation of the Drift-Diffusion Model in Python , 2013, Front. Neuroinform..