pdag2dag {pcalg}R Documentation

Extend a PDAG to a DAG

Description

This function extends a PDAG to a DAG, if this is possible.

Usage

pdag2dag(g)

Arguments

g input PDGA (graph object)

Details

The PDAG is consistently extended using an algorithm by Dor and Tarsi (see References). If no extension is possible, a DAG corresponding to the skeleton of the PDAG is generated and a warning message is produced.

Value

List with two entries: "graph" contains consistent DAG extension (graph object) and "success" is TRUE iff the extension was possible.

Author(s)

Markus Kalisch (kalisch@stat.math.ethz.ch)

References

D.Dor, M.Tarsi, A simple algorithm to construct a consistent extension of a partially oriented graph, Technicial Report R-185, Cognitive Systems Laboratory, UCLA, 1992

See Also

udag2pdag,pdag2dag

Examples

p <- 10 # number of random variables
n <- 10000 # number of samples
s <- 0.4 # sparsness of the graph

## generate random data
set.seed(42)
g <- randomDAG(p,s) # generate a random DAG
d <- rmvDAG(n,g) # generate random samples

gSkel <- 
  pcAlgo(d,alpha=0.05) # estimate of the skeleton

gPDAG <- udag2pdag(gSkel)

gDAG <- pdag2dag(gPDAG@graph)

[Package pcalg version 0.1-7 Index]