Skip to main content

Test whether two graphs are Markov equivalent

Source: R/identification.R, R/jlbind-wrappers.R

Description

Returns TRUE if cg1 and cg2 (both DAGs, or both MAGs) belong to the same Markov equivalence class, i.e. they impose the same (conditional-)independence constraints.

Usage

Arguments

cg1, cg2 Graphs to compare, created with cgraph(). Both must be DAGs, or both must be MAGs.

Details

For DAGs, this holds iff they share the same skeleton and the same set of v-structures (unshielded colliders a --> b <-- c with a, c non-adjacent) - the Verma-Pearl characterization. For MAGs, this holds iff they map to the same PAG.

Value

A logical scalar.

References

Verma T, Pearl J (1990). “Equivalence and synthesis of causal models.” In Proceedings of UAI 1990.

Ali RA, Richardson TS, Spirtes P (2009). “Markov equivalence for ancestral graphs.” Annals of Statistics, 37(5B), 2808–2837.

Examples

g1 <- cgraph(A %-->% B, C %-->% B)
g2 <- cgraph(A %-->% B, C %-->% B)
g3 <- cgraph(A %-->% B, B %-->% C)
markov_equivalent(g1, g2) # same skeleton and v-structures
#> [1] TRUE
markov_equivalent(g1, g3) # different v-structures
#> [1] FALSE