Package 'neojags'

Title: Neo-Normal Distributions Family for Markov Chain Monte Carlo (MCMC) Models in 'JAGS'
Description: A 'JAGS' extension module provides neo-normal distributions family including MSNBurr, MSNBurr-IIa, GMSNBurr, Lunetta Exponential Power, Fernandez-Steel Skew t, Fernandez-Steel Skew Normal, Fernandez-Osiewalski-Steel Skew Exponential Power, Jones Skew Exponential Power. References: Choir, A. S. (2020). "The New Neo-Normal Distributions and Their Properties".Unpublished Dissertation. Denwood, M.J. (2016) <doi:10.18637/jss.v071.i09>. Fernandez, C., Osiewalski, J., & Steel, M. F. (1995) <doi:10.1080/01621459.1995.10476637>. Fernandez, C., & Steel, M. F. (1998) <doi:10.1080/01621459.1998.10474117>. Iriawan, N. (2000). "Computationally Intensive Approaches to Inference in NeoNormal Linear Models".Unpublished Dissertation. Mineo, A., & Ruggieri, M. (2005) <doi:10.18637/jss.v012.i04>. Rigby, R. A., & Stasinopoulos, D. M. (2005) <doi:10.1111/j.1467-9876.2005.00510.x>. Lunetta, G. (1963). "Di una Generalizzazione dello Schema della Curva Normale". Rigby, R. A., Stasinopoulos, M. D., Heller, G. Z., & Bastiani, F. D. (2019) <doi:10.1201/9780429298547>.
Authors: Achmad Syahrul Choir [aut, cre], Resi Ramadani [aut], Nur Iriawan [aut], S Sifa'ul Khusna Malikhatul Mutmainah [ctb], Matthew Denwood [cph], Martyn Plummer [cph] (Copyright holder of the code in src/distributions/D*.*, configure.ac, R/runjags_functions.R, and original copyright holder of some modified code where indicated)
Maintainer: Achmad Syahrul Choir <[email protected]>
License: GPL-2
Version: 0.1.5
Built: 2024-11-10 06:45:28 UTC
Source: CRAN

Help Index


Load the internal JAGS module provided by neojags

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<μy<\mu:

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

For yμy \ge \mu:

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

where

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

<μ<,τ>0,ν1>0,ν2>0-\infty < \mu < \infty, \tau > 0, \nu_1 > 0, \nu_2 > 0

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

p(y)=τω(α1,α2)B(α1,α2)(α2α1)α2exp(α2τω(α1,α2)(yμ))(1+α2α1exp(τω(α1,α2)(yμ)))(α1+α2)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

ω(α1,α2)=B(α1,α2)2π(1+α2α1)(α1+α2)(α2α1)α2ω(α1,α2)=B(α1,α2)2π(1+α2α1)(α1+α2)(α2α1)α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}}}}}{\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}}}}}

<μ<,τ>0,α1>0,α2>0-\infty < \mu < \infty, \tau > 0, \alpha_1 > 0, \alpha_2 > 0

MSNBurr: dmsnburr(mu, tau,alpha)

p(y)=τω(α)exp(τω(α)(yμ))(1+exp(τω(α)(yμ))α)(α+1)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

ω(α)=12π(1+1α)(α+1)ω(α)=12π(1+1α)(α+1){\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)}}}

<μ<,τ>0,α>0- \infty < \mu < \infty , \tau > 0, \alpha > 0

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

p(y)=τω(α)exp(τω(α)(yμ))(1+exp(τω(α)(yμ))α)(α+1)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)}}}

<μ<,τ>0,α>0-\infty < \mu < \infty , \tau > 0, \alpha > 0

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

For y<μy<\mu:

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

For yμy \ge \mu:

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

where

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

<μ<,τ>0,ν>0,α>0-\infty < \mu < \infty , \tau > 0 , \nu > 0 , \alpha > 0

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

For y<μy<\mu:

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

For yμy \ge \mu:

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

where

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

<μ<,τ>0,ν>0,α>0-\infty < \mu < \infty , \tau > 0 , \nu > 0 , \alpha > 0

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

For y<μy<\mu:

p(y)=2ατ2π(1+α2)exp(α2τ2(yμ)2)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μy \ge \mu:

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

<μ<,τ>0,α>0-\infty < \mu < \infty, \tau > 0, \alpha > 0

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

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

<μ<,τ>0,ν>0-\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

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")

}