Skip to contents

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_graph object.

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

Value

Logical scalar.

See also

Examples

cg <- caugi_graph(
  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
#> [1] TRUE
d_separated(cg, "X", "Y", Z = NULL) # FALSE
#> [1] FALSE