tests/testthat/helper-constraint-based-methods.R

# ──────────────────────────────────────────────────────────────────────────────
# Helpers for testing constraint-based methods (pc, fci) across engines
# ──────────────────────────────────────────────────────────────────────────────

method_registry_constraint <- list(
  pc = list(fn = pc, engines = c("tetrad", "pcalg", "bnlearn")),
  fci = list(fn = fci, engines = c("tetrad", "pcalg"))
)

method_args <- function(method_name, engine) {
  args <- list(test = "fisher_z", alpha = 0.05)
  if (engine == "pcalg") {
    args$directed_as_undirected_knowledge <- TRUE
  }
  args
}

toy_knowledge <- function(df) {
  knowledge(
    df,
    X1 %-->% X2,
    X3 %-->% Z
  )
}

Try the causalDisco package in your browser

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

causalDisco documentation built on April 13, 2026, 5:06 p.m.