Skip to contents

Function to obtain the string that defines the default JAGS model for each data type

Usage

getModelString(
  label = c("binary", "binomial", "normal", "poisson", "tte"),
  hyperParams = list(binomial = c(`<priorA>` = "dunif(0, 10)", `<priorB>` =
    "dunif(0, 10)"), binary = c(`<priorA>` = "dunif(0, 10)", `<priorB>` =
    "dunif(0, 10)"), normal = c(`<priorMu0>` = "dnorm(0, 1e-06)", `<priorInvTau>` =
    "dgamma(1e-06, 1e-06)"), poisson = c(`<priorShape>` = "dgamma(1, 1)", `<priorScale>`
    = "dgamma(1, 1)"), tte = c(`<priorMu0>` = "dnorm(0, 1e-06)", `<priorInvTau>` =
    "dgamma(1e-06, 1e-06)")),
  prior = FALSE
)

Arguments

label

the type of model

hyperParams

a named list or named vector that defines how the placeholders in the model string are to be handled. See Usage Notes below.

prior

Boolean. Should the model for the prior be returned. Default: FALSE.

Value

a string defining the required model

Usage Notes

If hyperParams is a list, then the placeholder replacements are taken from hyperParams[[label]], which should be a named vector. Otherwise, the placeholder replacements are taken from hyperParams directly. Again, hyperParams should be a named vector. Once a named vector has been obtained from hyperParams, names of hyperParams define the placeholders and the replacements by the corresponding values.

For example, hyperParams has the value c("<priorA>"="dunif(0, 10)", "<priorB>"="dunif(0, 20)"), then where ever <priorA> is found in the model string, it is replaced by dunif(0, 10). Similarly, all occurrences of will be replaced bydunif(0, 20)`.

The default value of hyperParams provides the default hyperparameter values used by rbqmR's Bayes model fitting functions.

Usage notes

label is determined case insensitively

Examples

#To fit a binary model
binModel <- getModelString("binary")