In a DAG, CPDAG, MAG or PAG determine which nodes are (possible) descendants of x on definite status or just any paths potentially avoiding given nodes on the paths.
possDe(m, x, y = NULL, possible = TRUE, ds = TRUE,
type = c("cpdag", "pdag", "dag", "mag", "pag"))
Adjacency matrix in coding according to type.
Node positions of starting nodes.
Node positions of nodes through which a path must not go.
If TRUE
, possible descendents are returned.
If TRUE
, only paths of definite status are considered.
Type of adjacency matrix in m
. The coding is according to amatType
.
Vector of all node positions found as (possible) descendents of the nodes in x
.
Not all possible combinations of the arguments are currently implemented and will issue an error if called.
# NOT RUN {
## a -> b -- c
amat <- matrix(c(0,1,0, 0,0,1, 0,1,0), 3,3)
colnames(amat) <- rownames(amat) <- letters[1:3]
plot(as(t(amat), "graphNEL"))
possDe(m = amat, x = 1, possible = TRUE, ds = FALSE, type = "pdag") ## all nodes
possDe(m = amat, x = 1, possible = FALSE, ds = FALSE, type = "pdag") ## only nodes 1 and 2
possDe(m = amat, x = 1, y = 2, possible = TRUE, ds = FALSE, type = "pdag") ## only node 1
# }
Run the code above in your browser using DataLab