BayES BayES

3.2 Interface to JAGS

Just Another Gibbs Sampler (JAGS) is an open-source program which takes as inputs data and a model specification file (written in JAGS’ own language) and draws samples from the posterior distribution of the model’s parameters or latent variables, picking the most appropriate sampling method automatically.

BayESjags() function provides a convenient interface to JAGS, which allows the user to:

The general syntax of the jags() function is the following:2

[<model name> = ] jags( <model specification file> 
        [, "data"=<list of matrices to pass to JAGS> ] 
        [, "monitor"=<list of parameters to monitor> ] 
        [, "inits"=<structure of initial values> ] 
        [, "chains"=<positive integer> ] 
        [, "burnin"=<positive integer> ] 
        [, "draws"=<positive integer> ] 
        [, "thin"=<positive integer> ] 
        [, "seed"=<positive integer> ] 
        );

where:

PIC Under Linux and macOS systems, the path to the JAGS model specification file must not contain any spaces.

As the jags() function executes, JAGS attempts to print output on the system’s command console. BayES grabs this output and redirects it to the BayES main console in real time. This output is entirely determined by JAGS and it includes information on the model specification file used in the current run, any errors or warnings and, most importantly, information on the progress of the sampler relative to the total number of requested draws from the posterior.

Many of the sample script files in "$BayESHOME/Samples/3JAGSOpenBUGSStan" contain examples of using the jags() function, along with JAGS model specification files for simple models. The JAGS interface is also accessible from the BayES main menu via Interfaces JAGS.

2Arguments inside square brackets are optional. Optional arguments passed to the jags() function can be provided in any order, but always after the mandatory argument (model specification file). Optional arguments always come in pairs (eg. "chains"=1).

Share this content:
Facebook Twitter LinkedIn Email
© 2016–20 Grigorios Emvalomatis