Description Usage Arguments Value See Also Examples
Use one of a number of methods to get the posterior distribution.
1 2 3 4 5 6 7 | posterior(data, method = "mc3",
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)
|
data |
The data. |
method |
One of "exact", "mc3", "gibbs", "mj-mcmc". "mh-mcmc" is a synonym of "mc3". |
prior |
A list of functions of the same length as
|
logScoreFUN |
A list of four elements:
For
Multinomial-Dirichlet models,
|
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. Default value is left to
the MCMC sampler when |
nSamples |
The number of samples to be draw. Set
this to |
time |
The number of seconds to spend drawing
samples. Set this to |
nBurnin |
The number of samples to discard from the beginning of the sample. (Only applies to MCMC.) |
initial |
An object of class 'bn'. The starting value of the MCMC. (Only applies to MCMC.) |
verbose |
A logical. Should a progress bar be displayed? |
Either a bnpost
or a bnpostmcmc
object.
For more control, use the MCMC sampler directly, e.g.
BNSampler
. Example priors
priorGraph
, priorUniform
.
1 2 3 4 5 6 7 8 | x1 <- factor(c("a", "a", "g", "c", "c", "a", "g", "a", "a"))
x2 <- factor(c(2, 2, 4, 3, 1, 4, 4, 4, 1))
x3 <- factor(c(FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE))
x <- data.frame(x1 = x1, x2 = x2, x3 = x3)
set.seed(1234)
mcmc <- posterior(data = x, "mc3", nSamples = 500, nBurnin = 100)
ep(mcmc)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.