dSep | R Documentation |
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)
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 |
d-separation is a fundamental concept introduced by Pearl (1988).
a logical value. TRUE
if first
and second
are d-separated
by cond
.
Giovanni M. Marchetti
Pearl, J. (1988). Probabilistic reasoning in intelligent systems. San Mateo: Morgan Kaufmann.
Lauritzen, S. (1996). Graphical models. Oxford: Clarendon Press.
DAG
, shipley.test
,
inducedCovGraph
## 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"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.