CallJags: Gibbs Sampler

Description Usage Arguments Details Value

View source: R/CallJags.R

Description

This function can be used to perform Gibbs sampling using JAGS and the R-package rjags.

Usage

1
CallJags(y, prior = NULL, k = NULL)

Arguments

y

data

prior

an optional list of hyperparameters for prior distributions (See details how to define this list). Default is NULL.

k

optional value of how many normal components should be modeled. Default is NULL.

Details

This function is part of the TheBayesteApproach function of the ECOFFBayes package. It can be used to perform Gibbs sampling to sample the μ's and τ from the posterior distribution. Thereby, the priors of the μ's are assumed to be normal and the priors of τ's are assumed to be gamma distributions. To account for the binning, y is drawn from a truncated normal distribution. The data argument must be a flat vector of the binned non-resistant bacteria observations. The prior argument must be a list and specified as described in the function TheBayesteApproach. k is an optional parameter indicating the number of normal components. If the argument k is not defined by the user, the function assumes 20 components. In total 10000 draws are done where only each 10th draw is really taken (thinning = 10). A burnin period of 1000 iterations is automatically set. Finally, τ is converted to σ^2 and returned is a matrix of the Gibbs sampling draws with the μ, π, σ^2 and z.

Value

Returns a matrix which contains the Gibbs sampler iterations after thinning and deleting the burnin period. Columns include the estimated normal components parameters, the component probabilities and the classifications z for all observations.


sp2019-antibiotics/ECOFFBayes documentation built on Aug. 28, 2019, 6:06 p.m.