load.runjagsmodule: Load the internal JAGS module provided by runjags

View source: R/load.module.runjags.R

load.runjagsmoduleR Documentation

Load the internal JAGS module provided by runjags


The runjags package contains a JAGS extension module that provides several additional distributions for use within JAGS (see details below). This function is a simple wrapper to load this module. The version of the module supplied within the runjags package can only be used with the rjags package, or with the rjags or rjparallel methods within runjags. For a standalone JAGS module for use with any JAGS method (or independent JAGS runs) please see: https://sourceforge.net/projects/runjags/files/paretoprior/


load.runjagsmodule(fail = TRUE, silent = FALSE)


load.runJAGSmodule(fail = TRUE, silent = FALSE)




should the function fail using stop() if the module cannot be loaded?


if !fail, the function will by default print a diagnostic message if the module cannot be loaded - the silent option suppresses this message.


This module provides the following distributions for JAGS:

PARETO TYPE I: dpar1(alpha, sigma)

p(x) = \alpha \sigma^{\alpha} x^{-\left(\alpha+1 \right)}

\alpha > 0, \sigma > 0, x > \sigma

PARETO TYPE II: dpar2(alpha, sigma, mu)

p(x) = \frac{\alpha}{\sigma} \left( \frac{\alpha + x - \mu}{\sigma}\right)^{-\left(\alpha+1\right)}

\alpha > 0, \sigma > 0, x > \mu

PARETO TYPE III: dpar3(sigma, mu, gamma)

p(x) = \frac{\frac{x-\mu}{\sigma}^{\frac{1}{\gamma}-1} \left(\frac{x-\mu}{\sigma}^{\frac{1}{\gamma}} +1\right)^{-2}}{\gamma \sigma}

\sigma > 0, \gamma > 0, x > \mu

PARETO TYPE IV: dpar4(alpha, sigma, mu, gamma)

p(x) = \frac{\alpha \frac{x-\mu}{\sigma}^{\frac{1}{\gamma}-1} \left(\frac{x-\mu}{\sigma}^{\frac{1}{\gamma}} +1\right)^{-\left(\alpha+1\right)}}{\gamma \sigma}

\alpha > 0, \sigma > 0, \gamma > 0, x > \mu

LOMAX: dlomax(alpha, sigma)

p(x) = \frac{\alpha}{\sigma} \left(1 + \frac{x}{\sigma}\right)^{-\left(\alpha+1\right)}

\alpha > 0, \sigma > 0, x > 0

GENERALISED PARETO: dgenpar(sigma, mu, xi)

p(x) = \frac{1}{\sigma} \left(1 + \xi \left(\frac{x-\mu}{\sigma}\right)\right)^{-\left(\frac{1}{\xi}+1\right)}

For \xi=0:

p(x) = \frac{1}{\sigma} e^{\frac{-\left(x-\mu\right)}{\sigma}}

\sigma > 0, x > \mu

DUMOUCHEL: dmouch(sigma)

p(x) = \frac{\sigma}{\left(x+\sigma\right)^2}

\sigma > 0, x > 0

HALF CAUCHY: dhalfcauchy(sigma)

p(x) = \frac{2 \sigma}{\pi \left(x^2+\sigma^2\right)}

\sigma > 0, x > 0

For an easier to read version of these PDF equations, see the userguide vignette.


Invisibly returns TRUE if able to (un)load the module, or FALSE otherwise


Denwood, M.J. 2016. runjags: An R Package Providing Interface Utilities, Model Templates, Parallel Computing Methods and Additional Distributions for MCMC Models in JAGS. J. Stat. Softw. 71. doi:10.18637/jss.v071.i09.

See Also

runjags-class, load.module


# Load the module for use with any rjags model:
available <- load.runjagsmodule(fail=FALSE)
# A simple model to sample from a Lomax distribution.
# (Requires the rjags or rjparallel methods)
m <- "model{
 L ~ dlomax(1,1)
## Not run: 
results <- run.jags(m, monitor="L", method="rjags", modules="runjags")

## End(Not run)

runjags documentation built on May 29, 2024, 4:34 a.m.