causal_networkx.ci.Oracle#

class causal_networkx.ci.Oracle(graph)[source]#

Oracle conditional independence testing.

Used for unit testing and checking intuition.

Parameters:

graph : DAG | ADMG

The ground-truth causal graph.

Methods

test(df, x_var, y_var, z_covariates)

Conditional independence test given an oracle.

test(df, x_var, y_var, z_covariates)[source]#

Conditional independence test given an oracle.

Checks conditional independence between ‘x_var’ and ‘y_var’ given ‘z_covariates’ of variables using the causal graph as an oracle.

Parameters:

df : pd.DataFrame of shape (n_samples, n_variables)

The data matrix. Passed in for API consistency, but not used.

x_var : node

A node in the dataset.

y_var : node

A node in the dataset.

z_covariates : set

The set of variables to check that separates x_var and y_var.

Returns:

statistic : None

A return argument for the statistic.

pvalue : float

The pvalue. Return ‘1.0’ if not independent and ‘0.0’ if they are.

Examples using causal_networkx.ci.Oracle#