  Conditional independence tests are crucial across various disciplines in
determining the independence of an outcome variable $Y$ from a treatment
variable $X$, conditioning on a set of confounders $Z$. The Conditional
Randomization Test (CRT) offers a powerful framework for such testing by
assuming known distributions of $X \mid Z$; it controls the Type-I error
exactly, allowing for the use of flexible, black-box test statistics. In
practice, testing for conditional independence often involves using data from a
source population to draw conclusions about a target population. This can be
challenging due to covariate shift -- differences in the distribution of $X$,
$Z$, and surrogate variables, which can affect the conditional distribution of
$Y \mid X, Z$ -- rendering traditional CRT approaches invalid. To address this
issue, we propose a novel Covariate Shift Corrected Pearson Chi-squared
Conditional Randomization (csPCR) test. This test adapts to covariate shifts by
integrating importance weights and employing the control variates method to
reduce variance in the test statistics and thus enhance power. Theoretically,
we establish that the csPCR test controls the Type-I error asymptotically.
Empirically, through simulation studies, we demonstrate that our method not
only maintains control over Type-I errors but also exhibits superior power,
confirming its efficacy and practical utility in real-world scenarios where
covariate shifts are prevalent. Finally, we apply our methodology to a
real-world dataset to assess the impact of a COVID-19 treatment on the 90-day
mortality rate among patients.
