BNSamplerMJ: Mode-jumping MCMC sampler for Bayesian Networks.

Description Usage Arguments Value See Also

View source: R/mcmc-mj.R

Description

The sampler samples Bayesian Networks (ie models).

Usage

1
2
3
4
5
  BNSamplerMJ(data, initial, prior, return = "network",
    logScoreFUN = logScoreMultDirFUN(),
    logScoreParameters = list(hyperparameters = "bdeu"),
    constraint = NULL, modejumping = F, verbose = F,
    keepTape = F)

Arguments

data

The data.

initial

An object of class 'bn'. The starting value of the MCMC.

prior

A function that returns the prior score of the supplied bn.

return

Either "network" or "contingency".

logScoreFUN

A list of four elements:

offline

A function that computes the logScore of a Bayesian Network

online

A function that incrementally computes the logScore of a Bayesian Network

local

A function that computes the local logScore of a Bayesian Network

prepare

A function that prepares the data, and any further pre-computation required by the logScore functions.

For Multinomial-Dirichlet models, logScoreMultDirFUN returns the appropriate list; for Normal models with Zellner g-priors, logScoreNormalFUN returns the appropriate list.

logScoreParameters

A list of parameters that are passed to logScoreFUN.

constraint

A matrix of dimension ncol(data) x ncol(data) giving constraints to the sample space. The (i, j) element is:

1

if the edge i -> j is required

-1

if the edge i -> is excluded.

0

if the edge i -> j is not constrained.

The diagonal of constraint must be all 0.

modejumping

Either a logical of length 1, or a list. When no mode-jumping is desired, use modejumping = F. For mode-jumping, use a list with the following components:

modes

A bn.list of modes.

modesLogScores

Optionally, a numeric vector, containing the logScores of the modes.

checkModesAcyclic

A logical of length 1

modesPreFiltered

A logical of length 1

modeJumpingProbability

A numeric of length 1. Default 0.25

dontCheckModesValid

A logical of length 1

verbose

A logical of length 1, indicating whether verbose output should be printed.

keepTape

A logical of length 1, indicating whether a full log (tape) of the MCMC sampler should be kept. Enabling this option can be very memory-intensive.

Value

A function, which when called draws the next sample of the MCMC.

See Also

BNSampler, BNGibbsSampler, BNSamplerPT, BNSamplerGrzeg, BNSamplerBigFlips. Internally uses whichGraphsNotNeighbours


rjbgoudie/structmcmc documentation built on Nov. 3, 2020, 3:41 a.m.