# NOT RUN {
set.seed(307)
## Plot some random DAGs
if (require(Rgraphviz)) {
## Topologically sorted random DAG
myDAG <- r.gauss.pardag(p = 10, prob = 0.2, top.sort = TRUE)
plot(myDAG)
## Unsorted DAG
myDAG <- r.gauss.pardag(p = 10, prob = 0.2, top.sort = FALSE)
plot(myDAG)
}
## Without normalization, edge weigths and error variances lie within the
## specified borders
set.seed(307)
myDAG <- r.gauss.pardag(p = 10, prob = 0.4,
lbe = 0.1, ube = 1, lbv = 0.5, ubv = 1.5, neg.coef = FALSE)
B <- myDAG$weight.mat()
V <- myDAG$err.var()
any((B > 0 & B < 0.1) | B > 1)
any(V < 0.5 | V > 1.5)
## After normalization, edge weights and error variances are not necessarily
## within the specified range, but the diagonal of the observational covariance
## matrix consists of ones only
set.seed(308)
myDAG <- r.gauss.pardag(p = 10, prob = 0.4, normalize = TRUE,
lbe = 0.1, ube = 1, lbv = 0.5, ubv = 1.5, neg.coef = FALSE)
B <- myDAG$weight.mat()
V <- myDAG$err.var()
any((B > 0 & B < 0.1) | B > 1)
any(V < 0.5 | V > 1.5)
diag(myDAG$cov.mat())
# }
Run the code above in your browser using DataLab