Conditional Dependence Coefficient (CODEC)
- CODEC is a model-free, nonparametric coefficient that quantifies the conditional dependence of a response Y on Z given covariates X, with values ranging from 0 (independence) to 1 (perfect dependence).
- It employs ranks and nearest-neighbor graphs to construct a nonlinear generalization of partial R² without relying on parametric regression, density estimation, or tuning parameters.
- CODEC underpins applications like feature ordering (FOCI) and time-series lag identification, providing a robust and computationally efficient tool for variable selection and exploratory dependence analysis.
Searching arXiv for the cited CODEC papers and closely related work to ground the article in current literature. Conditional Dependence Coefficient (CODEC) usually denotes the Azadkia–Chatterjee coefficient for measuring the conditional dependence of a response on a variable given covariates . It is a model-free, nonparametric coefficient defined from an i.i.d. sample, takes values in , equals $0$ if and only if and are conditionally independent given , and equals $1$ if and only if is a measurable function of 0 given 1. The coefficient is commonly interpreted as a nonlinear generalization of partial 2, and its empirical implementation is built from ranks and nearest-neighbor graphs rather than parametric regression, density estimation, or tuning parameters (Azadkia et al., 2019).
1. Definition and statistical interpretation
Let 3 be a random variable, 4 a possibly vector-valued random variable, and 5 a vector of conditioning covariates. The population coefficient proposed by Azadkia and Chatterjee is
6
where 7 is the law of 8. When 9 is empty, the definition reduces to the unconditional dependence case (Azadkia et al., 2019).
The coefficient is normalized so that 0. Its extremal characterization is exact rather than approximate: 1 if and only if 2 and 3 are conditionally independent given 4, and 5 if and only if 6 is almost surely a measurable function of 7 given 8 (Azadkia et al., 2019).
For binary 9, the coefficient reduces to partial 0: 1 For general 2, the construction proceeds by thresholding 3 into the indicators 4, computing the corresponding partial 5 quantity for each threshold, and averaging over 6. This is the basis for the frequently used description of CODEC as a nonlinear generalization of partial 7 (Azadkia et al., 2019).
2. Empirical coefficient and computational structure
Given i.i.d. observations 8, the empirical CODEC statistic is defined through ranks and nearest neighbors. Let 9 be the rank of $0$0 among $0$1. Let $0$2 be the index of the nearest neighbor of $0$3 among the other $0$4, and let $0$5 be the index of the nearest neighbor of $0$6 among the other $0$7. The empirical coefficient is
$0$8
with the usual caveat that it is undefined if the denominator is zero (Azadkia et al., 2019).
This construction is fully non-parametric and requires no density estimation or tuning parameters. The dominant computational step is nearest-neighbor search, so the implementation can be carried out in $0$9 time. The same nearest-neighbor/rank structure is the basis of the subsequent asymptotic analysis in later work, where the empirical coefficient is often denoted 0 (Azadkia et al., 2019).
The computational design is central to CODEC’s practical identity. The statistic does not fit a regression model, estimate a conditional density, or choose a bandwidth. Instead, it measures the incremental information in 1 relative to 2 by comparing local neighborhoods in the 3-space and in the joint 4-space. This is why CODEC is often described as model-free and tuning-free in the variable-selection literature (Azadkia et al., 2019).
3. Fundamental properties and role in feature ordering
The population coefficient has a sharp list of structural properties. It lies in 5, detects conditional independence exactly at 6, and detects complete functional dependence exactly at 7. The empirical coefficient 8 is strongly consistent under no assumptions except non-degeneracy, namely that 9 is not almost surely a function of 0. Under mild smoothness conditions and tails not heavier than exponential, the paper also gives an explicit convergence rate (Azadkia et al., 2019).
A major application is Feature Ordering by Conditional Independence (FOCI). The algorithm starts with no selected variables, and at each step selects the variable maximizing
1
where 2 is the current selected set. It stops when adding a new variable fails to increase the coefficient above zero. In the formulation given by the authors, FOCI is model-free, has no tuning parameters, and is provably consistent under sparsity assumptions (Azadkia et al., 2019).
The significance of this construction is methodological rather than merely computational. CODEC supplies both a ranking criterion and a stopping rule. In the original discussion, this supports model-free variable selection in high-dimensional settings, after which a predictive model such as random forests may be fit on the reduced variable set. The same framework is also described as useful for learning conditional independence graphs, discovering Markov blankets, and causality screening (Azadkia et al., 2019).
4. Asymptotic inference, testing, and efficiency limits
Later theoretical work established asymptotic normality for the empirical Azadkia–Chatterjee coefficient under independence and resolved a conjecture of Azadkia and Chatterjee. For continuous random vectors, under conditional independence,
3
with an explicit asymptotic variance that is distribution-free and depends only on the dimension. The proofs rely on detailed combinatorial and geometric analysis of nearest-neighbor graphs, including mutual nearest-neighbor pairs and triplets (Shi et al., 2021).
The same paper studies CODEC within the Conditional Randomization Test (CRT) framework. In that setup, one resamples 4 from a conditional distribution 5, recomputes the empirical coefficient on the resampled data, and forms a CRT 6-value from the resampled statistics. The resulting test has finite-sample size control and is consistent against fixed alternatives, provided the number of randomizations tends to infinity (Shi et al., 2021).
A central point in the later literature is that consistency should not be conflated with statistical efficiency. The local power analysis in the same work shows that CRT procedures using the Azadkia–Chatterjee coefficient are inefficient under two families of local alternatives. Under parametric quadratic mean differentiable alternatives converging to the null at the 7 rate, the test is asymptotically powerless. Under nonparametric Hölder smooth alternatives with exponent 8, the test has power only when the signal is at least of strength 9, whereas the minimax rate for scalar covariates is 0. In this sense, CODEC-based CRT is consistent but statistically suboptimal for weak-signal testing (Shi et al., 2021).
5. Variants, analogues, and generalizations
Subsequent work places CODEC within a wider family of conditional dependence measures that preserve the same 1-to-2 calibration while altering the response type or the underlying discrepancy.
| Variant | Core construction | Notable property |
|---|---|---|
| CODEC 3 | Thresholded-response functional with rank/nearest-neighbor estimator | Nonlinear generalization of partial 4 |
| Categorical analogue 5 | 6 | Permutation invariance in labels of 7 |
| KPC 8 | Ratio of expected 9 discrepancies | CODEC appears as a special case |
For categorical responses, Hörmann and Strenger-Galvis introduced a dependence coefficient $1$0 between a categorical variable $1$1 and a general metric-space-valued variable $1$2, together with a conditional version
$1$3
when $1$4. This conditional coefficient satisfies analogues of the standard CODEC properties: it lies in $1$5, equals $1$6 if and only if $1$7 and $1$8 are conditionally independent given $1$9, equals 0 if and only if 1 for some measurable function 2, and is permutation invariant in the labels of 3. The authors explicitly describe it as an instance of the same general principle as CODEC, namely measuring the increase in predictability obtained by adding variables, but specialized to categorical outcomes and designed to avoid sensitivity to label ordering (Hörmann et al., 12 Sep 2025).
A more general kernel-based extension is the kernel partial correlation (KPC) coefficient,
4
KPC is defined for variables in general topological spaces, is 5 if and only if 6, and is 7 if and only if 8 is a measurable function of 9. The graph-based estimator can be computed in near-linear time, the RKHS-based estimator is also consistent, and the recent conditional dependence measure of Azadkia and Chatterjee can be viewed as a special case of this broader framework (Huang et al., 2020).
6. Applications and current scope
CODEC’s most established use is model-free variable selection, but later work has extended it to time-series lag identification. In that setting, a CODEC-based FOCI procedure ranks candidate lags of a univariate time series by first using marginal association and then conditional association given already selected lags. Extensive simulations across linear, nonlinear, stationary, nonstationary, seasonal, and heteroskedastic processes show that CODEC outperforms Pearson and Spearman correlation for lag identification in nonlinear and nonstationary settings, especially for large sample sizes, while Pearson performs better in purely linear models. On benchmark series such as sunspots, Canadian lynx, and airline passengers, the selected lag structures were reported to be consistent with those in the literature (Montaño et al., 7 Sep 2025).
This pattern clarifies the practical niche of CODEC. It is particularly useful when the relevant dependence may be nonlinear, non-monotonic, or only detectable after conditioning on previously selected variables. Its rank-based and nearest-neighbor construction makes it attractive for exploratory analysis when model specification is difficult or undesirable. At the same time, the later efficiency results indicate that strong model-free guarantees do not automatically imply optimal local testing performance. CODEC therefore occupies a specific place in the contemporary dependence-measure literature: a computationally efficient, tuning-free, and structurally interpretable coefficient that is especially valuable for ranking, screening, and exploratory conditional association analysis, but whose testing properties must be evaluated separately from its consistency and invariance guarantees (Azadkia et al., 2019).