Determines if in a directed acyclic graph two set of nodes a d-separated by a third set of nodes.
dSep(amat, first, second, cond)
Arguments
amat: a Boolean matrix with dimnames, representing the adjacency matrix of a directed acyclic graph. The function does not check if this is the case. See the function isAcyclic.
first: a vector representing a subset of nodes of the DAG. The vector should be a character vector of the names of the variables matching the names of the nodes in rownames(A). It can be also a numeric vector of indices.
second: a vector representing another subset of nodes of the DAG. The set second must be disjoint from first. The mode of second must match the mode of first.
cond: a vector representing a conditioning subset of nodes. The set cond must be disjoint from the other two sets and must share the same mode.
Details
d-separation is a fundamental concept introduced by Pearl (1988).
Returns
a logical value. TRUE if first and second are d-separated by cond.
References
Pearl, J. (1988). Probabilistic reasoning in intelligent systems. San Mateo: Morgan Kaufmann.
Lauritzen, S. (1996). Graphical models. Oxford: Clarendon Press.
Author(s)
Giovanni M. Marchetti
See Also
DAG, shipley.test, inducedCovGraph
Examples
## Conditioning on a transition nodedSep(DAG(y ~ x, x ~ z), first="y", second="z", cond ="x")## Conditioning on a collision node (collider)dSep(DAG(y ~ x, y ~ z), first="x", second="z", cond ="y")## Conditioning on a source nodedSep(DAG(y ~ x, z ~ x), first="y", second="z", cond ="x")## Marginal independencedSep(DAG(y ~ x, y ~ z), first="x", second="z", cond =NULL)## The DAG defined on p.~47 of Lauritzen (1996)dag <- DAG(g ~ x, h ~ x+f, f ~ b, x ~ l+d, d ~ c, c ~ a, l ~ y, y ~ b)dSep(dag, first="a", second="b", cond=c("x","y"))dSep(dag, first="a", second=c("b","d"), cond=c("x","y"))