jaggernaut: Bayesian Analysis with JAGS

Description Details References See Also Examples

Description

An R package to facilitate Bayesian analysis using JAGS (Just Another Gibbs Sampler).

Details

In short an analysis proceeds first by the definition of the JAGS model in BUGS code using the jags_model function. Multiple models can be combined in a single jags_model object using combine. Next the resultant jags_model object is passed together with a data set to the jags_analysis function which calls the JAGS software to perform the actual MCMC sampling. The resultant jags_analysis object can then be passed to the plot.jags_analysis function to view the MCMC traces, the convergence function to check the Rhat values of individual parameters and the coef.jags_analysis function to get the parameter estimates with credible limits. The predict.jags_analysis function can then be used to extract derived parameter estimates with credible intervals from a jags_analysis object without the need for further MCMC sampling.

Options are queried and set using the opts_jagr function.

References

Plummer M (2012) JAGS Version 3.3.0 User Manual http://sourceforge.net/projects/mcmc-jags/files/Manuals/

See Also

jags_model, jags_analysis and opts_jagr.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
mod <- jags_model("
model { 
 bLambda ~ dlnorm(0,10^-2) # $\\lambda$
 for (i in 1:length(x)) { 
   x[i]~dpois(bLambda) 
 } 
}")

dat <- data.frame(x = rpois(100,1))

an <- jags_analysis (mod, dat, mode = "demo")

plot(an)
convergence(an)
coef(an)
coef(an, latex = TRUE)
summary(an)

poissonconsulting/jaggernaut documentation built on Feb. 18, 2021, 11:10 p.m.