mcmcposterior: Posterior distribution on Bayesian networks.

Description Usage Arguments Value See Also

View source: R/post.R

Description

Use MCMC to approximate the posterior distribution

Usage

1
2
3
4
5
6
7
  mcmcposterior(data, sampler = BNSampler,
    prior = priorUniform(initial),
    logScoreFUN = logScoreMultDirFUN(),
    logScoreParameters = list(hyperparameters = "bdeu"),
    constraint = NULL, maxNumberParents = NULL,
    nSamples = 50000, time = F, nBurnin = 10000,
    initial = empty(ncol(data), "bn"), verbose = T)

Arguments

data

The data.

sampler

A BNSampler. eg BNSampler or BNGibbsSampler etc

prior

A list of functions of the same length as initial that returns the local prior score of the corresponding node, given a numeric vector of parents. The default value NULL uses an improper uniform prior.

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.

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.

maxNumberParents

Integer of length 1. The maximum number of parents of any node.

nSamples

The number of samples to be draw. Set this to FALSE if using the time argument.

time

The number of seconds to spend drawing samples. Set this to FALSE if using the nSamples argument.

nBurnin

The number of samples to discard from the beginning of the sample.

initial

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

verbose

A logical. Should a progress bar be displayed?

Value

A bnpostmcmc object.

See Also

For more control, use the MCMC sampler directly, e.g. BNSampler. See also posterior. Example priors priorGraph, priorUniform.


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