Sampling Algorithms

Choice of Sampling Algorithm

When OpenBUGS starts up a file called
External
in Updater/Mod is processed. The modules implementing the sampling methods listed in this file are then loaded dynamically. Factory objects to create updater objects which use these methods are stored in an array (in the same order as in the file). The first factory object in this array is used to create updaters for all the stochastic nodes in the model that need updating and for which the associated sampling method is valid and wishes to create updaters. If there are any nodes which do not have updater objects created by this first factory the second factory is tried and so on. In this way only a single updater object is created for each node that needs sampling. If none of the factories are able to create an updater object for a node in the model that needs sampling an error is reported. It is the function of the factory to decide if its associated sampling method is valid for a particular node in the model. Factory objects associated with sampling algorithms listed at the start of the methods file can impose strict conditions on the node for which they are able to create an updater object. In general, algorithms at the start of the methods file do block updating of nodes. Users can develop special-purpose sampling algorithms and place them at the start of the methods file. Algorithms towards the end of the method file tend to be general-purpose (and somewhat less efficient) than earlier algorithms.

An algorithm might be commented out because it is less efficient than a competing algorithm, because it performs badly in some test situations, because it causes less efficient algorithms to be chosen for other nodes or because it has not been tested enough. Users are encouraged to try some of the commented out algorithms and to report their good and bad experiences.

The module UpdaterKrigparam is given as an example of a special purpose updater that will only be used for sampling the parameters of a kriging prior. The actual sampling algorithm used is the general purpose delayed single component adaptive Metropolis but the factory object only returns an updater object if the likelihood is a kriging prior.

Description of Sampling Algorithms

Here is an alphabetical list of install procedures for updaters that can be used followed by a brief note on how the algorithm works and what type of situation it is appropiate to.

**UpdaterAMblock.InstallGLM
**

Current point Metropolis type updater with delayed rejection and continously adapted multivariate normal proposal distribution. For a fixed effect block of nodes all of which have a logistic or log-linear conditional distribution. Non-Markov algorithm. Not currently used.

**UpdaterAMblock.InstallHetro
**

Current point Metropolis type updater with delayed rejection and continously adapted multivariate normal proposal distribution. For a fixed effect block of nodes the first element of which has a generic conditional distribution. Non-Markov algorithm. Not currently used.

**UpdaterAMblock.InstallHomo
**

Current point Metropolis type updater with delayed rejection and continously adapted multivariate normal proposal distribution. For a fixed effect block of nodes all of which have a generic conditional distribution. Non-Markov algorithm. Not currently used.

**UpdaterAMblock.InstallRE
**

Current point Metropolis type updater with delayed rejection and continously adapted multivariate normal proposal distribution. For a random effect block of nodes all of which have a logit or log-linear conditional distribution. Non-Markov algorithm. Not currently used.

**UpdaterAMNLLS.InstallMarginal
**

Continously adaptive block Metropolis algorithm for non-linear least squares problem with the measurement error precision integrated out.

**UpdaterAMNLLS.InstallCond
**

Continously adaptive block Metropolis algorithm for non-linear least squares problem.

**UpdaterBeta.Install
**

Gibbs type of updater for beta conditional distribution.

**UpdaterCatagorical.Install
**

Gibbs type of updater for univariate node which takes discrete values with a upper bound. Works by enumeration. Slow if many categories.

**UpdaterChain.Install
**

Updater for a node with chain graph prior. Works as a sequence of univariate updaters but can inpose a constraint such as the sum to zero constariant for CAR priors.

**UpdaterDescreteSlice.Install
**

Slice type sampler for discrete variable. Competes with UpdaterCatagorical if discrete variable has upper bound and with UpdaterMetbinomial if no upper bound.

**UpdaterDFreeHybrid.Install
**

Metropolis type of updater for a block of nodes which has a generic conditional distribution with unbounded support. Proposal distribution is based on integration of Hamilton's equations of classical mechanics. Derivatives of log likelihood are calculated numerically. Not currently used. There are three broad classes of updater: those that do Gibbs sampling, those that do Metropolis Hastings sampling and those that do slice sampling.

