Translating Probability Density Functions: From R to BUGS and Back Again

The ability to implement statistical models in the BUGS language facilitates Bayesian in ference by automating MCMC algorithms. Software packages that interpret the BUGS language include OpenBUGS, WinBUGS, and JAGS. R packages that link BUGS software to the R environment, including rjags and R2WinBUGS, are widely used in Bayesian analysis. Indeed, many packages in the Bayesian task view on CRAN (http://cran.r-project.org/web/views/Bayesian.html) depend on this integration. However, the R and BUGS languages use different representations of common probability density functions, creating a potential for errors to occur in the implementation or interpre tation of analyses that use both languages. Here we review different parameterizations used by the R and BUGS languages, describe how to translate between the languages, and provide an R function, r2bugs.distributions, that transforms parameterizations from R to BUGS and back again.

David S. LeBauer , Michael C. Dietze , Benjamin M. Bolker
2013-06-17

CRAN packages used

rjags, R2WinBUGS

CRAN Task Views implied by cited packages

Bayesian, gR, Cluster

Reuse

Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".

Citation

For attribution, please cite this work as

LeBauer, et al., "Translating Probability Density Functions: From R to BUGS and Back Again", The R Journal, 2013

BibTeX citation

@article{RJ-2013-020,
  author = {LeBauer, David S. and Dietze, Michael C. and Bolker, Benjamin M.},
  title = {Translating Probability Density Functions: From R to BUGS and Back Again},
  journal = {The R Journal},
  year = {2013},
  note = {https://doi.org/10.32614/RJ-2013-020},
  doi = {10.32614/RJ-2013-020},
  volume = {5},
  issue = {1},
  issn = {2073-4859},
  pages = {207-209}
}