causal_networkx.ci.ParentChildOracle#
- class causal_networkx.ci.ParentChildOracle(graph)[source]#
Parent and children oracle for conditional independence testing.
An oracle that knows the definite parents and children of every node.
Methods
get_children
(x)Return the definite children of node 'x'.
get_parents
(x)Return the definite parents of node 'x'.
test
(df, x_var, y_var, z_covariates)Conditional independence test given an oracle.
- test(df, x_var, y_var, z_covariates)#
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.