Skip to contents

Apply a causal discovery method to a data frame to infer causal relationships on observational data. Supports multiple algorithms and optionally incorporates prior knowledge.

Usage

disco(data, method, knowledge = NULL)

Arguments

data

A data frame.

method

A disco_method object representing a causal discovery algorithm. Available methods are

knowledge

A Knowledge object to be incorporated into the causal discovery algorithm. If NULL (default), the causal discovery algorithm is run without background knowledge. See knowledge() for how to create a Knowledge object.

Value

A Disco object (a list) containing the following components:

  • knowledge A Knowledge object with the background knowledge used in the causal discovery algorithm.

  • caugi A caugi::caugi object representing the learned causal graph from the causal discovery algorithm.

Details

For specific details on the supported algorithms, scores, tests, and parameters for each engine, see:

Examples

data(tpc_example)

# use pc with engine bnlearn and test fisher_z
my_pc <- pc(engine = "bnlearn", test = "fisher_z", alpha = 0.01)
pc_bnlearn <- disco(data = tpc_example, method = my_pc)
plot(pc_bnlearn)


# define tiered background knowledge
kn <- knowledge(
  tpc_example,
  tier(
    child ~ starts_with("child"),
    youth ~ starts_with("youth"),
    old ~ starts_with("old")
  )
)

# use gs with engine bnlearn and test cor and tiered background knowledge
my_pc_tiered <- pc(engine = "bnlearn", test = "cor", alpha = 0.01)
pc_tiered_bnlearn <- disco(
  data = tpc_example,
  method = my_pc_tiered,
  knowledge = kn
)
plot(pc_tiered_bnlearn)