Learn R Programming

bnlearn (version 5.2)

BF: Bayes factor between two network structures

Description

Compute the Bayes factor between the structures of two Bayesian networks.

Usage

BF(num, den, data, score, ..., log = TRUE)

Value

A single numeric value, the Bayes factor of the two network structures

num and den.

Arguments

num, den

two objects of class bn, corresponding to the numerator and the denominator models in the Bayes factor.

data

a data frame containing the data to be used to compute the Bayes factor.

score

a character string, the label of a posterior network score, a BIC scores or "custom-score" for the custom score. If none is specified, the default score is the Bayesian Dirichlet equivalent score ("bde") for discrete networks and the Bayesian Gaussian score ("bge") for Gaussian networks. Other kinds of Bayesian networks are currently supported by using their BIC score to approximate their marginal log-likelihoods.

...

extra tuning arguments for the posterior scores. See score for details.

log

a boolean value. If TRUE, the Bayes factor is given as log(BF).

Author

Marco Scutari

See Also

score, compare, bf.strength.

Examples

Run this code
data(learning.test)

dag1 = model2network("[A][B][F][C|B][E|B][D|A:B:C]")
dag2 = model2network("[A][C][B|A][D|A][E|D][F|A:C:E]")
BF(dag1, dag2, learning.test, score = "bds", iss = 1)

Run the code above in your browser using DataLab