**UpdaterDirichlet.Install
**

Gibbs type of updater for a conditional distribution that is dirichlet.

**UpdaterDirichletprior.Install
**

Slice sampler type of updater for a conditional distribution that has a dirichlet prior but non conjugate likelihood.

**UpdaterForward.Install
**

Gibbs type of updater for univariate node which does not have any likelihood.

**UpdaterGamma.Install
**

Gibbs type of updater for gamma conditional distribution.

**UpdaterGLM.InstallGLM
**

Metropolis Hastings type updater for a block of nodes which have either a log-linear or logistic conditional distribution with unbounded support.

**UpdaterGLM.InstallNormal
**

Gibbs type of updater for multivariate conditional distribution where the prior is a set of univariate normal nodes. Not currently used.

**UpdaterGMRF.InstallGeneral
**

Current point block Metropolis algorithm for nodes with a Gaussian Markov Random Field prior. Can update large blocks. Also able to implement contsraints. Uses sparse matrix algebra (see Rue)

**UpdaterGriddy.Install
**

Independent Metropolis Hastings type updater for generic univariate distribution. Distribution must have bounded support. Builds a trapezoidal approximation to the conditional to use as the proposal. Slow algorithm. Not currently used, slice sampling is preferred but see note below about multimodality.

**UpdaterHybridglm.Install
** Updater for random effect block of nodes with normal prior and logit, log-linear or normal likelihood.

Metropolis type of updater for a block of nodes which has a normal, log-linear or logistic conditional distribution with unbounded support. Proposal distribution is based on integration of Hamiltons equations of classical mechanics. Used for random effects. Not currently used.

Current point Metropolis type updater for univariate node which takes discrete values with no upper bound.

Current point Metropolis type updater for generic univariate distribution with unbounded support. Uses a normal proposal distribution that is adapted during a tuning phase. Uses delayed rejection if first proposal is rejected.

Current point Metropolis type updater for generic univariate distribution with unbounded support. Uses a normal proposal distribution that is adapted during a tuning phase.

Independence Metropolis type of updater for a conditional distribution that has a multinomial prior.

As for UpdaterMVNormal.Install but the likelihood can have terms that are multivariate normal of a different dimension to the prior and the link function does not have to be the identity but can have a linear form.

Gibbs type of updater for multivariate normal conditional distribution where each term in the likelihood is either normal, log normal or multivariate normal of same dimension as the prior with a unit link function.

Gibbs type of updater for univariate normal conditional distribution.

Gibbs type of updater for pareto conditional distribution.

Gibbs type of updater for poisson prior with single binomial likelihood term having order equal to the prior.

Gibbs type of updater for univariate node with log-linear or logistic distribution and unbounded support.

Single component adaptive Metropolis algorithm that tunes the acceptance rate (see Roberts and Rosenthal).

Current point Metropolis type updater for generic univariate distribution with unbounded support. Uses a continously adapted normal proposal distribution. Non-Markov algorithm. Not currently used. Uses delayed rejection if first proposal rejected.

Current point Metropolis type updater for generic univariate distribution with bounded support. Uses a continously adapted normal proposal distribution. Non-Markov algorithm. Not currently used. Uses delayed rejection if first proposal rejected.

Current point Metropolis type updater for generic univariate distribution with unbounded support. Uses a continously adapted normal proposal distribution. Non-Markov algorithm. Not currently used.

Single component adaptive Metropolis algorithm that tunes the acceptance rate in a way that depends on the scale of the variable (see Roberts and Rosenthal).

UpdaterSlice.Install

Slice type of updater for generic univariate distribution. Uses stepping out search procedure to find the slice. Step length of search procedure adapted during tuning phase. Can miss modes for multimodal conditional distribution if the support is not bounded.

Gibbs type of updater for Wishart conditional distributions.