bf: Bayes factor between two network structures

BFR Documentation

Bayes factor between two network structures


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


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


num, den

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


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


a character string, the label of a posterior network score or custom 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 not currently supported.


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


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


A single numeric value, the Bayes factor of the two network structures num and den.


The Bayes factor for two network structures, by definition, is the ratio of the respective marginal likelihoods which is equivalent to the ration of the corresponding posterior probabilities if we assume the uniform prior over all possible DAGs. However, note that it is possible to specify different priors using the “...” arguments of BF(); in that case the value returned by the function will not be the classic Bayes factor.


Marco Scutari

See Also

score, compare, bf.strength.



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)

bnlearn documentation built on May 29, 2024, 5:07 a.m.