Abstract
Conditional independence testing is a fundamental problem underlying causal discovery and a particularly challenging task in the presence of nonlinear dependencies. Here we present a fully non-parametric test based on a nearest-neighbor estimator of conditional mutual information (CMI). By combining this estimator with a novel local permutation scheme, the method provides a robust way to determine if two variables are independent given a third, outperforming traditional kernel-based tests in calibration and power for small-to-medium datasets.
Introduction: The Challenge of Conditional Independence
Conditional independence (CI) testing—determining if $X \perp Y | Z$—is the "engine room" of causal discovery. Reliably proving that $X$ and $Y$ are independent once accounting for $Z$ allows researchers to rule out direct causal links. However, for continuous variables, this is notoriously difficult. Existing tests often assume linear relationships or rely on kernel methods that struggle with calibration in small samples ($N < 1,000$), require sensitive global hyperparameter tuning, and often fail to detect highly non-smooth or "wiggly" dependencies.
Methods: CMIknn and Local Permutations
The proposed CMIknn test addresses these issues through two primary innovations:
- Kozachenko-Leonenko k-NN Estimator: Instead of fixed-bandwidth kernels, CMIknn uses a $k$-nearest neighbor approach to estimate CMI. This method is locally adaptive; the neighborhood around a data point shrinks in dense regions and expands in sparse ones, significantly improving data efficiency.
- Local Permutation Scheme: To establish a null distribution, one must compare the observed CMI against a version of the data where $X$ and $Y$ are independent but their individual relationships with $Z$ are preserved. Standard global permutations destroy the $X-Z$ relationship, leading to false positives. CMIknn employs a local permutation scheme that only swaps $x$-values between points with very similar $z$-values, breaking the $X-Y$ link while maintaining the $X-Z$ dependency.
Key Results and Insights
The performance of CMIknn was evaluated against synthetic post-nonlinear models, oscillatory sinusoidal "stress tests," and real-world air quality data.
- Superior Calibration and Power: CMIknn demonstrated higher power in detecting real dependencies in lower dimensions compared to state-of-the-art kernel tests. Crucially, its p-value distributions were better calibrated, making it more trustworthy for small-to-medium datasets where analytical shortcuts in kernel methods often fail.
- Handling "Wiggly" Data: While kernel methods act as a blur filter that can smooth away high-frequency oscillations, the local nature of k-NN allows CMIknn to capture fine-grained patterns that other tests miss.
- Distributional Separation: The test effectively separates the CMI distributions under the null hypothesis ($H_0$) and the alternative hypothesis ($H_1$), allowing for clear statistical inference.
Discussion and Limitations
While CMIknn offers significant advantages in calibration and local adaptivity, it faces challenges as dimensionality increases. In high-dimensional conditioning sets ($D_Z > 10$), the "curse of dimensionality" makes k-NN neighborhoods less meaningful, potentially giving kernel methods an edge. Additionally, the reliance on permutation loops increases computational cost compared to analytical approximations. Future work aims to develop theoretical approximations for the CMI null distribution to enhance the method's scalability.
Summary updated