| disco | R Documentation |
Apply a causal discovery method to a data frame to infer causal relationships on observational data. Supports multiple algorithms and optionally incorporates prior knowledge.
disco(data, method, knowledge = NULL)
data |
A data frame. |
method |
A
|
knowledge |
A |
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.
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.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.