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

Description Usage Arguments Details Value References See Also Examples

Description

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/

Usage

1
2
3

Arguments

fail

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

silent

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

Details

This module provides the following distributions for JAGS:

PARETO TYPE I: dpar1(alpha, sigma)

p(x) = α σ^α x^-(α+1)

α > 0, σ > 0, x > σ

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

p(x) = (α / σ) ((α + x - μ) / (σ)) ^ -(α+1)

α > 0, σ > 0, x > μ

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

p(x) = (((x-μ)/σ)^(1/γ -1) (((x-μ)/σ)^(1/γ) +1)^-2) / (γ σ)

σ > 0, γ > 0, x > μ

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

p(x) = (α((x-μ)/σ)^(1/γ -1) (((x-μ)/σ)^(1/γ) +1)^-(α+1)) / (γ σ)

α > 0, σ > 0, γ > 0, x > μ

LOMAX: dlomax(alpha, sigma)

p(x) = (α / σ) (1 + (x / σ)) ^ -(α+1)

α > 0, σ > 0, x > 0

GENERALISED PARETO: dgenpar(sigma, mu, xi)

p(x) = (1 / σ) (1 + ξ ((x-μ) / sigma))^-(1/ξ + 1)

For ξ=0:

p(x) = (1 / σ) e^(-(x-μ)/σ)

σ > 0, x > μ

DUMOUCHEL: dmouch(sigma)

p(x) = σ / ((x + σ)^2)

σ > 0, x > 0

HALF CAUCHY: dhalfcauchy(sigma)

p(x) = 2 σ / (π (x^2 + σ^2))

σ > 0, x > 0

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

Value

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

References

M. J. Denwood, "runjags: An R Package Providing Interface utilities, model templates, parallel computing methods and additional distributions for MCMC models in JAGS." Journal of Statistical Software, [In review].

See Also

runjags-class, load.module

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
	
	# Load the module for use with any rjags model:
	available <- load.runjagsmodule(fail=FALSE)
	if(available){
		# A simple model to sample from a Lomax distribution.	
		# (Requires the rjags or rjparallel methods)
		m <- "model{
			L ~ dlomax(1,1)
		}"	
		results <- run.jags(m, monitor="L", method="rjags", 
		modules="runjags")
	}


Search within the runjags package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.