Learn R Programming

caugi (version 1.0.0)

m_separated: M-separation test for AGs and ADMGs

Description

Test whether two sets of nodes are m-separated given a conditioning set in an ancestral graph (AG) or an ADMG.

M-separation generalizes d-separation to AGs/ADMGs and applies to DAGs.

Usage

m_separated(
  cg,
  X = NULL,
  Y = NULL,
  Z = NULL,
  X_index = NULL,
  Y_index = NULL,
  Z_index = NULL
)

Value

A logical value; TRUE if X and Y are m-separated given Z.

Arguments

cg

A caugi object of class AG, ADMG, or DAG.

X, Y, Z

Node selectors: character vector of names, unquoted expression (supports + and c()), or NULL. Use *_index to pass 1-based indices. If Z is NULL or missing, no nodes are conditioned on.

X_index, Y_index, Z_index

Optional numeric 1-based indices (exclusive with X,Y,Z respectively).

See Also

Other queries: ancestors(), anteriors(), children(), descendants(), districts(), edge_types(), edges(), exogenous(), is_acyclic(), is_admg(), is_ag(), is_caugi(), is_cpdag(), is_dag(), is_empty_caugi(), is_mag(), is_pdag(), is_ug(), markov_blanket(), neighbors(), nodes(), parents(), same_nodes(), spouses(), subgraph(), topological_sort()

Examples

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

Run the code above in your browser using DataLab