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