Compute the Bayes factor for two graph structures.
bf( num, den, bdgraph.obj, log =TRUE)
Arguments
num, den: adjacency matrix corresponding to the true graph structure in which aij=1 if there is a link between notes i and j, otherwise aij=0. It can be an object with S3 class "graph" from function graph.sim. It can be an object with S3 class "sim" from function bdgraph.sim.
bdgraph.obj: object of S3 class "bdgraph", from function bdgraph. It also can be an object of S3 class "ssgraph", from the function ssgraph::ssgraph() of R package ssgraph::ssgraph().
log: character value. If TRUE the Bayes factor is given as log(BF).
Returns
single numeric value, the Bayes factor of the two graph structures num and den.
References
Mohammadi, R. and Wit, E. C. (2019). BDgraph: An R Package for Bayesian Structure Learning in Graphical Models, Journal of Statistical Software, 89(3):1-30, tools:::Rd_expr_doi("10.18637/jss.v089.i03")
## Not run:# Generating multivariate normal data from a 'circle' graph data.sim <- bdgraph.sim( n =50, p =6, graph ="circle", vis =TRUE)# Running sampling algorithm bdgraph.obj <- bdgraph( data = data.sim ) graph_1 <- graph.sim( p =6, vis =TRUE) graph_2 <- graph.sim( p =6, vis =TRUE) bf( num = graph_1, den = graph_2, bdgraph.obj = bdgraph.obj )## End(Not run)