citk.tests.partial_correlation_tests¶
Partial-correlation CI tests (survey family): FisherZ, Spearman.
Both tests use a self-contained Schur-complement partial correlation
plus Fisher-Z transform — no causal-learn dependency. Each instance
satisfies the structural cbcd.CITest Protocol, so it can be passed
directly into cbcd.pc(data, ci_test=FisherZ(data)).
Classes¶
Module Contents¶
- class citk.tests.partial_correlation_tests.FisherZ(data: numpy.ndarray, **kwargs: Any)[source]¶
Bases:
citk.tests.base.CITKTestFisher-Z partial correlation test (continuous, Gaussian).
Native implementation; no causal-learn dependency. Compatible with cbcd via the structural
cbcd.CITestProtocol — pass an instance directly tocbcd.pc(data, ci_test=FisherZ(data)).Initialise the test and (optionally) load a JSON p-value cache.
- Parameters:
data – Sample matrix in shape
(n, p).cache_path – Optional path to a JSON cache file used to memoise p-values across calls. The cache is keyed by
(data_hash, method_name, parameters_hash)and stamped withformat_versionso v0.1.0 caches can be detected and invalidated by future releases.
- Raises:
TypeError – If
kwargscontains keys outsidecls.accepted_kwargsandcls._protocol_kwargs.
- details(X: int, Y: int, condition_set: list[int] | None = None, **kwargs: Any) citk.tests.base.CITKResult[source]¶
Return a structured
CITKResultfor one CI query.Default implementation calls
__call__()and wraps the float p-value in aCITKResult. Subclasses with richer diagnostics (test statistic, df, n_effective) can override to populate those fields. cbcd’s algorithms only read.p_valuefrom cached results, so this default is sufficient for cbcd interop.
- supported_dtypes¶
- class citk.tests.partial_correlation_tests.Spearman(data: numpy.ndarray, **kwargs: Any)[source]¶
Bases:
citk.tests.base.CITKTestSpearman partial correlation: Fisher-Z applied to ranked data.
Native implementation. Captures monotonic but non-linear dependence that vanilla Fisher-Z would miss.
Initialise the test and (optionally) load a JSON p-value cache.
- Parameters:
data – Sample matrix in shape
(n, p).cache_path – Optional path to a JSON cache file used to memoise p-values across calls. The cache is keyed by
(data_hash, method_name, parameters_hash)and stamped withformat_versionso v0.1.0 caches can be detected and invalidated by future releases.
- Raises:
TypeError – If
kwargscontains keys outsidecls.accepted_kwargsandcls._protocol_kwargs.
- details(X: int, Y: int, condition_set: list[int] | None = None, **kwargs: Any) citk.tests.base.CITKResult[source]¶
Return a structured
CITKResultfor one CI query.Default implementation calls
__call__()and wraps the float p-value in aCITKResult. Subclasses with richer diagnostics (test statistic, df, n_effective) can override to populate those fields. cbcd’s algorithms only read.p_valuefrom cached results, so this default is sufficient for cbcd interop.
- supported_dtypes¶