Description Usage Arguments Value Examples
Calculates the precision and recall (i.e., power) of the inferred graph.
| 1 | prerec(amInferred, amTrue, cutoff)
 | 
| amInferred | A baycn object or a posterior probability adjacency matrix. | 
| amTrue | The undirected adjacency matrix of the true graph. This will be a symmetric matrix with 0s along the diagonal. | 
| cutoff | A number between 0 and 1 indicating the posterior probability threshold for considering an edge present. | 
A list. The first element is the precision and the second element is the recall of the inferred graph.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | set.seed(5)
# Generate data from topology GN4.
data_gn4 <- simdata(graph = 'gn4',
                    N = 200,
                    b0 = 0,
                    ss = 1,
                    s = 1)
# Adjacency matrix for topology GN4 - all possible edges.
am_gn4 <- matrix(c(0, 1, 1, 1,
                   0, 0, 1, 1,
                   0, 0, 0, 1,
                   0, 0, 0, 0),
                 byrow = TRUE,
                 nrow = 4)
# Run baycn on the data from topology GN4.
baycn_gn4 <- mhEdge(data = data_gn4,
                    adjMatrix = am_gn4,
                    prior = c(0.05,
                              0.05,
                              0.9),
                    nCPh = 0,
                    nGV = 0,
                    pmr = FALSE,
                    iterations = 1000,
                    burnIn = 0.2,
                    thinTo = 500,
                    progress = FALSE)
# Adjacency matrix with the true edges for topology GN4.
am_gn4_true <- matrix(c(0, 1, 1, 0,
                        1, 0, 0, 1,
                        1, 0, 0, 1,
                        0, 1, 1, 0),
                      byrow = TRUE,
                      nrow = 4)
# Calculate the precision and recall.
prerec_gn4 <- prerec(amInferred = baycn_gn4,
                     amTrue = am_gn4_true,
                     cutoff = 0.4)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.