tests/test_shd.R

library(pcalg)
suppressWarnings(RNGversion("3.5.0"))
set.seed(123)

## expl 1
g1 <- randomDAG(5,0.5)
g2 <- randomDAG(5,0.5)
res1 <- (shd(g1,g2)==4)

## expl 2
g3 <- dag2cpdag(g1)
res2 <- (shd(g3,g1)==3)

if(!all(c(res1,res2))) {
  stop("Test of shd: Theoretical value not matched!")
}

Try the pcalg package in your browser

Any scripts or data that you put into this service are public.

pcalg documentation built on May 29, 2024, 5:24 a.m.