bayes.bn: Bayesian posterior parameter estimates.

Description Usage Arguments Details Value Examples

View source: R/param-bayes.R

Description

A wrapper around ml.

Usage

1
2
3
  ## S3 method for class 'bn'
 bayes(x, data, nodes = seq_along(x),
    prior = "bdeu", ...)

Arguments

x

The Bayesian Network. An object of class 'bn'

data

A data frame

nodes

A subset of 1, ..., nNodes(x). A numeric vector.

prior

Only "qi" is implemented at the moment

...

Further arguments, passed to ml

Details

This is the probability. This is also the expectation. See Neapolitean p379.

Value

As ml

Examples

1
2
3
4
5
6
7
8
9
d <- data.frame(
  a = factor(c(1, rep(3, 2), rep(1, 7))),
  b = factor(c(2, rep(1, 2), 3, 3, rep(2, 5))),
  c = factor(c(2, rep(2, 3), rep(1, 6))),
  d = factor(c(1:3, 2:3, 1, 1, 3:2, 2))
)

net <- bn(integer(0), integer(0), integer(0), c(1, 2, 3))
bayes(net, d, prior = "qi")

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