TBF_FCI#

class pymc_marketing.mmm.causal.TBF_FCI(target, *, target_edge_rule='any', bf_thresh=1.0, forbidden_edges=None, max_lag=2, allow_contemporaneous=True)[source]#

Target-first Bayes Factor Temporal PC.

This is a time-series–adapted version of TBF-PC. It combines ideas from temporal FCI/PCMCI with a Bayes-factor ΔBIC conditional independence test.

For each test \(X \perp Y \mid S\), compare:

\[\begin{split}M_0 : Y \sim S \\ M_1 : Y \sim S + X\end{split}\]

with BIC scores

\[\mathrm{BIC}(M) = n \log\!\left(\tfrac{\mathrm{RSS}}{n}\right) + k \log(n),\]

and Bayes factor approximation

\[\log \mathrm{BF}_{10} \approx -\tfrac{1}{2} \left[ \mathrm{BIC}(M_1) - \mathrm{BIC}(M_0) \right].\]

Declare independence if \(\mathrm{BF}_{10} < \tau\).

Parameters:
targetstr

Name of the target variable (at time t).

target_edge_rule{“any”, “conservative”, “fullS”}

Rule for keeping lagged → target edges.

bf_threshfloat, default=1.0

Declare independence if BF10 < bf_thresh.

forbidden_edgeslist of tuple[str, str], optional

Prior knowledge: edges to exclude.

max_lagint, default=2

Maximum lag to include (t-1, t-2, …).

allow_contemporaneousbool, default=True

Whether to allow contemporaneous edges at time t.

Methods

TBF_FCI.__init__(target, *[, ...])

Create a new temporal TBF-PC causal discovery model.

TBF_FCI.collapsed_summary()

Summarize lagged edges into a driver-level view.

TBF_FCI.fit(df, drivers)

Fit the temporal causal discovery algorithm to df.

TBF_FCI.get_directed_edges()

Return directed edges in the time-unrolled graph.

TBF_FCI.get_undirected_edges()

Return undirected edges in the time-unrolled graph.

TBF_FCI.summary()

Return a human-readable summary of edges and test count.

TBF_FCI.to_digraph([collapsed])

Export the learned graph as DOT text.