udag2pdagSpecial {pcalg} | R Documentation |
This function extends a pcAlgo-object containing a skeleton and corresponding conditional independence information to a Partially Directed Acyclic Graph (PDAG). The result is a pcAlgo-object as well.
udag2pdagSpecial(gInput,verbose,n.max=100)
gInput |
pcAlgo-object containing skeleton and cond. ind. information |
verbose |
0: No output; 1: Details |
n.max |
Maximum number of tries for reontienting doubly visited edges. |
The skeleton is extended to a PDAG using rules by Spirtes and Pearl (see References). If, after orienting the v-structures, the graph is not extendible to a DAG, the following mechanisms try to solve the problem: There might be edges, that were oriented twice while forming colliders. In this case, try all possible combinations of reorientations and check whether any reorientation is extendible. Take the first one that is extendible and make no more than n.max tries. If this fails, the original graph is extended arbitrarily to a DAG that fits on the skeleton. v-structures might have changed. The resulting DAG is then transformed to its CPDAG.
pcObj |
Oriented pc-Object |
evisit |
Matrix counting the number of orientation attemps per edge |
xtbl.orig |
Is original graph with v-structure extendable |
xtbl |
Is final graph with v-structure extendable |
amat0 |
Adj.matrix of original graph with v-structures |
amat1 |
Adj.matrix of graph with v-structures after reorienting edges from double edge visits |
status |
0: original try is extendable; 1: reorienting double edge visits helps; 2: orig. try is not extendable; reorienting double visits don't help; result is acyclic, has orig. v-structures, but perhaps additional v-structures |
counter |
Number of reorientation tries until success or max.tries |
Markus Kalisch (kalisch@stat.math.ethz.ch)
P. Spirtes, C. Glymour and R. Scheines (2000) Causation, Prediction, and Search, 2nd edition, The MIT Press.
J. Pearl (2000), Causality, Cambridge University Press.
pdag2dag
, dag2cpdag
,
udag2pdag
, udag2pdagRelaxed
## simulate data set.seed(123) p <- 10 myDAG <- randomDAG(p, prob = 0.2) trueCPDAG <- dag2cpdag(myDAG) n <- 1000 d.mat <- rmvDAG(n, myDAG, errDist = "normal") ## estimate skeleton resU <- pcAlgo(d.mat, alpha = 0.05, corMethod = "standard",directed=FALSE) ## orient edges using three different methods resD1 <- udag2pdagRelaxed(resU,verbose=0) resD2 <- udag2pdagSpecial(resU,verbose=0,n.max=100) resD3 <- udag2pdag(resU,verbose=0)