R Under development (unstable) (2024-02-05 r85863 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(pcalg) > suppressWarnings(RNGversion("3.5.0")) > > set.seed(123) > myDAG <- randomDAG(20, 0.3) > mcov <- trueCov(myDAG) > amat <- t(as(myDAG,"matrix")) > amat[which(amat!=0)] <- 1 > graphEst <- dag2cpdag(myDAG) > ## plot(graphEst) > amat.cpdag <- t(as(graphEst,"matrix")) > > stopifnot(sort(optAdjSet(amat,2,6))==c()) > > > stopifnot(pcalg:::isAmenable(amat.cpdag,5,16,type="cpdag")) > stopifnot(sort(optAdjSet(amat.cpdag,5,16))==c(1,2,3,4,6,7,8,11,13)) > stopifnot(optAdjSet(amat.cpdag,5,16)==optAdjSet(amat,5,16)) > > stopifnot(pcalg:::isAmenable(amat.cpdag,2,12,type="cpdag")) > stopifnot(sort(optAdjSet(amat.cpdag,2,12))==c(5,7)) > stopifnot(optAdjSet(amat.cpdag,2,12)==optAdjSet(amat,2,12)) > > stopifnot(optAdjSet(amat.cpdag,2,c(3,7,12))==optAdjSet(amat,2,12)) Not all nodes in Y are descendants of the nodes in X The algorithm will continue with the pruned Y= 12 . > > > proc.time() user system elapsed 1.25 0.10 1.36