= Conditional randomization test
A <conditional randomization test> tests $Y\mathrel\perp X\mid Z$ by resampling the tested variable from its conditional law given the remaining <covariates>. For independent sample rows, hold the observed $Y,Z$ fixed and draw each replacement vector $X^{(b)}$ from the true product conditional law of $X\mid Z$. Under the <null hypothesis>, the original $X$ and these replacements are conditionally <exchangeable>. Applying the same prespecified <test statistic> and fitting rule to every dataset therefore gives the valid rank-based <Monte Carlo test>
$$
p_B=\frac{1+\sum_{b=1}^B\mathbf1\{T(Y,X^{(b)},Z)\ge T(Y,X,Z)\}}{B+1}.
$$
The add-one convention and conservative <treatment> of ties give finite-sample <type I error> control. Other resampling constructions are possible when they preserve the same <conditional exchangeability>.<Fast and Powerful Conditional Randomization Testing via Distillation by Molei Liu and others>[Section 1.1, Algorithm 1 and Theorem 1]{ref}
Replacing the true conditional law by an estimate does not automatically preserve that guarantee. For a counterexample without $Z$, let the true $X$ be a fair <Bernoulli random variable> and let $Y$ be constant, so <independence> holds. If the resampling model incorrectly uses $P(X=1)=0.99$ and the <test statistic> is $T=1-X$, the model assigns upper-tail <probability> $0.01$ whenever the observed $X=0$. That event actually occurs with <probability> $0.5$, so the limiting simulation test rejects far more often than level $0.05$ permits.
Estimated conditional models require a separate calibration or approximation argument. More resamples reduce <Monte Carlo error> but do not correct a wrong conditional law. The method tests <conditional independence>; interpreting it as a <causal effect> test requires the appropriate additional <causal inference> assumptions.
Back to article page