Skip to main content

ci_core/
lib.rs

1//! Core conditional independence tests for causal discovery.
2//!
3//! Provides a collection of statistical tests for determining whether two
4//! variables X and Y are independent given a conditioning set Z (X ⊥ Y | Z).
5//!
6//! # Tests
7//!
8//! | Test | Data type | Module |
9//! |------|-----------|--------|
10//! | Chi-squared | Discrete | [`ci_tests::ChiSquared`] |
11//! | Log-likelihood (G-test) | Discrete | [`ci_tests::LogLikelihood`] |
12//! | Cressie-Read | Discrete | [`ci_tests::CressieRead`] |
13//! | Freeman-Tukey | Discrete | [`ci_tests::FreemanTukey`] |
14//! | Modified log-likelihood | Discrete | [`ci_tests::ModifiedLikelihood`] |
15//! | Pearson correlation | Continuous | [`ci_tests::PearsonCorrelation`] |
16//! | Pearson equivalence (TOST) | Continuous | [`ci_tests::PearsonEquivalence`] |
17//!
18//! # Usage
19//!
20//! All tests implement the [`strategy::CITest`] trait. Construct a test,
21//! then call [`strategy::CITest::run_test`] with your data arrays.
22//!
23//! ```rust
24//! use ci_core::ci_tests::ChiSquared;
25//! use ci_core::strategy::CITest;
26//! use ndarray::{array, Array2};
27//!
28//! let test = ChiSquared { boolean: false, significance_level: 0.05 };
29//! let x = array![1., 1., 2., 2.];
30//! let y = array![1., 2., 1., 2.];
31//! let z = Array2::zeros((0, 0)); // unconditional
32//! let result = test.run_test(x, y, z).unwrap();
33//! ```
34
35pub mod ci_tests;
36pub mod strategy;
37pub mod utils;