jagsOneBaseline: Defines a jags Bayesian model to fit a single baseline...

Description Usage Arguments Details Value

Description

This function takes some parameters and returns a jags model object as a character string for passing to jags.model.

Usage

1
2
jagsOneBaseline(muB = NULL, sigmaB = NULL, muDeltaN = NULL,
  sigmaDeltaN = NULL, sigma = NULL, TP = NULL, lambda = NULL, ...)

Arguments

muB

a distribution defining prior for mean (mu) of baseline. By default is dnorm(0, 0.0001).

sigmaB

a distribution defining sigma (standard deviation) of baseline. By default is dunif(0, 100).

muDeltaN

a distribution defining prior for the mean (mu) of deltaN. deltaN stands for trophic discrimination factor of Nitrogen. By default is dnorm(0, 0.0001).

sigmaDeltaN

a distribution defining sigma (standard deviation) of deltaN. By default is dunif(0, 100).

sigma

a value defining sigma (standard deviation) of baseline. By default is dunif(0, 100).

TP

a distribution defining prior of trophic position. By default is dunif(lambda, 10), with lambda = 2 if no defined before.

lambda

an integer indicating the trophic level of the baseline. Default is 2.

...

additional arguments passed to jagsOneBaseline.

Details

The single baseline trophic position model is defined as:

dNc = dNb + deltaN * (TP - lambda)

where dNc are d15N values of consumer, dNb1 are d15N values of baseline, deltaN is the trophic discrimination factor for N, TP is trophic position of the consumer and lambda is the trophic level of baseline. Furthermore, as a Bayesian approach, dNb, deltaN and dNc are defined as random parameters with a normal distribution with mean mu_i and precision tau_i, TP is a random parameter with a uniform distribution and lambda is a constant. All these distributions can be changed modifying them as priors, while defining lambda within the call to the function.

Although it is possible to use a number of predefined or customized distributions (see distribution aliases in JAGS documentation), it is likely that most of the time you will be using a normal distribution as prior for most parameters. This is the default option (i.e. when the function is called without arguments). To change it, you need to indicate a mean and standard deviation for the parameter of interest, for example "dnorm(0, 0.0001)". Here, a prior of normally distributed mu is defined, with a mean 0, and a standard deviation of 0.0001. This constitutes a normally distributed prior, although uninformative. You might want to change the mean and/or the standard deviation according to your prior knowledge of the system/consumer you are working on. As well as the priors for mu, JAGS uses "tau", which is the precision for defining the standard deviation of mu. Precision is a deterministic function (instead of the distributional "~"), and it is calculated as "tau <- power(sigma, -2)", thus you could define as well sigma_i, which stands for the standard deviation of the parameter of interest.

Value

A jags model (BUGS-language) as a character string


tRophicPosition documentation built on May 2, 2019, 4:15 a.m.