udag2cpdag {pcalg}R Documentation

Extend a pcAlgo-object containing a skeleton to a CPDAG

Description

This function extends a pcAlgo-object containing a skeleton and corresponding conditional independence information to a Completed Partially Directed Acyclic Graph (CPDAG). The result is a pcAlgo-object as well.

Usage

udag2cpdag(pc)

Arguments

pc pcAlgo-object containing skeleton and cond. ind. information

Details

The skeleton is first extended to a PDAG using the function udag2pdag. Then, it is extended to a DAG using the functino pdag2dag and is then transferred to a CPDAG using the function dag2cpdag.

Value

A pcAlgo-object containing the CPDAG.

Author(s)

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

See Also

udag2pdag,pdag2dag,dag2cpdag

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
gCPDAG <- 
  udag2cpdag(gSkel) # transform skeleton to cpdag

plot(g)
plot(gSkel,zvalue.lwd=TRUE)
plot(gCPDAG,zvalue.lwd=TRUE)

[Package pcalg version 0.1-5 Index]