jags_model: Returns JAGS code for an specific model

View source: R/jags_model.R

jags_modelR Documentation

Returns JAGS code for an specific model

Description

jags_model() prints the code needed for model specification when using JAGS. The models and distribution options are quite general, so the user can grasp the structure of the code. However, this models are widely used without added complexity. Note that JAGS accepts a wide range of distributions for the likelihood parameter.

Usage

jags_model(likelihood, regression, param = F, reg = F)

Arguments

likelihood

Likelihood function. It accepts "dnorm", "dbinom", "dpois", and "dbern".

regression

A function accepting "linear", "logit", and "log" as part of the likelihood specification.

param

Logical with FALSE as default option. If TRUE, the prior distribution is previously specified as a character string using the same parameters as in the regression argument. If FALSE, the prior distribution is assumed to be normal.

reg

Logical with FALSE as default option. It only accepts a TRUE value if regression = "linear", and prints the formula for the mean and variance.

Details

There is a lot more flexibility for JAGS models than the ones specified. However, this is a general representation of the code one would use. Some other distribution examples can be found in jags_param.

Note that it only makes sense to use a linear regression with a normal likelihood, since the othe distributions are discrete distributions.

See Also

jags_param

Examples

jags_model("dnorm", "linear", param = FALSE, reg = TRUE)

mlebertheyl/myJpackage documentation built on May 18, 2022, 5:35 p.m.