dSep {ggm} | R Documentation |
d-separation
Description
Determines if in a directed acyclic graph two set of nodes a d-separated by a third set of nodes.
Usage
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 |
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
|
second |
a vector representing another subset of nodes of the DAG.
The set |
cond |
a vector representing a conditioning subset of nodes.
The set |
Details
d-separation is a fundamental concept introduced by Pearl (1988).
Value
a logical value. TRUE
if first
and second
are d-separated
by cond
.
Author(s)
Giovanni M. Marchetti
References
Pearl, J. (1988). Probabilistic reasoning in intelligent systems. San Mateo: Morgan Kaufmann.
Lauritzen, S. (1996). Graphical models. Oxford: Clarendon Press.
See Also
DAG
, shipley.test
,
inducedCovGraph
Examples
## Conditioning on a transition node
dSep(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 node
dSep(DAG(y ~ x, z ~ x), first="y", second="z", cond = "x")
## Marginal independence
dSep(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"))