## 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 <- skeleton(suffStat = list(C = cor(d.mat), n = n),
indepTest = gaussCItest, ## (partial correlations)
alpha = 0.05, p=p)
## orient edges using three different methods
resD1 <- udag2pdagRelaxed(resU, verbose=0)
resD2 <- udag2pdagSpecial(resU, verbose=0, n.max=100)
resD3 <- udag2pdag (resU, verbose=0)
Run the code above in your browser using DataLab