DAG_eq: Returns if the DAGs corresponding to two adjacency matrices...

Description Usage Arguments Details Value Examples

View source: R/zero_est_graph.R

Description

Returns if the DAGs corresponding to two adjacency matrices are Markov equivalent.

Usage

1
DAG_eq(amat1, amat2)

Arguments

amat1

The first adjacency matrix.

amat2

The second adjacency matrix.

Details

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().

Value

A logical, whether the DAGs corresponding to two adjacency matrices are Markov equivalent.

Examples

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

sqyu/ZiDAG documentation built on Jan. 19, 2021, 4:11 p.m.