causal_networkx.ci.PartialCorrelation#

class causal_networkx.ci.PartialCorrelation(method='analytic', fixed_threshold=0.1, bootstrap_n_samples=1000, random_state=None, block_length=1, verbose=False)[source]#

Methods

compute_significance(val, array, n_samples, ...)

Compute pvalue of the partial correlation using bootstrap sampling.

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

Perform CI test of X, Y given optionally Z.

compute_significance(val, array, n_samples, n_dims, sig_override=None)[source]#

Compute pvalue of the partial correlation using bootstrap sampling.

Returns the p-value from whichever significance function is specified for this test. If an override is used, then it will call a different function then specified by self.significance

Parameters:

val : float

Test statistic value.

array : array_like

data array with X, Y, Z in rows and observations in columns

n_samples : int

Sample length

n_dims : int

Dimensionality, ie, number of features.

sig_override : str

Must be in ‘analytic’, ‘shuffle_test’, ‘fixed_thres’

Returns:

pval : float or numpy.nan

P-value.

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

Perform CI test of X, Y given optionally Z.

Parameters:

x : str | int

The first variable in the column of df.

y : str | int

The second variable in the column of df.

z : str | int

The conditioning dataset, by default None.