tfci: TFCI Algorithm for Causal Discovery

View source: R/tfci.R

tfciR Documentation

TFCI Algorithm for Causal Discovery

Description

Run the temporal FCI algorithm for causal discovery using causalDisco.

Usage

tfci(engine = c("causalDisco"), test, alpha = 0.05, ...)

Arguments

engine

Character; which engine to use. Must be one of:

"causalDisco"

causalDisco library.

test

Character; name of the conditional‐independence test.

alpha

Numeric; significance level for the CI tests.

...

Additional arguments passed to the chosen engine (e.g. test or algorithm parameters).

Details

For specific details on the supported tests, see CausalDiscoSearch. For additional parameters passed via ..., see tfci_run().

Recommendation

While it is possible to call the function returned directly with a data frame, we recommend using disco(). This provides a consistent interface and handles knowledge integration.

Value

A function that takes a single argument data (a data frame). When called, this function returns a list containing:

  • knowledge A Knowledge object with the background knowledge used in the causal discovery algorithm. See knowledge() for how to construct it.

  • caugi A caugi::caugi object representing the learned causal graph. This graph is a PAG (Partial Ancestral Graph), but since PAGs are not yet natively supported in caugi, it is currently stored with class UNKNOWN.

See Also

Other causal discovery algorithms: boss(), boss_fci(), fci(), ges(), gfci(), grasp(), grasp_fci(), gs(), iamb-family, pc(), sp_fci(), tges(), tpc()

Examples

data(tpc_example)

kn <- knowledge(
  tpc_example,
  tier(
    child ~ tidyselect::starts_with("child"),
    youth ~ tidyselect::starts_with("youth"),
    oldage ~ tidyselect::starts_with("oldage")
  )
)

# Recommended path using disco()
my_tfci <- tfci(engine = "causalDisco", test = "fisher_z", alpha = 0.05)

disco(tpc_example, my_tfci, knowledge = kn)

# or using my_tfci directly
my_tfci <- my_tfci |> set_knowledge(kn)
my_tfci(tpc_example)

# Also possible: using tfci_run()
tfci_run(tpc_example, test = cor_test, knowledge = kn)

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