API Reference

This page provides a detailed API reference for the conditional independence tests available in citk.

Simple CI Tests

These are classical statistical methods for conditional independence testing.

class citk.tests.FisherZ(data: ndarray, **kwargs)

Bases: CITKTest

This class is a wrapper around the fisherz test from the causal-learn library.

Parameters:

data (np.ndarray) – The dataset from which to run the test.

supported_dtypes = {'continuous'}
class citk.tests.Spearman(data: ndarray, **kwargs)

Bases: CITKTest

This class is a wrapper around the fisherz test from the causal-learn library on ranked data.

Parameters:

data (np.ndarray) – The dataset from which to run the test.

supported_dtypes = {'continuous'}
class citk.tests.ChiSq(data, **kwargs)

Bases: CITKTest

This class is a wrapper around the chisq test from the causal-learn library.

Parameters:

data (np.ndarray) – The dataset from which to run the test.

supported_dtypes = {'discrete'}
class citk.tests.GSq(data, **kwargs)

Bases: CITKTest

This class is a wrapper around the gsq test from the causal-learn library.

Parameters:

data (np.ndarray) – The dataset from which to run the test.

supported_dtypes = {'discrete'}

Regression-Based Tests

These tests use regression-based formulations for conditional independence.

class citk.tests.RegressionCI(data: ndarray, **kwargs)

Bases: _TigramiteBase

class_candidates: List[str] = ['tigramite.independence_tests.regressionCI.RegressionCI']
method_name = 'regci'

Nearest Neighbor Tests

class citk.tests.CMIknn(data: ndarray, **kwargs)

Bases: _TigramiteBase

class_candidates: List[str] = ['tigramite.independence_tests.cmiknn.CMIknn']
method_name = 'cmiknn'
class citk.tests.CMIknnMixed(data: ndarray, **kwargs)

Bases: _TigramiteBase

class_candidates: List[str] = ['tigramite.independence_tests.cmiknn.CMIknnMixed', 'tigramite.independence_tests.cmiknn_mixed.CMIknnMixed']
method_name = 'cmiknn_mixed'
class citk.tests.MCMIknn(data: ndarray, **kwargs)

Bases: CITKTest

supported_dtypes = {'continuous', 'discrete'}

Kernel Tests

class citk.tests.RCoT(data: ndarray, **kwargs)

Bases: _RCITBase

method_name = 'rcot'
rcit_func_name = 'RCoT'
class citk.tests.RCIT(data: ndarray, **kwargs)

Bases: _RCITBase

method_name = 'rcit'
rcit_func_name = 'RCIT'

Machine Learning-Based Tests

These tests leverage machine learning models to detect complex, non-linear conditional dependencies.

class citk.tests.KCI(data, **kwargs)

Bases: CITKTest

Wrapper for the Kernel Conditional Independence (KCI) test from the causal-learn library.

Parameters:
  • data (np.ndarray) – The dataset from which to run the test.

  • **kwargs (dict) – Additional keywords for the KCI test. See causal-learn documentation.

supported_dtypes = {'continuous'}
class citk.tests.RandomForest(data: ndarray, **kwargs)

Bases: CITKTest

Performs a conditional independence test using Random Forest feature importance.

Parameters:
  • data (np.ndarray) – The dataset from which to run the test.

  • n_estimators (int, optional) – The number of trees in the forest.

  • num_permutations (int, optional) – The number of permutations to perform for the permutation test.

  • random_state (int, optional) – Seed for the random number generator for reproducibility.

supported_dtypes = {'continuous', 'discrete'}
class citk.tests.DML(data: ndarray, **kwargs)

Bases: CITKTest

Double-ML based conditional independence test.

Parameters:
  • data (np.ndarray) – The dataset from which to run the test.

  • model (scikit-learn compatible regressor, optional) – The model used to predict X from Z and Y from Z. Defaults to HistGradientBoostingRegressor.

  • cv_folds (int, optional) – The number of folds for cross-fitting.

  • n_perms (int, optional) – Deprecated. Kept for backward compatibility.

supported_dtypes = {'continuous'}
class citk.tests.CRIT(data: ndarray, **kwargs)

Bases: CITKTest

Conformalized Residual Independence Test (CRIT).

Parameters:
  • data (np.ndarray) – The dataset from which to run the test.

  • alpha (float, optional) – The significance level for the conformal prediction intervals.

  • cv_folds (int, optional) – The number of folds for cross-fitting.

  • n_perms (int, optional) – Deprecated. Kept for backward compatibility.

supported_dtypes = {'continuous'}
class citk.tests.EDML(data: ndarray, **kwargs)

Bases: CITKTest

E-Value Double-ML based conditional independence test.

Parameters:
  • data (np.ndarray) – The dataset from which to run the test.

  • model (scikit-learn compatible regressor, optional) – The model used to predict X from Z and Y from Z. Defaults to HistGradientBoostingRegressor.

  • cv_folds (int, optional) – The number of folds for cross-fitting the residual models.

  • betting_folds (int, optional) – The number of folds for the e-value betting mechanism.

supported_dtypes = {'continuous'}
class citk.tests.GCMLinear(data: ndarray, **kwargs)

Bases: CITKTest

supported_dtypes = {'continuous'}
class citk.tests.GCMRF(data: ndarray, **kwargs)

Bases: CITKTest

supported_dtypes = {'continuous'}
class citk.tests.WGCMRF(data: ndarray, **kwargs)

Bases: CITKTest

supported_dtypes = {'continuous'}

Adapter Tests

class citk.tests.DiscChiSq(data: ndarray, **kwargs)

Bases: CITKTest

supported_dtypes = {'continuous', 'discrete'}
class citk.tests.DiscGSq(data: ndarray, **kwargs)

Bases: CITKTest

supported_dtypes = {'continuous', 'discrete'}
class citk.tests.DummyFisherZ(data: ndarray, **kwargs)

Bases: CITKTest

supported_dtypes = {'continuous', 'discrete'}
class citk.tests.HarteminkChiSq(data: ndarray, **kwargs)

Bases: CITKTest

supported_dtypes = {'continuous', 'discrete'}
class citk.tests.DCT(data: ndarray, **kwargs)

Bases: CITKTest

supported_dtypes = {'continuous', 'discrete'}