bf: Bayes factor for two graphs

View source: R/bf.R

bfR Documentation

Bayes factor for two graphs

Description

Compute the Bayes factor for two graph structures.

Usage

 
    bf( num, den, bdgraph.obj, log = TRUE ) 

Arguments

num, den

adjacency matrix corresponding to the true graph structure in which a_{ij}=1 if there is a link between notes i and j, otherwise a_{ij}=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).

Value

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

Author(s)

Reza Mohammadi a.mohammadi@uva.nl

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, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v089.i03")}

See Also

bdgraph, bdgraph.mpl, compare, bdgraph.sim

Examples

    ## 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)

BDgraph documentation built on Sept. 11, 2024, 5:30 p.m.