Skip to contents

Test whether two sets of nodes are m-separated given a conditioning set in an ADMG.

M-separation generalizes d-separation to ADMGs (Acyclic Directed Mixed Graphs).

Usage

m_separated(cg, x, y, z = character(0))

Arguments

cg

A caugi object of class ADMG or DAG.

x

A character vector of node names (the "source" set).

y

A character vector of node names (the "target" set).

z

A character vector of node names to condition on (default: empty).

Value

A logical value; TRUE if x and y are m-separated given z.

Examples

# Classic confounding example
cg <- caugi(
  L %-->% X,
  X %-->% Y,
  L %-->% Y,
  class = "ADMG"
)
m_separated(cg, "X", "Y") # FALSE (connected via L)
#> [1] FALSE
m_separated(cg, "X", "Y", "L") # TRUE (L blocks the path)
#> [1] FALSE