Learn R Programming

causalDisco (version 1.0.1)

disco: Perform Causal Discovery

Description

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)

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.

Arguments

data

A data frame.

method

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

  • boss() - BOSS algorithm,

  • boss_fci() - BOSS-FCI algorithm,

  • fci() - FCI algorithm,

  • gfci() - GFCI algorithm,

  • ges() - GES algorithm,

  • grasp() - GRaSP algorithm,

  • grasp_fci() - GRaSP-FCI algorithm,

  • gs() - GS algorithm,

  • iamb(), iamb_fdr(), fast_iamb(), inter_iamb() - IAMB algorithms,

  • pc() - PC algorithm,

  • sp_fci() - SP-FCI algorithm,

  • tfci() - TFCI algorithm,

  • tges() - TGES algorithm,

  • tpc() - TPC algorithm.

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.

Details

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

  • BnlearnSearch for bnlearn,

  • CausalDiscoSearch for causalDisco,

  • PcalgSearch for pcalg,

  • TetradSearch for Tetrad.

Examples

Run this code
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)

Run the code above in your browser using DataLab