load.neojagsmodule {neojags}R Documentation

Load the internal JAGS module provided by neojags that is modified from runjags package

Description

The neojags 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 neojags 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/neojags/

Usage

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

unload.neojagsmodule()

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

unload.neoJAGSmodule()

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:

Jones'S Skew Exponential Power: djskew.ep(mu, tau, nu1, nu2)

For y<\mu:

p(y) = c\sqrt{\tau }\exp \left[ -{{\left| \sqrt{\tau }(y-\mu ) \right|}^{{{\nu }_{1}}}} \right]

For y \ge \mu:

p(y) = c\sqrt{\tau }\exp \left[ -{{\left| \sqrt{\tau }(y-\mu ) \right|}^{{{\nu }_{2}}}} \right]

where

c = {{\left[ \Gamma \left( 1+{{\nu }_{1}}^{-1} \right)+\Gamma \left( 1+{{\nu }_{2}}^{-1} \right) \right]}^{-1}}

-\infty < \mu < \infty, \tau > 0, \nu_1 > 0, \nu_2 > 0

GMSNBurr: dgmsnburr(mu, tau,alpha1,alpha2)

p(y) = \frac{\tau \omega \left( {{\alpha }_{1}},{{\alpha }_{2}} \right)}{B\left( {{\alpha }_{1}},{{\alpha }_{2}} \right)}{{\left( \frac{{{\alpha }_{2}}}{{{\alpha }_{1}}} \right)}^{{{\alpha }_{2}}}}\frac{\exp \left( -{{\alpha }_{2}}\tau \omega \left( {{\alpha }_{1}},{{\alpha }_{2}} \right)\left( y-\mu \right) \right)}{{{\left( 1+\frac{{{\alpha }_{2}}}{{{\alpha }_{1}}}\exp \left( -\tau \omega \left( {{\alpha }_{1}},{{\alpha }_{2}} \right)\left( y-\mu \right) \right) \right)}^{({{\alpha }_{1}}+{{\alpha }_{2}})}}}

where

{\omega \left( {{\alpha }_{1}},{{\alpha }_{2}} \right)=\frac{B\left( {{\alpha }_{1}},{{\alpha }_{2}} \right)}{\sqrt{2\pi }}{{\left( 1+\frac{{{\alpha }_{2}}}{{{\alpha }_{1}}} \right)}^{\left( {{\alpha }_{1}}+{{\alpha }_{2}} \right)}}{{\left( \frac{{{\alpha }_{2}}}{{{\alpha }_{1}}} \right)}^{-{{\alpha }_{2}}}}}{\omega \left( {{\alpha }_{1}},{{\alpha }_{2}} \right)=\frac{B\left( {{\alpha }_{1}},{{\alpha }_{2}} \right)}{\sqrt{2\pi }}{{\left( 1+\frac{{{\alpha }_{2}}}{{{\alpha }_{1}}} \right)}^{\left( {{\alpha }_{1}}+{{\alpha }_{2}} \right)}}{{\left( \frac{{{\alpha }_{2}}}{{{\alpha }_{1}}} \right)}^{-{{\alpha }_{2}}}}}

-\infty < \mu < \infty, \tau > 0, \alpha_1 > 0, \alpha_2 > 0

MSNBurr: dmsnburr(mu, tau,alpha)

p(y) = \frac{\tau \omega (\alpha )\exp \left( -\tau \omega (\alpha )(y-\mu ) \right)}{{{\left( 1+\frac{\exp \left( -\tau \omega (\alpha )(y-\mu ) \right)}{\alpha } \right)}^{\left( \alpha +1 \right)}}}

where

{\omega \left( \alpha \right)=\frac{1}{\sqrt{2\pi }}{{\left( 1+\frac{1}{\alpha } \right)}^{\left( \alpha +1 \right)}}}{\omega \left( \alpha \right)=\frac{1}{\sqrt{2\pi }}{{\left( 1+\frac{1}{\alpha } \right)}^{\left( \alpha +1 \right)}}}

- \infty < \mu < \infty , \tau > 0, \alpha > 0

MSNBurr-IIa: dmsnburr2a(mu, tau, alpha)

p(y) = \frac{\tau \omega (\alpha )\exp \left( \tau \omega (\alpha )\left( y-\mu \right) \right)}{{{\left( 1+\frac{\exp \left( \tau \omega (\alpha )\left( y-\mu \right) \right)}{\alpha } \right)}^{\left( \alpha +1 \right)}}}

-\infty < \mu < \infty , \tau > 0, \alpha > 0

