d_separated: Are X and Y d-separated given Z?

View source: R/adjustment.R

d_separatedR Documentation

Are X and Y d-separated given Z?

Description

Checks whether every node in X is d-separated from every node in Y given Z in a DAG.

Usage

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

Arguments

cg

A caugi object.

X, Y, Z

Character vectors of node names, 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).

Value

TRUE if d-separated, FALSE otherwise.

See Also

Other adjustment: adjustment_set(), all_adjustment_sets_admg(), all_backdoor_sets(), is_valid_adjustment_admg(), is_valid_backdoor(), minimal_separator()

Examples

cg <- caugi(
  C %-->% X,
  X %-->% F,
  X %-->% D,
  A %-->% X,
  A %-->% K,
  K %-->% Y,
  D %-->% Y,
  D %-->% G,
  Y %-->% H,
  class = "DAG"
)

d_separated(cg, "X", "Y", Z = c("A", "D")) # TRUE
d_separated(cg, "X", "Y", Z = NULL) # FALSE


caugi documentation built on Oct. 28, 2026, 1:07 a.m.