Skip to main content

Crate ci_core

Crate ci_core 

Source
Expand description

Core conditional independence tests for causal discovery.

Provides a collection of statistical tests for determining whether two variables X and Y are independent given a conditioning set Z (X ⊥ Y | Z).

§Tests

TestData typeModule
Chi-squaredDiscreteci_tests::ChiSquared
Log-likelihood (G-test)Discreteci_tests::LogLikelihood
Cressie-ReadDiscreteci_tests::CressieRead
Freeman-TukeyDiscreteci_tests::FreemanTukey
Modified log-likelihoodDiscreteci_tests::ModifiedLikelihood
Pearson correlationContinuousci_tests::PearsonCorrelation
Pearson equivalence (TOST)Continuousci_tests::PearsonEquivalence

§Usage

All tests implement the strategy::CITest trait. Construct a test, then call strategy::CITest::run_test with your data arrays.

use ci_core::ci_tests::ChiSquared;
use ci_core::strategy::CITest;
use ndarray::{array, Array2};

let test = ChiSquared { boolean: false, significance_level: 0.05 };
let x = array![1., 1., 2., 2.];
let y = array![1., 2., 1., 2.];
let z = Array2::zeros((0, 0)); // unconditional
let result = test.run_test(x, y, z).unwrap();

Modules§

ci_tests
strategy
utils