Fernandez-Osiewalski-Steel Skew Exponential Power: dfskew.ep(mu, tau, nu, alpha)

For y<\mu:

p(y) = c\sqrt{\tau }\exp \left[ -\frac{1}{2}{{\left| \alpha \sqrt{\tau }\left( y-\mu \right) \right|}^{\nu }} \right]

For y \ge \mu:

p(y) = c\sqrt{\tau }\exp \left[ -\frac{1}{2}{{\left| \frac{\sqrt{\tau }\left( y-\mu \right)}{\alpha } \right|}^{\nu }} \right]

where

c = \alpha \nu {{\left[ \left( 1+{{\alpha }^{2}} \right){{2}^{1/\tau }}\Gamma (1/\nu ) \right]}^{-1}}

-\infty < \mu < \infty , \tau > 0 , \nu > 0 , \alpha > 0

Fernandes Steel Skew-t: dfskew.t(mu, tau, nu, alpha)

For y<\mu:

p(y) = c\sqrt{\tau }{{\left( 1+\frac{{{\alpha }^{2}}\tau {{(y-\mu )}^{2}}}{\nu } \right)}^{-(\nu +1)/2}}

For y \ge \mu:

p(y) = c\sqrt{\tau }{{\left( 1+\frac{\tau {{(y-\mu )}^{2}}}{{{\alpha }^{2}}\nu } \right)}^{-(\nu +1)/2}}

where

c = 2\alpha {{\left[ \left( 1+{{\alpha }^{2}} \right)B(1/2,\nu /2){{\nu }^{1/2}} \right]}^{-1}}

-\infty < \mu < \infty , \tau > 0 , \nu > 0 , \alpha > 0

Fernandes Steel Skew Normal: dfskew.norm(mu, tau, alpha)

For y<\mu:

p(y) = \frac{2\alpha \sqrt{\tau }}{\sqrt{2\pi }(1+{{\alpha }^{2}})}{\exp}\left( -\frac{{{\alpha }^{2}}\tau }{2}{{(y-\mu )}^{2}} \right)

For y \ge \mu:

p(y) = \frac{2\alpha \sqrt{\tau }}{\sqrt{2\pi }(1+{{\alpha }^{2}})}{\exp}\left( -\frac{\tau }{2{{\alpha }^{2}}}{{(y-\mu )}^{2}} \right)

-\infty < \mu < \infty, \tau > 0, \alpha > 0

Lunetta Exponential Power : dlep(mu, tau, nu)

p(y) = \frac{\sqrt{\tau }}{2{{\nu }^{1/\nu }}\Gamma (1+1/\nu )}{{e}^{-\frac{1}{\nu }{{\left| \sqrt{\tau }(y-\mu ) \right|}^{\nu }}}}

-\infty < \mu < \infty, \tau > 0, \nu > 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

Choir, A. S. 2020. The New Neo-Normal Distributions and Their Properties, Doctoral dissertation, Institut Teknologi Sepuluh November.

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.

Fernandez, C., Osiewalski, J., & Steel, M. F. 1995. Modeling and inference with v-spherical distributions. Journal of the American Statistical Association, 90(432), 1331-1340.

Fernandez, C., & Steel, M. F. 1998. On Bayesian modeling of fat tails and skewness. Journal of the american statistical association, 93(441), 359-371.

Iriawan, N. 2000. Computationally Intensive Approaches to Inference in NeoNormal Linear Models, Doctoral dissertation, Curtin University of Technology, Perth, Australia.

Rigby, R. A., & Stasinopoulos, D. M. 2005. Generalized additive models for location, scale and shape. Journal of the Royal Statistical Society: Series C (Applied Statistics), 54(3), 507-554.

Lunetta, G. 1963. Di una Generalizzazione dello Schema della Curva Normale. Annali della Facolt'a di Economia e Commercio di Palermo, 17, 237–244.

Rigby, R. A., Stasinopoulos, M. D., Heller, G. Z., & Bastiani, F. D. 2019. Distributions for Modeling Location, Scale, and Shape: Using GAMLSS in R. CLC Press.

See Also

runjags-class, load.module

Examples

# Load the module for use with any rjags model:
available <- neojags::load.neojagsmodule(fail=FALSE)
if(available){
# A simple model to sample from a Jones's Skew Exponential Power Distribution distribution.
# (Requires the rjags or rjparallel methods)
m <- "model{
 L ~ djskew.ep(0,1,2,2)
		}"

library(runjags)
neojags::load.neojagsmodule()
results <- run.jags(m, monitor="L", method="rjags")

}

[Package neojags version 0.1.4 Index]