Expand description
Core conditional-independence tests for causal discovery.
Provides statistical tests for whether two variables X and Y are independent
given a conditioning set Z (X ⊥ Y | Z). Data is held in a dataset::Dataset
built once from named, typed columns; tests refer to variables by column
index and return a numeric strategy::CIResult.
§Tests
| Test | Data type | Module |
|---|---|---|
| Chi-squared (λ = 1) | Discrete | ci_tests::ChiSquared |
| Log-likelihood / G-test (λ = 0) | Discrete | ci_tests::LogLikelihood |
| Cressie-Read (λ = 2/3) | Discrete | ci_tests::CressieRead |
| Freeman-Tukey (λ = −1/2) | Discrete | ci_tests::FreemanTukey |
| Modified log-likelihood (λ = −1) | Discrete | ci_tests::ModifiedLikelihood |
| Pearson correlation | Continuous | ci_tests::PearsonCorrelation |
| Fisher-z | Continuous | ci_tests::FisherZ |
| Pearson equivalence (TOST) | Continuous | ci_tests::PearsonEquivalence |
| HSIC | Continuous | ci_tests::Hsic |
| KCI | Continuous | ci_tests::Kci |
| GCM (linear residuals) | Continuous | ci_tests::Gcm |
| Pillai’s trace (linear residuals) | Discrete, continuous, mixed | ci_tests::Pillai |
registry enumerates all twelve and constructs a default-configured one by
name.
§Usage
use fastcit_core::ci_tests::ChiSquared;
use fastcit_core::dataset::{ColumnKind, Dataset};
use fastcit_core::strategy::CITest;
let data = Dataset::from_columns(vec![
("x".into(), ColumnKind::Discrete, vec![1., 1., 2., 2.]),
("y".into(), ColumnKind::Discrete, vec![1., 2., 1., 2.]),
])
.unwrap();
let x = data.index_of("x").unwrap();
let y = data.index_of("y").unwrap();
let result = ChiSquared::new().test(&data, x, y, &[]).unwrap();
assert!(result.p_value > 0.0);Re-exports§
pub use dataset::ColumnKind;pub use dataset::Dataset;pub use error::CIError;pub use registry::all_metas;pub use registry::make_default;pub use strategy::validate_query;pub use strategy::CIResult;pub use strategy::CITest;pub use strategy::DataType;pub use strategy::IndependenceRule;pub use strategy::TestMeta;
Modules§
- ci_
tests - Concrete conditional-independence tests.
- dataset
- Data-bound container shared by every conditional-independence test.
- discrete
- Discrete contingency-table machinery operating on factorized
Datasetcodes. - error
- Error type for the conditional-independence core.
- kernel
- Kernel types and dense kernel-matrix helpers shared by HSIC and KCI.
- registry
- Registry of the built-in closed-form conditional-independence tests.
- strategy
- The data-bound conditional-independence test contract.