Description Usage Arguments Details Value Examples
View source: R/zero_est_graph.R
Returns if the DAGs corresponding to two adjacency matrices are Markov equivalent.
1 | DAG_eq(amat1, amat2)
|
amat1 |
The first adjacency matrix. |
amat2 |
The second adjacency matrix. |
First tests if amat1
and amat2
are two 2-d matrices of the same dimensions, then test whether they have the same CPDAG using pcalg::dag2cpdag()
.
A logical, whether the DAGs corresponding to two adjacency matrices are Markov equivalent.
1 2 3 4 5 6 | # Complete graphs of the same dimension are always Markov equivalent
DAG_eq(make_dag(10, "complete", shuffle=TRUE), make_dag(10, "complete", shuffle=TRUE))
# A v structure not Markov equivalent to a chain graph
DAG_eq(matrix(c(0,1,0, 0,0,0, 0,1,0), nrow=3, byrow=TRUE), make_dag(3, "chain"))
# Reversing a chain graphs gives a Markov equivalent graph
DAG_eq(make_dag(10, "chain"), make_dag(10, "chain")[10:1, 10:1])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.