Conditional Testing based on Localized Conformal $p$-values

## Abstract

Abstract In this paper, we address conditional testing problems through the conformal inference framework. We define the localized conformal p 𝑝 p italic_p -values by inverting prediction intervals and prove their theoretical properties. These defined p 𝑝 p italic_p -values are then applied to several conditional testing problems to illustrate their practicality. Firstly, we propose a conditional outlier detection procedure to test for outliers in the conditional distribution with finite-sample false discovery rate (FDR) control. We also introduce a novel conditional label screening problem with the goal of screening multivariate response variables and propose a screening procedure to control the family-wise error rate (FWER). Finally, we consider the two-sample conditional distribution test and define a weighted U-statistic through the aggregation of localized p 𝑝 p italic_p -values. Numerical simulations and real-data examples validate the superior performance of our proposed strategies.

## 1 Introduction

Nowadays, conformal inference has become an increasingly popular framework for quantifying uncertainty of machine learning models. Suppose we have i.i.d. training data ${\mathcal{D}}_{1}=\{({\bf X}_{1i},Y_{1i})\}_{i=1}^{n}$ and test data ${\mathcal{D}}_{2}=\{({\bf X}_{2j},Y_{2j})\}_{j=1}^{m}$, where test responses $\{Y_{2j}\}_{j=1}^{m}$ are unobserved. The goal is to construct prediction intervals $\operatorname{PI}({\bf X}_{2j})$ for ${\bf X}_{2j}\in{\mathcal{D}}_{2}$ with marginal coverage guarantee

$$ $\Pr(Y_{2j}\in\operatorname{PI}({\bf X}_{2j}))\geq 1-\alpha.$ (1) $$

By sample splitting or cross-fitting, conformal prediction methods (Vovk et al., ) can be coupled with any machine learning algorithm to construct distribution-free prediction intervals with finite-sample coverage guarantee. However, the marginal coverage (1) alone is not sufficient for an efficient prediction interval. A marginally valid prediction interval could have a miscoverage rate much higher than $\alpha$ in some subgroups of the data. Therefore, the conditional coverage is also an important aspect:

$$ $\Pr(Y_{2j}\in\operatorname{PI}({\bf X}_{2j})\mid{\bf X}_{2j}={\bf x})\geq 1-\alpha.$ (2) $$

Although appealing, achieving (2) in a finite-sample and distribution-free context is impossible (Vovk, ). Recent works have proposed many methods to construct prediction intervals with approximate or asymptotic conditional coverage guarantee by either modifying the calibration step (Lei and Wasserman, ; Guan, ) or using different score functions (Romano et al., ; Chernozhukov et al., ).

In addition to prediction intervals, the conformal inference framework is also valuable for other inference problems. With a similar calibration procedure, the conformal $p$-value is defined to address various testing problems. This includes classical two-sample tests (Hu and Lei, ) and multiple testing problems such as outlier detection (Bates et al., ; Zhang et al., ) and data selection/sampling (Jin and Candès, ; Wu et al., ). Therefore, as a parallel development, our paper moves beyond conditional prediction intervals and defines conformal $p$-values tailored for conditional testing problems.

We define localized conformal $p$-values by leveraging recent works Guan () and Hore and Barber () which constructed prediction intervals to adapt to the conditional distribution of the response. We present some fundamental properties of our defined $p$-values and demonstrate why they can effectively resolve these problems. More importantly, we also consider several non-trivial applications of localized conformal $p$-values, encompassing various testing problems with different error criteria (e.g., FDR, FWER or type I error). We show that the proposed testing rule can ensure valid corresponding error rate control. Here we provide a brief overview of those problems and defer rigorous formulations to later sections.

- •
Conditional outlier detection: Outlyingness in data sets may come from various forms of heterogeneity. One of the important cases is that a few individuals in the test data do not share the same regression functions with majority (Peng et al., ). This amounts to detecting outliers in the functional relationship between the response and covariates that can be represented by the conditional distribution of $Y\mid{\bf X}$. This is common in many spatial or temporal contexts where the scale or variance of the response variable varies with location or time (Catterson et al., ).
- •
Two-sample conditional distribution test:
The goal is to test for equality of conditional distributions of $Y\mid{\bf X}$ between two samples (Hu and Lei, ). This is also known as the problem of comparison of regression curves (Dette and Neumeyer, ).
Some contemporary applications include assessing casuality by testing whether the conditional distribution of the response given the covariates remains the same between two samples (Bühlmann, ) and testing whether the pre-trained model can still perform well on a new test sample (Farahani et al., ).
- •
Conditional label screening: Consider a scenario where the response ${\bf Y}$ is multivariate. Our goal is to determine whether each component of the response satisfies a pre-specified rule for an unlabeled data point. For example, in the LLM factuality problem (Mohri and Hashimoto, ; Cherian et al., ) we have a vector of claims output by a LLM. It is desirable to screen out false claims to ensure reliability. In this example, the conditional performance of the screening procedure is important, which needs to be addressed properly to avoid extreme or imbalanced results.

### 1.1 Our contributions

In this article, building on Hore and Barber ()’s randomly localized conformal prediction interval, we construct localized conformal $p$-values,
study their theoretical properties, and apply them to several conditional testing problems. Our contributions to the applications are as follows:

- •
For the conditional outlier detection problem, we propose a detection procedure by utilizing the Benjamini-Hochberg (BH) procedure (Benjamini and Hochberg, ) and conditional calibration technique (Fithian and Lei, ). Our procedure controls the FDR in finite-sample.
- •
We elaborate a novel conditional label screening problem with rigorous formulation. We use the localized conformal $p$-value to construct a screening procedure with finite-sample marginal FWER control. We also present a conditional FWER inflation bound of our procedure to demonstrate its robustness against conditionality.
- •
We propose a U-statistic for the two-sample conditional distribution testing problem by aggregating the localized conformal $p$-values. The asymptotic normality of the test statistic under null and local alternatives is established.

We also validate our methods through simulations and real-data experiments. With commonly used prediction algorithms, our proposed methods exhibit superiority in terms of both validity and power compared to existing approaches.

### 1.2 Related works

Conformal inference was originally designed to construct prediction intervals and enjoy valid and distribution-free properties with the only assumption that the data are exchangeable. There have been several extensions to this framework. For example, Tibshirani et al. () proposed weighted conformal prediction for covariate shift settings, and Romano et al. () introduced conformalized quantile regression to account for heteroscedasticity. Other applications of the conformal inference framework include causal inference (Lei and Candès, ), selective inference (Bao et al., ), and survival analysis (Candès et al., ), among others.

Besides conformal inference, we also briefly review recent literature about our application problems.

- •
Outlier detection. Classical outlier detection methods include multivariate outlier detection methods that use model assumptions to identify outliers (Riani et al., ; Cerioli, ), and machine learning algorithms (Liu et al., ; Erfani et al., ). Most existing works on conditional outlier detection fall into these two categories (Song et al., ; Catterson et al., ; Hong and Hauskrecht, ). Recent studies have used the conformal inference framework to test for outliers with advanced machine learning models (Bates et al., ; Marandon et al., ; Liang et al., ). Although these methods ensure finite-sample FDR control, they focus primarily on marginal cases and do not address outlier detection in conditional distributions.
- •
Two-sample conditional distribution test. Most existing works focus on testing the equality of two conditional moments (Hall and Hart, ; Dette and Neumeyer, ), which is less stringent than testing for equality of distributions. A notable contribution is Hu and Lei (), which proposed a U-statistic based on the conformal inference framework by aggregating conformal $p$-values. Chen and Lei () improved this method by de-biasing the functions estimated using machine learning algorithms. Our porposed test statistic, a kernel-weighted U-statistic, is closely related to Hu and Lei () by aggregating localized conformal $p$-values instead.
- •
Data selection and subsampling. Our introduced label screening problem is similar to label-based data selection (Jin and Candès, , ; Rava et al., ) and subsampling problems (Wu et al., ). These works consider a semi-supervised setting where the selection or sampling rule is based on the value of the response variable. The key difference in our problem is that we focus on screening within the multivariate response vector for each data point, rather than selecting different data points from the unlabeled dataset. Additionally, existing works do not account for the conditional properties of their methods, which is the main concern of our paper.

### 1.3 Organization and notations

The remainder of this paper is organized as follows. We briefly review conformal inference and then give the definitions and theoretical properties of the localized conformal $p$-value in Section 2. In Section 3, we apply the proposed $p$-values to several conditional testing problems. Simulation and real-data experiments results for all three applications are displayed in Section 4 and Section 5. Finally, we conclude the article in Section 6 with some remarks.

Notations. The ${\mathbb{I}}\{\cdot\}$ is the indicator function and $\|\cdot\|_{2},\|\cdot\|_{\infty}$ are the $L_{2}$- and $L_{\infty}$-norm. The $[n]$ denotes the set $\{1,2,\dots,n\}$. The $\delta_{\bf z}$ denotes the point mass at value ${\bf z}$. The notation $Q(\alpha;P)$ denotes the $\alpha$-th quantile of distribution $P$. The subscripts of ${\mathbb{E}}$ and $\Pr$ indicate distributions of random variables in the expectations and probabilities.

## 2 Localized conformal p 𝑝 p italic_p -values

In this section, we first revisit the definition of the split conformal prediction and its localized extensions by Guan () and Hore and Barber () in Section 2.1. Then we propose the localized conformal $p$-values by inverting the localized prediction intervals in Section 2.2. At last we discuss basic properties of the defined $p$-values in Section 2.3.

### 2.1 Recap: conformal prediction and localization

We consider data pair $({\bf X},Y)\in{\mathcal{X}}\times{\mathcal{Y}}$. Suppose we have ${\mathcal{D}}_{1}=\{({\bf X}_{1i},Y_{1i})\}_{i=1}^{n}\sim P_{1}=P_{1,{\bf X}}
\times P_{1,Y\mid{\bf X}}$ and ${\mathcal{D}}_{2}=\{({\bf X}_{2j},Y_{2j})\}_{j=1}^{m}$ with each data point $({\bf X}_{2j},Y_{2j})\sim P_{2,j}=P_{2,{\bf X}}\times P_{2,j,Y\mid{\bf X}}$. In different problems, the responses $Y_{2j}$ of the second sample can be observed or unobserved.

In the classical split conformal prediction, ${\mathcal{D}}_{1}$ is divided into the training and calibration sets ${\mathcal{D}}_{1}={\mathcal{D}}_{\mathcal{T}}\cup{\mathcal{D}}_{\mathcal{C}}$ with index sets ${\mathcal{T}}\cup{\mathcal{C}}=\{1,2,\dots,n\}$. The training set ${\mathcal{D}}_{\mathcal{T}}$ is used to train a prediction function $\widehat{\mu}({\bf X})$ for the response $Y$ and construct a non-conformity function ${V}({\bf X},Y)$ which measures the similarity between the prediction and the true response. We then apply the score function to the calibration set ${\mathcal{D}}_{\mathcal{C}}$ to compute calibration scores $\{{V}_{1i}\}_{i\in{\mathcal{C}}}$ and obtain the quantile threshold

$$ $\widehat{q}_{\alpha}=Q\left(1-\alpha;\frac{1}{|{\mathcal{C}}|+1}\sum_{i\in{ \mathcal{C}}}\delta_{{V}_{1i}}+\frac{1}{|{\mathcal{C}}|+1}\delta_{\infty} \right).$ (3) $$

The split conformal prediction interval is defined as
$\operatorname{PI}({\bf X}_{2j})=\left\{y:{V}({\bf X}_{2j},y)\leq\widehat{q}_{
\alpha}\right\}.$
If ${\mathcal{D}}_{1}\cup\{({\bf X}_{2j},Y_{2j})\}$ are exchangeable, the prediction interval $\operatorname{PI}({\bf X}_{2j})$ is finite-sample valid in the sense that $\Pr(Y_{2j}\in\operatorname{PI}({\bf X}_{2j}))\geq 1-\alpha$.

However, calibrating marginally with (3) does not account for the local information of the test point. Guan () proposed the localized conformal prediction by calibrating with the quantile of a weighted empirical distribution

$$ $\widehat{q}_{\widehat{\alpha},{\rm L}}^{*}=Q\left(1-\widehat{\alpha};\sum_{i \in{\mathcal{C}}}H^{*}({\bf X}_{1i},{\bf X}_{2j})\delta_{{V}_{1i}}+H^{*}({\bf X }_{2j},{\bf X}_{2j})\delta_{\infty}\right),$ $$

where $H^{*}({\bf x},{\bf x}^{\prime})=\frac{H({\bf x},{\bf x}^{\prime})}{\sum_{k\in{
\mathcal{C}}}H({\bf X}_{1k},{\bf X}_{2j})+H({\bf X}_{2j},{\bf X}_{2j})}$ for some kernel function $H(\cdot,\cdot)$ characterizing the similarity between its two arguments. Here $\widehat{\alpha}$ is the adjusted level to guarantee finite-sample coverage. Despite its efficiency, the LCP method needs to compute the adjusted level $\widehat{\alpha}$, which is complex and computationally inefficient. As an improvement, Hore and Barber () proposed a randomization technique to circumvent level adjustment. Their method first samples $\tilde{\bf X}_{2j}$ from the distribution $H({\bf X}_{2j},\cdot)$, takes the threshold as

$$ $\widehat{q}_{\alpha,{\rm L}}=Q\left(1-\alpha;\sum_{i\in{\mathcal{C}}}\tilde{H} ^{*}({\bf X}_{1i},\tilde{\bf X}_{2j})\delta_{{V}_{1i}}+\tilde{H}^{*}({\bf X}_{ 2j},\tilde{\bf X}_{2j})\delta_{\infty}\right),$ $$

and define the prediction interval as

$$ $\displaystyle\operatorname{PI}_{\rm L}({\bf X}_{2j})=\left\{y:{V}({\bf X}_{2j} ,y)\leq\widehat{q}_{\alpha,{\rm L}}\right\},$ (4) $$

where $\tilde{H}^{*}({\bf x},{\bf x}^{\prime})=\frac{H({\bf x},{\bf x}^{\prime})}{
\sum_{k\in{\mathcal{C}}}H({\bf X}_{1k},\tilde{\bf X}_{2j})+H({\bf X}_{2j},
\tilde{\bf X}_{2j})}$. If $\{({\bf X}_{2j},Y_{2j})\}\cup{\mathcal{D}}_{1}$ are exchangeable, we can compute the density ratio of ${\bf X}_{2j}$ and ${\bf X}_{1i}$ conditional on $\tilde{\bf X}_{2j}$ as

$$ $\frac{{\rm d}P_{2,{\bf X}\mid\tilde{\bf X}_{2j}}}{{\rm d}P_{1,{\bf X}}}({\bf x })=\frac{f_{2,{\bf X}}({\bf x})H({\bf x},\tilde{\bf X}_{2j})}{f_{1,{\bf X}}({ \bf x})}=H({\bf x},\tilde{\bf X}_{2j}),$ $$

which exactly matches the weights in the empirical distribution. By the weighted exchangeability in Tibshirani et al. (), the randomly localized conformal prediction interval is finite-sample valid in the sense that

$$ $\Pr\left(Y_{2j}\in\operatorname{PI}_{\rm L}({\bf X}_{2j})\right)={\mathbb{E}} \left\{\Pr\left({V}({\bf X}_{2j},Y_{2j})\leq\widehat{q}_{\alpha,{\rm L}}\mid \tilde{\bf X}_{2j}\right)\right\}\geq 1-\alpha.$ $$

### 2.2 From prediction intervals to p 𝑝 p italic_p -values

Motivated by the capability of (randomly) localized conformal prediction to capture local information, we invert these prediction intervals to construct the localized conformal $p$-value. Due to its simplicity, we follow Hore and Barber () and take the randomization technique as in (4).

Let $H({\bf x},{\bf x}^{\prime})$ be a bi-variate kernel function with bandwidth $h$

$$ $H({\bf x},{\bf x}^{\prime})=\frac{1}{h^{d}}K\left(\frac{{\bf x}-{\bf x}^{ \prime}}{h}\right),$ $$

where $K(\cdot)$ is a kernel density function. Here $K(\cdot)$ can be taken as the Gaussian kernel, the box kernel or any other nonparametric kernel function as long as it is a symmetric density function.
Define the localized conformal $p$-value for $({\bf X}_{2j},Y_{2j})\in{\mathcal{D}}_{2}$ as

$$ $p_{{\rm L},j}=\frac{\sum_{i\in{\mathcal{C}}}H({\bf X}_{1i},\tilde{\bf X}_{2j}) {\mathbb{I}}\{{V}_{2j}\leq{V}_{1i}\}+\xi_{j}\cdot H({\bf X}_{2j},\tilde{\bf X} _{2j})}{\sum_{i\in{\mathcal{C}}}H({\bf X}_{1i},\tilde{\bf X}_{2j})+H({\bf X}_{ 2j},\tilde{\bf X}_{2j})},$ (5) $$

where $\xi_{j}\sim{\rm U}[0,1]$ is an independent random variable and $\tilde{\bf X}_{2j}$ is randomly sampled from density $H({\bf X}_{2j},\cdot)$. The non-conformity score ${V}$ may depend on both ${\bf X}$ and $Y$ or only on ${\bf X}$, contingent on the specific problem. The $p_{{\rm L},j}$ can be viewed as a localized counterpart of the conformal $p$-value investigated by Bates et al. () by using weighted empirical distributions. To simplify terminology, we will use CP and LCP to refer to the unweighted conformal $p$-value and our localized conformal $p$-value, respectively in the rest of the article. Since we do not discuss prediction intervals, this should not lead to confusion.

### 2.3 Basic properties

In this section we state some basic properties of the localized conformal $p$-value. The first property is its finite-sample validity.

###### Theorem 1 .

Under the condition $P_{1}=P_{2,j}$, the localized conformal $p$-value satisfies

$$ $\Pr(p_{{\rm L},j}\leq\alpha)\leq\alpha,\quad 0\leq\alpha\leq 1.$ $$

Furthermore, if the score ${V}({\bf X},Y)$ has a continuous distribution, then

$$ $\Pr(p_{{\rm L},j}\leq\alpha)=\alpha,\quad 0\leq\alpha\leq 1.$ $$

This theorem is a direct corollary of the weighted exchangeability of $\{({\bf X}_{2j},Y_{2j})\}\cup{\mathcal{C}}$ given $\tilde{\bf X}_{2j}$. By leveraging this property, the LCP can be used for multiple testing to guarantee finite-sample FDR or FWER control.

By the nature of the local-weighting scheme, the LCP can adapt to potential covariate shifts. The following theorem is an analog of the robustness result in Hore and Barber ().

###### Theorem 2 .

Under the condition $P_{1,Y\mid{\bf X}}=P_{2,j,Y\mid{\bf X}}$, denote the covariate density ratio as $g({\bf x}):=\frac{{\rm d}P_{2,{\bf X}}}{{\rm d}P_{1,{\bf X}}}(x)$. The LCP satisfies

$$ $\Pr(p_{{\rm L},j}\leq\alpha)\leq\alpha+\|f_{1,{\bf X}}\|_{\infty}{\mathbb{E}}_ {{\bf X}\sim P_{H,{\bf X}},{\bm{U}}\sim K(\cdot)}\left\{|g({\bf X}+h{\bm{U}})- g({\bf X})|\right\},$ $$

where the distribution $P_{H,{\bf X}}$ has a density function $f_{H,{\bf X}}({\bf x})={\mathbb{E}}_{{\bf X}\sim P_{1,{\bf X}}}\{H({\bf X},{
\bf x})\}$.

This theorem gives a deviation bound of the distribution of LCP from uniform distribution under covariate shift. The excess term will be small with a small $h$ when the density ratio function $g$ satisfies some regularity conditions. For example, if $g$ is Lipchitz continuous, the excess term will vanish as $h\to 0$. If we otherwise take $g$ as the normalized indicator of some fixed ${\mathcal{B}}\subset{\mathcal{X}}$, the excess term will also vanish, indicating the LCP is approximately valid conditional on any fixed subset ${\mathcal{B}}$.

As an indirect power characterization, the next theorem studies the point-wise limit of the LCP function which is defined as

$$ $p_{\rm L}({\bf x},y)=\frac{\sum_{i\in{\mathcal{C}}}H({\bf X}_{1i},\tilde{\bf X }){\mathbb{I}}\{{v}\leq{V}_{1i}\}+\xi\cdot H({\bf x},\tilde{\bf X})}{\sum_{i \in{\mathcal{C}}}H({\bf X}_{1i},\tilde{\bf X})+H({\bf x},\tilde{\bf X})},$ $$

where ${v}={V}({\bf x},y)$ and $\tilde{\bf X}$ is sampled from $H({\bf x},\cdot)$. With a score function $V$ chosen properly based on the specific problem, a larger score value $v$ will indicate stronger evidence against the pre-specified null hypothesis. Our defined $p$-value therefore reflects evidence against the null contained in a single data point. For the $p$-value to be powerful, the value of $p_{\rm L}({\bf X},Y)$ should be small if $({\bf X},Y)$ is sampled under the alternative.
Therefore, for a fixed score value $v$ under the alternative, we can regard a $p$-value function to be asymptotically more powerful than another if its limit function takes smaller value at $v$.

We need some regularity conditions which are commonly used in nonparametric estimations.

###### Assumption 1 .

The following conditions hold for $({\bf X},Y)\sim P_{1}$:

- •
${V}({\bf X},Y)$ has a continuous distribution with bounded density;
- •
The conditional distribution of the score ${V}={V}({\bf X},Y)$ satisfies
$\|F_{{V}\mid{\bf X}={\bf x}}({v})-F_{{V}\mid{\bf X}={\bf x}^{\prime}}({v})\|_{
\infty}\leq L\cdot\|{\bf x}-{\bf x}^{\prime}\|_{2}^{\beta}$
for some constant $L>0,0<\beta\leq 1$. That is, the conditional distribution function $F_{{V}\mid{\bf X}={\bf x}}$ varies smoothly with ${\bf x}$.
- •
The density function $f_{1,{\bf X}}({\bf x})$ is continuous, and the conditional density function $f_{1}(y\mid{\bf x})$ is continuous in ${\bf x}$.

###### Theorem 3 .

Assume Assumption 1 holds and the split ratio $|{\mathcal{C}}|/|{\mathcal{D}}_{1}|=\gamma$ for some constant $\gamma>0$, then the LCP function converges in probability

$$ $|p_{\rm L}({\bf x},y)-(1-F_{{V}\mid{\bf X}={\bf x}}({v}))|=O_{p}\left(\sqrt{h^ {2\beta}+\frac{1}{nh^{d}}}\right)$ $$

for any fixed $({\bf x},y)$, as $h\to 0,nh^{d}\to\infty$.

By the weak law of large number, the unweighted CP function satisfies

$$ $p_{{\rm CP}}({\bf x},y)=\frac{\sum_{i\in{\mathcal{C}}}{\mathbb{I}}\{{v}\leq{V} _{1i}\}+1}{|{\mathcal{C}}|+1}\stackrel{{\scriptstyle p}}{{\to}}1-F_{{V}}({v}),$ $$

where $F_{V}(\cdot)$ is the marginal distribution function of score $V$. If we take $h$ such that $h\to 0,nh^{d}\to\infty$, the LCP function converges to $1-F_{{V}\mid{\bf X}={\bf x}}(v)$ in probability. Comparing the power then amounts to comparing the value of $1-F_{{V}\mid{\bf X}={\bf x}}(v)$ and $1-F(v)$.
For a score value $v$ under the alternative, our conditional testing problem can generally ensure a uniformly small value of $1-F_{V\mid{\bf X}={\bf x}}(v)$ since the signal lies in the deviation of the conditional distribution. In contrast, the value of $1-F_{V}(v)$ could be quite large for $({\bf x},y)$ pairs with a small conditional scale $V\mid{\bf X}={\bf x}$, even if these pairs are sampled under the alternative. Although not uniformly more powerful, the LCP can identify signals in these regions of ${\mathcal{X}}$ with a small conditional scale $V\mid{\bf X}={\bf x}$, which tends to be missed by the CP. This property further motivates us to apply the LCP on conditional testing problems.

###### Remark 1 .

The deviation bound in Theorem 3 has two terms corresponding to the bias and variance of $p$-value functions. This is different from Theorem 2 in which we only need $h\to 0$ to eliminate bias and ensure validity. Fixing the sample size $n$ and taking $h\to 0$, the LCP will degenerate to the independent uniform random variable $\xi$, which remains valid but does not contain any information of the data. Otherwise if we take $h\to\infty$ it will degenerate to the unweighted CP. Therefore, the bandwidth $h$ controls the trade-off between the conditional validity of the LCP and the effective sample size.

###### Theorem 1 .

###### Theorem 2 .

###### Assumption 1 .

###### Theorem 3 .

###### Remark 1 .

## 3 Applications on conditional testing

In this section, we apply the LCP on several conditional testing problems. We first provide a straightforward application on sample selection problem in Section 3.1. Then in Section 3.2 we study the conditional outlier detection problem and adopt the conditional calibration technique to achieve finite-sample FDR control. In Section 3.3 we introduce a novel
conditional label screening problem and leverage the LCP to design a screening procedure with FWER control. Finally, we propose a two-sample U-statistic by aggregating the simplified LCP for the two-sample conditional distribution test in Section 3.4.

### 3.1 Warm-up: balanced data selection

Consider the sample selection problem which was investigated by Jin and Candès () and Wu et al. (). The test sample ${\mathcal{D}}_{2}=\{{\bf X}_{2j}\}_{j=1}^{m}$ is unlabeled. The goal is to select test samples satisfying a pre-specified rule $Y\in{\mathcal{A}}$. Therefore, whether to select the $j$th sample amounts to conducting the following hypothesis test:

$$ ${\mathbb{H}}_{0j}:Y_{2j}\notin{\mathcal{A}},\;\;\text{versus}\;\;{\mathbb{H}}_ {1j}:\;Y_{2j}\in{\mathcal{A}}.$ $$

In this case, the CP can be accordingly defined as

$$ $p_{j}=\frac{\sum_{i\in{\mathcal{C}},Y_{1i}\notin{\mathcal{A}}}{\mathbb{I}}\{{V }_{2j}\leq{V}_{1i}\}+\xi_{j}}{|\{i\in{\mathcal{C}}:Y_{1i}\notin{\mathcal{A}}\} |+1},$ $$

and if $p_{j}\leq\alpha$ we select ${\bf X}_{2j}$. Such methods directly controls the per selection error rate (PSER), say

$$ $\Pr({\bf X}_{2j}\;{\rm selected}\mid Y_{2j}\notin{\mathcal{A}})\leq\alpha.$ $$

Analogously, we can apply our proposed localized conformal $p$-value instead to achieve certain improvement in terms of conditional performance. The LCP is defined as

$$ $p_{{\rm r}{\rm L},j}=\frac{\sum_{i\in{\mathcal{C}},Y_{1i}\notin{\mathcal{A}}}H ({\bf X}_{1i},\tilde{\bf X}_{2j}){\mathbb{I}}\{{V}_{2j}\leq{V}_{1i}\}+\xi_{j} \cdot H({\bf X}_{2j},\tilde{\bf X}_{2j})}{\sum_{i\in{\mathcal{C}},Y_{1i}\notin {\mathcal{A}}}H({\bf X}_{1i},\tilde{\bf X}_{2j})+H({\bf X}_{2j},\tilde{\bf X}_ {2j})},$ $$

where $V$ is a non-conformity score function depending on ${\mathcal{A}}$. We use $\delta_{j}=1,0$ to indicate selecting ${\bf X}_{2j}$ or not, where
$\delta_{j}={\mathbb{I}}\{p_{{\rm r}{\rm L},j}\leq\alpha\}$. As a corollary of Theorems 1-2, the following theorem provides the marginal and conditional properties of this simple selection rule.

###### Theorem 4 .

Suppose $\{({\bf X}_{1i},Y_{1i})\}_{i=1}^{n}$ and $\{({\bf X}_{1i},Y_{1i})\}_{j=1}^{m}$ are exchangeable, the selection rule $\delta_{j}={\mathbb{I}}\{p_{{\rm r}{\rm L},j}\leq\alpha\}$ can ensure finite-sample marginal PSER control $\Pr(\delta_{j}=1\mid Y_{2j}\notin{\mathcal{A}})\leq\alpha$.
Moreover, the conditional PSER inflation bound is given by

$$ $\Pr(\delta_{j}=1\mid Y_{2j}\notin{\mathcal{A}},{\bf X}_{2j}\in{\mathcal{B}}) \leq\alpha+2\|f_{1,{\bf X},{\mathcal{A}}}\|_{\infty}\frac{\Pr_{{\bf X}\sim P_{ H,{\bf X},{\mathcal{A}}},{\bm{U}}\sim K(\cdot)}(\|U\|_{2}\geq h^{-1}d({\bf X}, \partial{\mathcal{B}}))}{\Pr({\bf X}_{2j}\in{\mathcal{B}}\mid Y_{2j}\notin{ \mathcal{A}})},$ $$

where $f_{1,{\bf X},{\mathcal{A}}}$ is the conditional density of ${\bf X}_{1i}\mid Y_{1i}\notin{\mathcal{A}}$, $P_{H,{\bf X},{\mathcal{A}}}$ has a density function $f_{H,{\bf X},{\mathcal{A}}}({\bf x})={\mathbb{E}}_{{\bf X}\sim f_{1,{\bf X},{
\mathcal{A}}}}\{H({\bf X},{\bf x})\}$ and $\partial{\mathcal{B}}$ is the boundary set of ${\mathcal{B}}$.

The second result is obtained by taking the function $g({\bf x})={\mathbb{I}}\{{\bf x}\in{\mathcal{B}}\}/\Pr({\bf X}_{2j}\in{
\mathcal{B}})$ in Theorem 2 and simplifying the deviation term. For general sets ${\mathcal{B}}$ of regular form (e.g., balls or hypercubes), the excess term will be small with a small $h$. This indicates that using the LCP for data selection can lead to a more balanced selection result since the PSER inflation for different sub-groups is bounded. For instance, by choosing an appropriate ${\mathcal{B}}$, we can expect that the burden of incorrect selection probability (PSER) will be more evenly distributed among different genders and races via our LCP. Similar issue is also considered by Rava et al. () from the perspective of fairness.

###### Theorem 4 .

### 3.2 Conditional outlier detection

In the conditional outlier detection problem, the available data consists of clean data ${\mathcal{D}}_{1}$ and test data ${\mathcal{D}}_{2}$ with potential outliers. Both samples are labeled with observed responses. The inliers in ${\mathcal{D}}_{2}$ have the same conditional distribution $P_{2,j,Y\mid{\bf X}}=P_{1,Y\mid{\bf X}}$ with ${\mathcal{D}}_{1}$ while the outliers may have different conditional distributions from each other. Detecting conditional outliers can be formulated as the following multiple testing problem:

$$ ${\mathbb{H}}_{0j}:P_{2,j,Y\mid{\bf X}={\bf x}}=P_{1,Y\mid{\bf X}={\bf x}}\; \text{for}\;\text{almost all}\;{\bf x},\;\;\text{versus}\;\;{\mathbb{H}}_{1j}: \;\text{otherwise},$ (6) $$

where $({\bf X}_{2j},Y_{2j})\in{\mathcal{D}}_{2}$ is an inlier if ${\mathbb{H}}_{0j}$ holds and outlier if ${\mathbb{H}}_{1j}$ holds.
Our goal is to determine the detection set (or the rejection set equivalently) ${\mathcal{R}}\subseteq\{1,2,\dots,m\}$ based on the observed data ${\mathcal{D}}_{1}$ and ${\mathcal{D}}_{2}$. Denote ${\mathcal{I}},{\mathcal{O}}\subseteq\{1,2,\dots,m\}$ as the index sets of inliers and outliers. The rejection set ${\mathcal{R}}$ should contain as many indices in ${\mathcal{O}}$ as possible while guaranteeing finite-sample false discovery rate (FDR) control

$$ ${\rm FDR}={\mathbb{E}}(\rm FDP)={\mathbb{E}}\left(\frac{|{\mathcal{I}}\cap{ \mathcal{R}}|}{|{\mathcal{R}}|\vee 1}\right)\leq\alpha.$ $$

Bates et al. () utilized the conformal $p$-value to test for marginal outliers by applying the BH procedure on conformal $p$-values computed on the test data. However, this is generally not effective when testing for conditional outliers. As discussed in the previous section, the classical CP targets on the joint distribution of $({\bf X},Y)$ rather than $Y\mid{\bf X}$, and thus cannot identify all information in the conditional distribution of score variables. In light of the capability of the LCP to capture deviations in conditional distributions, we can take it as a refinement to detect conditional outliers.

As proved by Bates et al. (), the unweighted conformal $p$-values based on the same calibration set is PRDS, under which the BH procedure can still guarantee finite-sample FDR control. This property, however, does not hold for the weighted conformal $p$-values. In order to achieve the finite-sample property, we adopt the conditional calibration technique (Fithian and Lei, ) to prune the rejection set output by the BH procedure.

To perform multiple testing with the LCP, we first train the non-conformity score function ${V}({\bf x},y)$ on ${\mathcal{D}}_{{\mathcal{T}}}$ and then compute scores $\{{V}_{1i}\}_{i\in{\mathcal{C}}}$ and $\{{V}_{2j}\}_{j=1}^{m}$ on ${\mathcal{D}}_{{\mathcal{C}}}$ and ${\mathcal{D}}_{2}$, respectively. After sampling $\tilde{\bf X}_{2j}$ for each ${\bf X}_{2j}$, the LCP’s $\{p_{{\rm L},j}\}_{j=1}^{m}$ are computed as in Eq. (5). Define the auxiliary $p$-values as

$$ $p_{{\rm L},j}^{(l)}=\frac{\sum_{i\in{\mathcal{C}}}H({\bf X}_{1i},\tilde{\bf X} _{2j}){\mathbb{I}}\{{V}_{2j}\leq{V}_{1i}\}+\xi_{j}\cdot H({\bf X}_{2j},\tilde{ \bf X}_{2j}){\mathbb{I}}\{{V}_{2j}\leq{V}_{2l}\}}{\sum_{i\in{\mathcal{C}}}H({ \bf X}_{1i},\tilde{\bf X}_{2j})+H({\bf X}_{2j},\tilde{\bf X}_{2j})}.$ (7) $$

for $l\in\{1,2,\dots,m\}\setminus\{j\}$. Let $\widehat{{\mathcal{R}}}_{j\to 0}$ be the rejection set of the BH procedure applied on $\{p_{{\rm L},1}^{(j)},\dots,p_{{\rm L},j-1}^{(j)},0,p_{{\rm L},j+1}^{(j)},
\dots,p_{{\rm L},m}^{(j)}\}$ and ${\mathcal{R}}^{{\rm init}}=\{j:p_{{\rm L},j}\leq\alpha|\widehat{{\mathcal{R}}}
_{j\to 0}|/m\}$ be the initial rejection set. We determine the final rejection set by generating independent $\zeta_{1},\dots,\zeta_{m}\sim{\rm U}[0,1]$ and pruning ${\mathcal{R}}^{{\rm init}}$ into

$$ ${\mathcal{R}}=\left\{j:p_{{\rm L},j}\leq\frac{\alpha|\widehat{{\mathcal{R}}}_{ j\to 0}|}{m},\zeta_{j}|\widehat{{\mathcal{R}}}_{j\to 0}|\leq r^{*}\right\},$ (8) $$

where $r^{*}=\max\left\{r:\sum_{j=1}^{m}{\mathbb{I}}\left\{p_{{\rm L},j}\leq\alpha|
\widehat{{\mathcal{R}}}_{j\to 0}|/m,\zeta_{j}|\widehat{{\mathcal{R}}}_{j\to 0}
|\leq r\right\}\geq r\right\}$.

The outlier detection procedure is summarized in Algorithm 1.

Figure: Algorithm 1 Conditional Outliers Detection via the LCP

The following theorems shows that our detection procedure can guarantee finite-sample FDR control if the distribution of the covariates does not change.

###### Theorem 5 (Finite-sample FDR control) .

Under the condition that $P_{1,{\bf X}}=P_{2,{\bf X}}$, the final output ${\mathcal{R}}$ given by Algorithm 1 ensures ${\rm FDR}\leq\alpha$.

###### Remark 2 .

Testing for conditional outliers may not be restricted to the regression setting. Consider the case where only the covariate ${\bf X}$ is available.
By splitting the covariate vector ${\bf X}$ into ${\bf X}=({\bf X}^{(1)},{\bf X}^{(2)})$, one can compute weights with respect to ${\bf X}^{(1)}$ and test for outliers regarding the conditional distribution ${\bf X}^{(2)}\mid{\bf X}^{(1)}$. This approach is applicable in various spatial or temporal settings where ${\bf X}^{(1)}$ can be taken as the location or time variable.

###### Theorem 5 (Finite-sample FDR control) .

###### Remark 2 .

### 3.3 Conditional label screening

In the conditional label screening problem, the response variable is multivariate with ${\bf Y}=(Y_{1},Y_{2},\dots,Y_{S})$ for some random variable $S$. The first sample ${\mathcal{D}}_{1}$ is the labeled
data while the second sample ${\mathcal{D}}_{2}$ is unlabeled. The response vectors are denoted as ${\bf Y}_{\ell i}=(Y_{\ell i,1},\dots,Y_{\ell i,S_{\ell i}})$ for $\ell=1,2$. Our goal is to determine whether each component of the unobserved response ${\bf Y}_{2j}=(Y_{2j,1},\dots,Y_{2j,S_{2j}})$ satisfies a pre-specified rule for each ${\bf X}_{2j}\in{\mathcal{D}}_{2}$. For each entry $s$, we define the screening rule as $Y_{2j,s}\in{\mathcal{A}}_{s}$ with pre-chosen sets ${\mathcal{A}}_{s}$. This can be formulated as a multiple testing problem for each test sample

$$ ${\mathbb{H}}_{0j,s}:\;Y_{2j,s}\notin{\mathcal{A}}_{s},\;\;\text{versus}\;\;{ \mathbb{H}}_{1j,s}:\;Y_{2j,s}\in{\mathcal{A}}_{s},\quad 1\leq s\leq S_{2j}.$ (9) $$

For example, Mohri and Hashimoto (); Cherian et al. () considered using conformal prediction techniques to improve the output factuality of large language models (LLM). Specifically, they transform the output of the LLM into a set of claims and aim to construct a filtered claim set that contains no false claims with high probability. Such application can be framed into our conditional label screening problem stated above. The covariate ${\bf X}_{2j}$ includes the input prompt $P_{2j}$, the output $R_{2j}$ of the LLM model and a claim vector ${\bf C}_{2j}$ of length $S_{2j}$ summarized by another language model. The response vector is a 0-1 vector with $Y_{2j,s}=1$ or 0 0 indicating whether the corresponding claim is correct or not. Here we can take ${\mathcal{A}}_{s}=\{1\}$ for every $1\leq s\leq S_{2j}$ to screen out false claims.

To ensure reliability of the screening procedure, we seek to control the probability of failing to screen out any component of ${\bf Y}_{2j}$ that does not meet the rule. Let $\delta_{j,s}=1$ or 0 0 indicate whether $Y_{2j,s}$ is retained after screening. This can be rigorously formulated as

$$ $\Pr\left(\sum_{s=1}^{S_{2j}}{\mathbb{I}}\{Y_{2j,s}\notin{\mathcal{A}}_{s}, \delta_{j,s}=1\}>0\right)\leq\alpha,$ (10) $$

say, controlling the FWER for (9).
However, the marginal FWER might not be sufficient in real problems. We can use the localization technique to improved conditional validity while still guaranteeing marginal FWER control.

Since the test data ${\mathcal{D}}_{2}$ is unlabeled in the current problem, the non-conformity score function $V$ should depend only on the covariate ${\bf X}$. We can use the training data ${\mathcal{D}}_{\mathcal{T}}$ to estimate the probability $\Pr(Y_{2j,s}\in{\mathcal{A}}_{s})$. This can be achieved by training classification models for each component of $Y$ if the length $S$ is a fixed constant or fitting a joint classification model that outputs a probability vector. In both scenarios, we can define the score vector

$$ ${V}({\bf X}_{2j})=({V}_{2j,1},{V}_{2j,2},\dots,{V}_{2j,S_{2j}})^{\top},$ $$

where each ${V}_{2j,s}$ approximates $\Pr(Y_{2j,s}\in{\mathcal{A}}_{s})$. By this definition,
we should reject ${\mathbb{H}}_{0j,s}$ if ${V}_{2j,s}$ is large,
and controlling the FWER amounts to examining the distribution of $\max\{{V}_{2j,s}:Y_{2j,s}\notin{\mathcal{A}}_{s}\}$.
This motivates us to define the localized $p$-value

$$ $p_{{\rm L},j,s}=\frac{\sum_{i\in{\mathcal{C}}}H({\bf X}_{1i},\tilde{\bf X}_{2j }){\mathbb{I}}\{{V}_{2j,s}\leq\bar{V}_{1i}\}+\xi_{j}\cdot H({\bf X}_{2j}, \tilde{\bf X}_{2j})}{\sum_{i\in{\mathcal{C}}}H({\bf X}_{1i},\tilde{\bf X}_{2j} )+H({\bf X}_{2j},\tilde{\bf X}_{2j})},$ (11) $$

where $\bar{V}_{1i}=\max\{{V}_{1i,s}:Y_{1i,s}\notin{\mathcal{A}}_{s}\}$.
We can show that the $p_{{\rm L},j,s}$’s satisfy the group super-uniform property, i.e.,

$$ $\Pr\left(\bigcup_{Y_{2j,s}\notin{\mathcal{A}}_{s}}\{p_{{\rm L},j,s}\leq\alpha \}\right)\leq\alpha,$ $$

and thus we can screen out components of ${\bf Y}_{2j}$ with $p_{{\rm L},j,s}\leq\alpha$, We summarize our label screening procedure in Algorithm 2.

Figure: Algorithm 2 Conditional Label Screening via the LCP

We have the following result.

###### Theorem 6 .

Suppose $\{({\bf X}_{1i},{\bf Y}_{1i},S_{1i})\}_{i\in{\mathcal{C}}}\cup\{({\bf X}_{2j},
{\bf Y}_{2j},S_{2j})\}_{j=1}^{m}$ are exchangeable, then the label screening procedure given by Algorithm 2 ensures finite-sample FWER control

$$ ${\rm FWER}=\Pr\left(\sum_{s=1}^{S_{2j}}{\mathbb{I}}\{Y_{2j,s}\notin{\mathcal{A }}_{s},p_{{\rm L},j,s}\leq\alpha\}>0\right)\leq\alpha.$ $$

Regarding the conditional property, we can also establish the finite-sample conditional FWER deviation bound for our procedure.

###### Theorem 7 .

Suppose the assumptions in Theorem 6 hold. For any fixed set ${\mathcal{B}}\subset{\mathcal{X}}$ with $\Pr({\bf X}_{2j}\in{\mathcal{B}})>0$, the conditional FWER has the following bound

$$ $\displaystyle\Pr$ $\displaystyle\left(\sum_{s=1}^{S_{2j}}{\mathbb{I}}\{Y_{2j,s}\notin{\mathcal{A} }_{s},p_{{\rm L},j,s}\leq\alpha\}>0\;\Big{|}\;{\bf X}_{2j}\in{\mathcal{B}}\right)$ $\displaystyle\leq\alpha+2\|f_{1,{\bf X}}\|_{\infty}\frac{\Pr_{{\bf X}\sim P_{H ,{\bf X}},{\bm{U}}\sim K(\cdot)}(\|U\|_{2}\geq h^{-1}d({\bf X},\partial{ \mathcal{B}}))}{\Pr({\bf X}_{2j}\in{\mathcal{B}})},$ $$

where $\partial{\mathcal{B}}$ is the boundary of set ${\mathcal{B}}$.

In this theorem, the inflation bound is similar to that in the second result of Theorem 4. By a similar rationale, this demonstrate the advantage of our method to mitigate conditional error rate inflation.

###### Theorem 6 .

###### Theorem 7 .

### 3.4 Two-sample conditional distribution test

In the two-sample conditional testing problem, the second sample ${\mathcal{D}}_{2}$ is labeled and i.i.d. following a potentially different distribution $({\bf X}_{2j},Y_{2j})\sim P_{2,{\bf X}}\times P_{2,Y\mid{\bf X}}$ from the first sample ${\mathcal{D}}_{1}$. The conditional distribution test can be formulated as

$$ ${\mathbb{H}}_{0}:P_{1,Y\mid{\bf X}={\bf x}}=P_{2,Y\mid{\bf X}={\bf x}}\;\text{ for}\;\text{almost all}\;{\bf x},\;\;\text{versus}\;\;{\mathbb{H}}_{1}:\;\text {otherwise}.$ (12) $$

Hu and Lei () proposed a two-sample conditional distribution test based on the conformal inference framework. To be specific, they first split both samples as ${\mathcal{D}}_{1}={\mathcal{D}}_{{\mathcal{T}}_{1}}\cup{\mathcal{D}}_{{
\mathcal{C}}_{1}}$ and ${\mathcal{D}}_{2}={\mathcal{D}}_{{\mathcal{T}}_{2}}\cup{\mathcal{D}}_{{
\mathcal{C}}_{2}}$ with $|{\mathcal{D}}_{{\mathcal{C}}_{1}}|=|{\mathcal{D}}_{{\mathcal{C}}_{2}}|=n_{1},
|{\mathcal{D}}_{{\mathcal{T}}_{1}}|=|{\mathcal{D}}_{{\mathcal{T}}_{2}}|=n_{2}$.
For notation convenience, we perform an equal-sized sample splitting with $n_{1}=n_{2}$ and let ${\mathcal{C}}_{1}={\mathcal{C}}_{2}=\{1,\dots,n_{1}\}$ in this section.
Thereafter, the score function and density ratio estimator

$$ $V({\bf x},y)=\widehat{\frac{f_{1}(y\mid{\bf x})}{f_{2}(y\mid{\bf x})}},\quad \widehat{g}({\bf x})=\widehat{\frac{f_{2,{\bf X}}({\bf x})}{f_{1,{\bf X}}({\bf x })}}$ $$

are trained on ${\mathcal{D}}_{{\mathcal{T}}_{1}}\cup{\mathcal{D}}_{{\mathcal{T}}_{2}}$ by fitting classification models to distinguish ${\mathcal{D}}_{{\mathcal{T}}_{1}}$ and ${\mathcal{D}}_{{\mathcal{T}}_{2}}$. After computing scores $\{{V}_{1i}\}_{i\in{\mathcal{C}}_{1}}$ and $\{{V}_{2j}\}_{j\in{\mathcal{C}}_{2}}$, the weighted conformal $p$-values are obtained as

$$ $\widehat{p}_{j}=\frac{n_{1}^{-1}\sum_{i\in{\mathcal{C}}_{1}}\widehat{g}({\bf X }_{1i})\widehat{D}_{ij}^{*}}{n_{1}^{-1}\sum_{i\in{\mathcal{C}}_{1}}\widehat{g} ({\bf X}_{1i})},\quad j\in{\mathcal{C}}_{2}.$ $$

The test statistic is constructed by averaging these $p$-values

$$ $\widehat{T}=\frac{\frac{1}{2}-\frac{1}{n_{1}}\sum_{j\in{\mathcal{C}}_{2}} \widehat{p}_{j}}{\widehat{\sigma}},$ $$

where $\widehat{D}_{ij}^{*}={\mathbb{I}}\{{V}_{2j}<{V}_{1i}\}+\xi_{j}{\mathbb{I}}\{{V
}_{2j}={V}_{1i}\}$ and $\widehat{\sigma}^{2}$ is the variance estimator. Under the null hypothesis, they proved that $\sqrt{n_{1}}\widehat{T}$ is asymptotically normally distributed and the rejection region is given by $\sqrt{n_{1}}\widehat{T}>\Phi^{-1}(1-\alpha)$.

We extend the above strategy by aggregating the localized conformal $p$-values computed on the second sample. Since $p$-values are no longer necessary
to be finite-sample valid in this case, here we use a simplified variant of the localized conformal $p$-value without randomization

$$ $p_{{\rm SL},j}=\frac{\sum_{i\in{\mathcal{C}}}H({\bf X}_{1i},{\bf X}_{2j}){ \mathbb{I}}\{{V}_{2j}\leq{V}_{1i}\}+\xi_{j}\cdot H({\bf X}_{2j},{\bf X}_{2j})} {\sum_{i\in{\mathcal{C}}}H({\bf X}_{1i},{\bf X}_{2j})+H({\bf X}_{2j},{\bf X}_{ 2j})},$ (13) $$

and
our proposed test statistic is defined as

$$ $\widehat{T}_{w}=\frac{\frac{1}{n_{1}}\sum_{i=1}^{n_{1}}\frac{1}{n_{1}}\sum_{j= 1}^{n_{1}}H({\bf X}_{1i},{\bf X}_{2j})\widehat{D}_{ij}}{\widehat{\sigma}_{w}},$ (14) $$

where $\widehat{D}_{ij}=1/2-{\mathbb{I}}\{{V}_{2j}<{V}_{1i}\}-\xi_{j}{\mathbb{I}}\{{V
}_{2j}={V}_{1i}\}$ and $\widehat{\sigma}_{w}^{2}$ is the variance estimator. This test statistic is constructed by averaging unnormalized LCP’s in Eq. (13) and performing standardization. From a different perspective, it is also related to the classical U-statistic for model checking problems (Zheng, ; Gao and Gijbels, ) in which the $\widehat{D}_{ij}$’s are replaced by the residuals. Inherited from the nice property of conformal techniques, our method enjoys model-agnostic features and allows us to employ state-of-the-art algorithms to construct efficient score function $V$ that is able to better measure the discrepancy between two conditional distributions.

We need the following technical assumptions to establish the asymptotic normality of $\widehat{T}_{w}$. We also make the same regularity assumptions to those in Hu and Lei () without further declaration in theorems, which guarantee identifiability of the problem.

###### Assumption 2 .

Let $V^{*}({\bf x},y)=f_{2}(y|{\bf x})/f_{1}(y|{\bf x})$ be the true conditional density ratio. Denote the oracle statistics as $V_{1i}^{*}=V^{*}({\bf X}_{1i},Y_{1i}),V_{2j}^{*}=V^{*}({\bf X}_{2j},Y_{2j})$ and $D_{ij}=1/2-{\mathbb{I}}\{V_{1i}^{*}<V_{2j}^{*}\}-\xi_{j}{\mathbb{I}}\{V_{1i}^{
*}=V_{2j}^{*}\}$. Suppose that

- •
$V_{2j}^{*}$ has a continuous distribution;
- •
${\mathbb{E}}\{H({\bf X}_{1i},{\bf X}_{2j})(\widehat{D}_{ij}-D_{ij})\}=o_{p}(1/
\sqrt{n_{1}})$.

Recall that we use classification to construct the score function ${V}({\bf x},y)$ to approximate the true conditional density ratio $V^{*}({\bf x},y)$ in this problem. This assumption requires the approximation error is sufficiently small after local-weighting. A similar assumption has been made in Hu and Lei () with $H({\bf X}_{1i},{\bf X}_{2j})$ replaced by $\widehat{g}({\bf X}_{1i})$. These two assumptions are introduced both to ensure a vanishing asymptotic bias and achieve asymptotic normality in the presence of covariate shift.

###### Theorem 8 (Asymptotic normality) .

Under the null hypothesis, suppose Assumption 1 holds for $P_{1},P_{2}$ and $h\to 0,n_{1}h^{d}\to\infty$. Further assume $P_{1,{\bf X}}=P_{2,{\bf X}}$ or Assumption 2 holds. Then the test statistic (14) is asymptotically normally distributed

$$ $\widehat{T}_{w}=\frac{\frac{1}{n_{1}}\sum_{i=1}^{n_{1}}\frac{1}{n_{1}}\sum_{j= 1}^{n_{1}}H({\bf X}_{1i},{\bf X}_{2j})\widehat{D}_{ij}}{\widehat{\sigma}_{w}} \stackrel{{\scriptstyle d}}{{\to}}Z\sim N(0,1),$ $$

where the variance estimator is given by

$$ $\displaystyle\widehat{\sigma}_{w}^{2}=$ $\displaystyle\frac{1}{n_{1}^{2}}\sum_{i=1}^{n_{1}}\left\{\frac{1}{n_{1}}\sum_{ j=1}^{n_{1}}H({\bf X}_{1i},{\bf X}_{2j})\widehat{D}_{ij}\right\}^{2}+\frac{1}{ n_{1}^{2}}\sum_{j=1}^{n_{1}}\left\{\frac{1}{n_{1}}\sum_{i=1}^{n_{1}}H({\bf X}_ {1i},{\bf X}_{2j})\widehat{D}_{ij}\right\}^{2}$ $\displaystyle-\frac{1}{n_{1}^{4}}\sum_{i=1}^{n_{1}}\sum_{j=1}^{n_{1}}H({\bf X} _{1i},{\bf X}_{2j})^{2}\widehat{D}_{ij}^{2}-\frac{2}{n_{1}}\left\{\frac{1}{n_{ 1}^{2}}\sum_{i=1}^{n_{1}}\sum_{j=1}^{n_{1}}H({\bf X}_{1i},{\bf X}_{2j}) \widehat{D}_{ij}\right\}^{2}.$ $$

Note that the convergence of the score function is only needed under covariate shift settings. Given the asymptotic normality property, we can construct our testing procedure as summarized in Algorithm 3.

Figure: Algorithm 3 Two-sample conditional distribution test via aggregation of simplified LCP’s

###### Theorem 9 (Behavior under local alternatives) .

Suppose Assumption 1 holds for $P_{1},P_{2}$, Assumption 2 holds, and $n_{1}\widehat{\sigma}_{w}^{2}\stackrel{{\scriptstyle p}}{{\to}}\sigma_{w}^{2}>0$.Then we have

$$ $\widehat{T}_{w}=\frac{\sqrt{n_{1}}\delta_{w}}{4\sigma_{w}}(1+o_{p}(1))+Z+o_{p} (1),$ $$

where $\delta_{w}={\mathbb{E}}_{{\bf X}\sim P_{2,{\bf X}},Y,Y^{\prime}\sim P_{2,Y\mid
{\bf X}}}\{f_{1,{\bf X}}({\bf X})|V^{*}({\bf X},Y)-V^{*}({\bf X},Y^{\prime})|\}$ and $Z\sim N(0,1)$.

This theorem is similar to Proposition 1 in Hu and Lei (). The main difference lies in the form of “signal strength” $\delta_{w}$, which is $\delta={\mathbb{E}}_{({\bf X},Y),({\bf X}^{\prime},Y^{\prime})\sim P_{2}}\{|V^
{*}({\bf X},Y)-V^{*}({\bf X}^{\prime},Y^{\prime})|\}$ in their article. In comparison, the difference term in $\delta_{w}$ is based on the same covariate value and therefore better captures the deviation in conditional distribution. This reflects the superiority of our proposed test statistic in the two-sample conditional testing problem.

###### Assumption 2 .

###### Theorem 8 (Asymptotic normality) .

###### Theorem 9 (Behavior under local alternatives) .

## 4 Simulation experiments

In this section, we provide extensive synthetic experiment results to show the validity and efficiency of our proposed methods for three main applications in Sections 4.1-4.3, respectively.

### 4.1 Results for conditional outlier detection

For the conditional outlier detection problem, we consider two scenarios:

- •
Scenario A1 (with label $Y$): A heterogeneous linear regression model. The covariate vector consists of ${\bf X}=(X_{1},\dots,X_{d-1})^{\top}\in\mathbb{R}^{d-1}$ with $d=10$ and an additional time feature $t\in\mathbb{R}$. The model is
$Y={\bf X}\bm{\beta}+(3+2\cdot\sin(2\pi\cdot t))\cdot\varepsilon,$
with $X_{1},\dots,X_{d-1}\sim{\rm U}[-1,1],t\sim{\rm U}[0,1]$ and $\varepsilon\sim N(0,1)$ independently. The coefficient vector is $\bm{\beta}=(0.5,-0.5,0.5,-0.5,0.5,0,0,0,0)$. The test data contains $10\%$ outliers following the model
$Y={\bf X}\bm{\beta}+(3+2\cdot\sin(2\pi\cdot t))\cdot\varepsilon+r(t)\cdot\xi,$
where $r(t)=3\cdot(3+1.5\sin(2\pi\cdot t))$ and $\Pr(\xi=\pm 1)=1/2$.
- •
Scenario B1 (without label $Y$): Another example which does not include the label $Y$. To fit our problem, we consider a spatial setting with ${\bf X}=({\bm{s}},{\bf X}^{*})$ where ${\bm{s}}$ is the spatial variable and ${\bf X}^{*}$ contains the remaining features. We consider ${\bf X}\in\mathbb{R}^{d}$ with ${\bm{s}}=(s_{1},s_{2})\in\mathbb{R}^{2}$ and ${\bf X}^{*}\in\mathbb{R}^{d-2}$ with $d=50$:
${\bf X}^{*}\mid{\bm{s}}\sim N(0,r({\bm{s}})\cdot I_{d-2}),\;\;r({\bm{s}})=0.2+
0.9\|{\bm{s}}\|_{2}^{2}$
where $s_{1},s_{2}\sim{\rm U}[-1,1]$ independently. The test data contains $10\%$ outliers with the same distribution for ${\bm{s}}$ and a different conditional distribution
${\bf X}^{*}\mid{\bm{s}}\sim N(0,4\cdot r({\bm{s}})\cdot I_{d-2}).$

Benchmarks. We abbreviate our method as LCP-od (outlier detection) and compare it with a benchmark method abbreviated as CP. The CP method is implemented by computing the unweighted conformal $p$-values as defined in Bates et al. () and then applying the BH procedure. For the LCP-od and CP methods, we use two score functions and apply various regression or classification algorithms, which are detailed in the implementation part.

Implementation details. Since our goal is to test for outliers conditional on $t$ or ${\bm{s}}$ in Scenarios A1 and B1, we only use these variables when computing the weights. For both scenarios, the kernel function of the LCP-od method is taken as the Gaussian kernel $H(x,x^{\prime})=(2\pi h^{2})^{-d/2}\exp\{-\|x-x^{\prime}\|_{2}^{2}/(2h^{2})\}$ with bandwidth $h=(n/2)^{-1/(d+2)}$ for $d=1,2$ in Scenarios A1 and B1. This corresponds to the optimal convergence rate for $\beta=1$. For Scenario A1, we consider two kinds of score functions: the CQR score and the absolute residual of different regression algorithms. Similar to Romano et al. (), for the CQR score, we consider using quantile neural networks (CQR-QNN) and quantile random forests (CQR-QRF). For the absolute residual score, we take two regression algorithms: random forest (Res-RF), and support vector machine (Res-SVM). For Scenario B1, we use one-class classifiers for both the LCP-od and CP methods. We take three kinds of one-class classification algorithms: the isolation forest (IOF), $k$-Nearest-Neighbor ($k$-NN) with $k=5$ and one-class support vector machine (one-class SVM).

Results. For each scenario, we consider either fixing $\alpha=0.1\;\text{or}\;0.15,m=2000$ and varying $n\in\{800,1600,2400,3200,4000\}$ or fixing the sample size $n=m=2000$ and varying $\alpha\in\{0.05,0.1,0.15,0.2\}$. The results for Scenario A1 are shown in Figure 1-2, and the results for Scenario B1 are shown in Figure 3-4. In both scenarios, the LCP-od method accurately controls the FDR around the nominal level, which validates its finite-sample FDR control property. In terms of power, the LCP-od method demonstrates higher power than the CP benchmark in Scenario A1 with both two score functions when the sample size $n$ and the nominal level $\alpha$ are relatively large. Compared with the absolute residual score, the CQR score leads to relatively higher power due to its adaptivity to the conditional distribution $Y\mid{\bf X}$. However, the power gain is still significant after applying the LCP-od method, illustrating the advantage of local weighting.

In Scenario B1, the power of the LCP-od method grows significantly with the sample size $n$ and the nominal level $\alpha$, while the power of the CP method only rises slightly. As discussed in the main text, the unweighted CP cannot identify those outliers with small conditional variance of the score. This explains why the power of the CP method remains “stuck” around the same value. In contrast, the power of the LCP-od method approaches 1 as the sample size increases, demonstrating the full identifiability of the LCP-od method in testing for conditional outliers.

Figure: Figure 1: FDP above the nominal level and power under different sample sizes $n$ for Scenario A1. The test sample size is fixed at $m=2000$ and the nominal level is fixed at $\alpha=0.15$.
Refer to caption: x1.png

Figure: Figure 2: FDP above the nominal level and power under different nominal levels $\alpha$ for Scenario A1. The sample sizes are fixed at $n=m=2000$.
Refer to caption: x2.png

Figure: Figure 3: FDP above the nominal level and power under different sample sizes $n$ for Scenario B1. The test sample size is fixed at $m=2000$ and the nominal level is fixed at $\alpha=0.1$.
Refer to caption: x3.png

Figure: Figure 4: FDP above the nominal level and power under different nominal levels $\alpha$ for Scenario B1. The sample sizes are fixed at $n=m=2000$.
Refer to caption: x4.png

### 4.2 Results for conditional label screening

For the conditional label screening problem, we consider a nonlinear regression model:

- •
Scenario A2 (nonlinear regression): We take a constant $S=2$ and the response ${\bf Y}=(Y_{1},Y_{2})$ with $Y_{1}=-2X_{1}+7X_{2}^{2}+3\exp(X_{3}+2X_{4}^{2})+\varepsilon$, $Y_{2}=-6X_{1}+5X_{2}^{2}+3\exp(2X_{3}+X_{4}^{2})+\varepsilon$, ${\bf X}\sim U[-1,1]^{4}$ and $\varepsilon\sim\mathcal{N}(0,1)$. The screening target is $Y_{s}\in\mathcal{A}_{s}=[a_{s},+\infty)$ where $a_{s}$ is the 70% quantile of $Y_{s}$ for $s=1,2$, respectively.

Implementation details.
We fix the sample sizes $n=500,m=2000$ and vary $\alpha\in\{0.05,0.1,0.15,0.2\}$. We apply three different algorithms to train a probability prediction function for each component of ${\bf Y}$: linear logistic regression (LL), neural network (NN) and random forest (RF).

Benchmarks. We compare our conditional label screening method via the LCP (abbreviated as LCP-ls) as summarised in Algorithm 2 with the thresholding procedure without weighting (abbreviated as THR). The THR method is performed by only replacing the LCP by the classical unweighted CP.

Results. We calculate the empirical marginal FWER and four kinds of conditional FWER’s (conditional on ${\bf X}\in{\mathcal{B}}$ for four different sets ${\mathcal{B}}$). The evaluation measures are defined as follows:

- •
(Marginal FWER): $\operatorname{mFWER}_{j}=\Pr\left(\sum_{s=1}^{S_{2j}}{\mathbb{I}}\{Y_{2j,s}
\notin{\mathcal{A}}_{s},\delta_{j,s}=1\}>0\right)$
- •
(Conditional FWER): $\operatorname{cFWER}_{ij}=\Pr\left(\sum_{s=1}^{S_{2j}}{\mathbb{I}}\{Y_{2j,s}
\notin{\mathcal{A}}_{s},\delta_{j,s}=1\}>0\mid{\bf X}\in{\mathcal{B}}_{i}\right)$ for $i\in\{1,2,3,4\}$ and $j\in\{1,\dots,m\}$, where ${\mathcal{B}}_{1}=\{{\bf X}\in\mathbb{R}^{d}:X_{1}<0\;\text{and}\;X_{3}<0\}$, ${\mathcal{B}}_{2}=\{{\bf X}\in\mathbb{R}^{d}:X_{1}>0\;\text{and}\;X_{3}<0\}$, ${\mathcal{B}}_{3}=\{{\bf X}\in\mathbb{R}^{d}:X_{1}<0\;\text{and}\;X_{3}>0\}$, and ${\mathcal{B}}_{4}=\{{\bf X}\in\mathbb{R}^{d}:X_{1}>0\;\text{and}\;X_{3}>0\}$.

Figure: Figure 5: Conditional FWER (cFWER) and marginal FWER (mFWER) above $\alpha$ with different nominal levels $\alpha$ for Scenario A2. The sample sizes are fixed at $n=500,m=2000$.
Refer to caption: x5.png

The results for Scenario A2 are reported in Figure 5. As theoretically ensured, both methods control the marginal FWER at nominal levels. However, the LCP-ls is much more robust against conditionality and exhibit a much smaller conditional FWER inflation than the THR method on subsets ${\mathcal{B}}_{3}$ and ${\mathcal{B}}_{4}$. Accordingly, while the FWER conditional on ${\mathcal{B}}_{2}$ of both the THR and LCP-ls methods approach 0 as the nominal level $\alpha$ increases, the conditional error rate of the LCP-ls method remains much closer to the nominal level. This also suggests that the LCP-ls method offers a more balanced screening result.

### 4.3 Results for two-sample conditional distribution test

We consider three different scenarios for the problem of two-sample conditional distribution test, which are analogous to those in Hu and Lei ():

Scenario A3: Let $Y_{1i}=\alpha_{1}+{\bf X}_{1i}^{\top}\beta+\varepsilon_{1i},i=1,\dots,n$ and $Y_{2j}=\alpha_{2}+{\bf X}_{2j}^{\top}\beta+\varepsilon_{2j},j=1,\dots,m$, where ${\bf X}_{1i}\overset{\text{iid}}{\sim}N(\textbf{0},I_{d}),{\bf X}_{2j}\overset
{\text{iid}}{\sim}N(\bm{\mu},I_{d})$ with $\bm{\mu}=(1,1,-1,-1,0)^{\top}$ and $\varepsilon_{1i},\varepsilon_{2j}\overset{\text{iid}}{\sim}N(0,1)$ independently. We set $\alpha_{1}=\alpha_{2}=0$ under the null and $\alpha_{1}=0,\alpha_{2}=0.5$ under the alternative.

Scenario B3: Let $Y_{1i}=\alpha_{1}+\beta_{1}X_{1i,1}+\beta_{2}X_{1i,2}+\beta_{3}X_{1i,3}^{2}+
\beta_{4}X_{1i,4}^{2}+\beta_{5}X_{1i,5}^{3}+\varepsilon_{1i},i=1,\dots,n$ and $Y_{2j}=\alpha_{2j}+\beta_{1}X_{2j,1}+\beta_{2}X_{2j,2}+\beta_{3}X_{2j,3}^{2}+
\beta_{4}X_{2j,4}^{2}+\beta_{5}X_{2j,5}^{3}+\varepsilon_{2j},j=1,\dots,m$, where ${\bf X}_{1i}\overset{\text{iid}}{\sim}0.5N(\textbf{0},I_{d})+0.5N(\bm{\mu},I_{
d})$ with $\bm{\mu}=(0.5,0.5,-0.5,-0.5,0)^{T}$, ${\bf X}_{2i}\overset{\text{iid}}{\sim}0.5N(\textbf{0},I_{d})+0.5N(\textbf{0},1
.5I_{d})$ and $\varepsilon_{1i},\varepsilon_{2j}\overset{\text{iid}}{\sim}t(5)$ independently. We set $\alpha_{1}=\alpha_{2}=0$ under the null and $\alpha_{1}=0,\alpha_{2j}=0.8\times(1-0.1\cdot\|{\bf X}_{2i}\|_{2}^{2})$ under the alternative.

Scenario C3: Let $Y_{1i}=\theta({\bf X}_{1i})+\epsilon_{1i},i=1,\dots,n$ and $Y_{2j}=\theta({\bf X}_{2j})+\epsilon_{2j},j=1,\dots,m$, where $\theta({\bf X})=\mathbb{E}(y\mid x)$ is an additive function of B-splines, and ${\bf X}_{1i}\overset{\text{iid}}{\sim}0.5N(\textbf{0},I_{d})+0.5N(\bm{\mu},I_{
d})$ with $\bm{\mu}=(0.5,0.5,-0.5,-0.5,0)^{T}$, ${\bf X}_{2i}\overset{\text{iid}}{\sim}0.5N(\textbf{0},I_{d})+0.5N(\textbf{0},1
.5I_{d})$ and we set $\varepsilon_{\ell i}\overset{\text{iid}}{\sim}N(0,4/(1+X_{\ell i}^{2}(1)))$ under the null and $\varepsilon_{1i}\overset{\text{iid}}{\sim}N(0,4/(1+X_{1i}^{2}(1)))$, $\varepsilon_{2i}\overset{\text{iid}}{\sim}N(0,1.5/(1+X_{2i}^{2}(1)))$ under the alternative.

Implementation details. Under each scenario, we fix $d=5$ and consider different sample sizes $n=m\in\{200,400,600,800,1000\}$ with equal splitting. The coefficient $\beta$ in model A and B are taken as $\beta=(1,1,1,-1,-1)^{\top}$. For our localized conformal test (LCT) method, we take the Gaussian kernel function and choose the same bandwidth $h=(n/2)^{-1/(d+2)}$. For all three scenarios, we use three different probabilistic classification models to estimate density ratios: linear logistic (LL), random forest (RF) and neural network (NN). The type I error (size) under the null and the power under the alternative are calculated for each scenario across 500 replications with nominal type I error level $\alpha=0.05$.

Benchmarks.
We compare our localized conformal test (LCT) as summarised in Algorithm 3 with the following two tests:

- •
CT: Hu and Lei ()’s conformal test as described in Section 3.4.
- •
DCT: Chen and Lei ()’s de-biased conformal test, where they formulate the covariate shift problem within the nonparametric framework and utilize the doubly-robust technique to correct the bias of the test statistic.

Results.
The results for all three scenarios are summarised in Figure 6. Regarding type I error, the CT method is only valid when the training model is correctly specified and exhibits a severely inflated type I error rate under mis-specified models. The DCT method is more robust than the CT method and controls the type I error rate under the nominal level for most scenarios and training models. This corresponds to its doubly-robust property, which relaxes the requirement on accuracy of the estimated density ratios. In contrast, the LCT method controls the type I error rate accurately around the nominal level for any combination of scenario and training model. This shows the robustness and wide applicability of our proposed test statistic.

In terms of power, the CT method is not valid with misspecified training models, so we only discuss the DCT and LCT methods. In Scenarios A3 and B3, the LCT method exhibits higher power than the DCT method especially when the sample size is large. In Scenario C3, the LCT method is more powerful than the DCT method using the NN algorithm and the two methods perform similarly when using the LL or RF algorithm. In general, the power improvement is more significant when the classification algorithm can distinguish the two populations better.
Except for the numerical performance, the DCT method involves not only data splitting but also a cross-fitting step. The LCT test does not require the latter and is therefore much easier to implement and computationally more efficient.

Figure: Figure 6: Type I error (size) under $H_{0}$ and power under $H_{1}$ of three methods under Scenario A3-C3 across different sample sizes $n=m\in\{200,400,600,800,1000\}$. The red dashed lines mark the nominal level $\alpha=0.05$ and the shading represents error bars of one standard error above and below.
Refer to caption: x6.png

## 5 Real data examples

### 5.1 Conditional outlier detection on spatial data

Dataset.
We use the House Sales in the King County, USA dataset (Kaggle, ) to demonstrate the performance of our method in a spatial scenario with label $Y$. The dataset contains $n=21613$ observations with 21 attributes including two spatial features: longitude ($s_{1}$) and latitude ($s_{2}$). The response $Y$ is the price of houses.

Implementation details.
We randomly sample three parts of the data from the whole dataset: $n_{\text{tr}}=2,000$ training data, $n_{\text{cal}}=2,000$ calibration data and $n_{\text{te}}=3,000$ test data. Since the original dataset contains no conditional outliers, we create synthetic outliers and apply different methods for detection. We randomly sample 10% of the testing data to be outliers. For the outliers, we add a random noise $\varepsilon_{i}$ to the original response $Y_{i}$. We consider two kinds of synthetic outliers.

- •
Conditional quantile-based outlier:
$\tilde{Y}_{i}=Y_{i}+\varepsilon_{i},\;\varepsilon_{i}=0.75\cdot\text{Quantile}
_{0.9}(Y\mid s_{2})\cdot\xi,$
where $\text{Quantile}_{0.9}(Y\mid s_{2})$ is the 90% conditional quantile of $Y$ given $s_{2}$ and $\Pr(\xi=\pm 1)=1/2$.
- •
Conditional variance-based outlier:
$\tilde{Y}_{i}=Y_{i}+\varepsilon_{i},\;\varepsilon_{i}=2\cdot\sqrt{\text{Var}(Y
\mid s_{2})}\cdot\xi,$
where $\text{Var}(Y\mid s_{2})$ is the conditional variance of $Y$ given $s_{2}$ and $\Pr(\xi=2)=\Pr(\xi=-1)=1/2$.

All results are based on 500 replications.

Results. We compare the LCP-od and the CP methods with the CQR score constructed by two different algorithms: quantile random forest (QRF) and quantile neural network (QNN). The empirical FDR and power for conditional outlier detection are reported in Table 1-2. The result is similar to the simulation part, where all methods control the FDR below the nominal. While the advantage is not as significant as before, the LCP-od method still enjoys the highest power in all cases.

**Table 1: Empirical FDR and power for the House Sales dataset with quantile-based outliers. Bold numbers represent the best results. The brackets contain the standard errors.**
| $\alpha$ | Method | LCP-od | CP |  |  |
| --- | --- | --- | --- | --- | --- |
| Score | CQR-QNN | CQR-QRF | CQR-QNN | CQR-QRF |  |
| 0.15 | FDR | 0.139 (0.087) | 0.131 (0.030) | 0.128 (0.047) | 0.145 (0.036) |
| Power | 0.657 (0.096) | 0.871 (0.048) | 0.593 (0.037) | 0.858 (0.070) |  |
| 0.2 | FDR | 0.177 (0.033) | 0.175 (0.030) | 0.174 (0.049) | 0.175 (0.037) |
| Power | 0.882 (0.131) | 0.913 (0.021) | 0.824 (0.078) | 0.907 (0.022) |  |

**Table 2: Empirical FDR and power for the House Sales dataset with variance-based outliers. Bold numbers represent the best results. The brackets contain the standard errors.**
| $\alpha$ | Method | LCP-od | CP |  |  |
| --- | --- | --- | --- | --- | --- |
| Score | CQR-QNN | CQR-QRF | CQR-QNN | CQR-QRF |  |
| 0.15 | FDR | 0.141 (0.051) | 0.127 (0.029) | 0.142 (0.043) | 0.128 (0.035) |
| Power | 0.520 (0.168) | 0.628 (0.092) | 0.480 (0.085) | 0.581 (0.119) |  |
| 0.2 | FDR | 0.181 (0.036) | 0.176 (0.038) | 0.196 (0.034) | 0.186 (0.030) |
| Power | 0.630 (0.084) | 0.722 (0.056) | 0.597 (0.099) | 0.692 (0.106) |  |

### 5.2 Conditional label screening on health data

Dataset. We use the health indicators dataset from Kaggle (Kaggle, ) to illustrate the performance of our conditional label screening method. The dataset comprises $n=70,692$ samples and 22 variables, including demographic attributes (e.g., sex, age, BMI), lifestyle-related features, as well as several binary health indicators. These indicators capture whether an individual has conditions such as diabetes, coronary heart disease, or has experienced a myocardial infarction, among others. Accordingly, we define the response variable Y as these disease-related binary labels, with the goal of predicting the risk of these conditions in test data. More specifically, the response vector $\textbf{Y}=(Y_{1},Y_{2},Y_{3})\in\{0,1\}^{3}$ is set as follows:

- •
$Y_{1}$: Indicates whether an individual has diabetes.
- •
$Y_{2}$: Indicates whether an individual has coronary heart disease or myocardial infarction.
- •
$Y_{3}$: Indicates whether an individual has experienced a stroke.

Consequently, the label screening targets are $Y_{s}\in\mathcal{A}_{s}=\{1\}$ for $s=1,2,3$.

Implementation details. We fix the size of the labeled data $\mathcal{D}_{1}$ at $n=500$ and the test data $\mathcal{D}_{2}$ at $m=2,000$, randomly sampling them from the original dataset without replacement in each replication. We fix the nominal level at $\alpha=0.05$, and apply two different algorithms to compute the score vectors: linear logistic regression (LL) and random forest (RF). We calculate the empirical marginal FWER and conditional FWER (conditional on ${\bf X}\in{\mathcal{B}}$ for a specific set ${\mathcal{B}}$) across 500 replications for the screening procedure via LCP-ls and the simple thresholding rule, respectively. The evaluation measures are defined as follows:

- •
(Marginal FWER): $\operatorname{mFWER}_{j}=\Pr\left(\sum_{s=1}^{S_{2j}}{\mathbb{I}}\{Y_{2j,s}
\notin{\mathcal{A}}_{s},\delta_{j,s}=1\}>0\right)$
- •
(Conditional FWER): $\operatorname{cFWER}_{ij}=\Pr\left(\sum_{s=1}^{S_{2j}}{\mathbb{I}}\{Y_{2j,s}
\notin{\mathcal{A}}_{s},\delta_{j,s}=1\}>0\mid{\bf X}\in{\mathcal{B}}\right)$ for $j\in\{1,\dots,m\}$, where ${\mathcal{B}}=\{{\bf X}\in\mathbb{R}^{d}:\text{sex}=\text{female}\;\text{and}
\;\text{BMI}>30\}$.

Results. We show the average of measures for all $m$ test samples. The results are reported in Table 3. We observe that both benchmarks can ensure valid marginal FWER control, while only the label screening procedure via the LCP-ls is capable of controlling both conditional and marginal FWER simultaneously.

**Table 3: Empirical conditional FWER (cFWER) and marginal FWER (mFWER) with nominal level $\alpha=0.05$ for the health indicator dataset. The brackets contain the standard errors.**
| Method | $\text{cFWER}_{\text{LL}}$ | $\text{cFWER}_{\text{RF}}$ | $\text{mFWER}_{\text{LL}}$ | $\text{mFWER}_{\text{RF}}$ |
| --- | --- | --- | --- | --- |
| LCP-ls | 0.0329 (0.018) | 0.0372 (0.018) | 0.0487 (0.009) | 0.0507 (0.009) |
| THR | 0.0740 (0.028) | 0.0887 (0.029) | 0.0500 (0.011) | 0.0538 (0.012) |

### 5.3 Two-sample conditional distribution test on the airfoil data

Dataset. Refer to previous related works (Hu and Lei, ; Chen and Lei, ), we consider using the airfoil dataset (Brooks et al., ) from the UCI Machine Learning Repository to demonstrate the effectiveness of our proposed LCT on real data. This dataset investigates the sound pressure of various airfoils with $n=1503$ observations of the response $Y$: the scaled sound pressure and the covariates ${\bf X}$ with $d=5$ dimensions: log frequency, angle of attack, chord length, free-stream velocity, and suction side log displacement thickness.

Implementation details. We use part of the rules in Hu and Lei () to split the observations into two samples as follows:

- (i)
Random partition. Randomly partition the dataset into two groups with sizes $|\mathcal{D}_{1}|=751$ and $|\mathcal{D}_{2}|=752$.
- (ii)
Exponential tilting. First randomly partition the data into $\mathcal{D}_{1},\tilde{\mathcal{D}}_{2}$. Then construct $\mathcal{D}_{2}$ by sampling 25% of the points from $\tilde{\mathcal{D}}_{2}$ with replacement, with probabilities proportional to $\omega(x)=\exp(x^{T}\alpha)$, where $\alpha=(-1,0,0,0,1)$.
- (iii)
Partition along the response. Split the data according to the value of response, where the first group contains the samples with smaller response values.

In the first two partitions, the two samples satisfy the null hypothesis. The first partition has samples from the same distribution, while the second shows a non-trivial covariate shift. In the last partition, the covariate shift assumption is not satisfied and the alternative hypothesis holds. For all three cases, we use the linear logistic (LL) and neural network (NN) to estimate the density ratios. All results are based on 500 replications.

Results. Similar to Hu and Lei (), we use out-of-sample marginal classification error as a proxy of the accuracy of marginal density ratio estimation for all cases. The percentage of rejections for cases (i-ii) are summarised in Table 4. The rejection proportions of both the LCT and DCT methods are close to the nominal level when using LL or NN algorithms, while the CT test fails to control the type I error when using the NN algorithm due to its low accuracy. For case (iii), we only have a single deterministic generation of the training and test data for each replication. We therefore report the median $p$-values for case (iii) in Table 5. While all three tests correctly reject the null, the LCT test gives the smallest $p$-value and is therefore the most powerful among all three tests.

**Table 4: Percentage of rejections (PR) and average classification error of $\widehat{g}$ (Err) in cases (i–ii) with nominal level $\alpha=0.05$. The brackets contain the standard errors.**
| Cases | Method | $\text{PR}_{\text{LL}}$ | $\text{PR}_{\text{NN}}$ | $\text{Err}_{\text{LL}}$ | $\text{Err}_{\text{NN}}$ |
| --- | --- | --- | --- | --- | --- |
| Case (i) | LCT | 0.054 (0.0325) | 0.053 (0.0374) | 0.429 | 0.608 |
| CT | 0.058 (0.0289) | 0.441 (0.0610) |  |  |  |
| DCT | 0.053 (0.0299) | 0.066 (0.0268) |  |  |  |
| Case (ii) | LCT | 0.067 (0.0323) | 0.066 (0.0390) | 0.213 | 0.367 |
| CT | 0.056 (0.0320) | 0.135 (0.0405) |  |  |  |
| DCT | 0.056 (0.0327) | 0.035 (0.0250) |  |  |  |

**Table 5: Median $p$-values (Pval) and average classification error of $\widehat{g}$ (Err) in case (iii) with nominal level $\alpha=0.05$.**
| Cases | Method | $\text{Pval}_{\text{LL}}$ | $\text{Pval}_{\text{NN}}$ | $\text{Err}_{\text{LL}}$ | $\text{Err}_{\text{NN}}$ |
| --- | --- | --- | --- | --- | --- |
| Case (iii) | LCT | 0.000 | 0.000 | 0.279 | 0.429 |
| CT | 0.000 | 0.022 |  |  |  |
| DCT | 0.000 | 0.018 |  |  |  |

## 6 Concluding remarks

We conclude the paper with two remarks. Firstly, the localized conformal prediction is efficient in capturing local or conditional information, but this comes at the cost of a much smaller effective sample size. In our simulation experiments, the power of localized methods grows significantly as the sample size increases in many scenarios. However, when the sample size is small, our proposed methods often exhibit lower power compared to other methods. Therefore, it would be beneficial to increase the effective sample size by utilizing additional data or modifying the definition of the LCP.

Secondly, we define the LCP with a random sampling step for each test point to achieve finite-sample validity. However, the random sampling step introduces external randomness, which degrades the stability of the related methods. Additionally, the LCP is defined by computing the similarity between covariates of the calibration data and the sampled covariate $\tilde{\bf X}$ instead of the test point ${\bf X}$ itself. Although these two issues are equivalent asymptotically, they generally differ in finite-samples. This makes the LCP not effective enough in characterizing local information. A potential solution is to use a different definition for the localized conformal $p$-value to ensure finite-sample validity without randomization, which warrants further consideration.

## Appendix A Technical details

### A.1 Proof of Theorem 2

Proof.
Denote $P_{1,\tilde{\bf X}},P_{2,\tilde{\bf X}}$ as the marginal distribution of $\tilde{\bf X}$ if we fist sample ${\bf X}$ from $P_{1,{\bf X}}$ or $P_{2,{\bf X}}$ and then sample $\tilde{\bf X}$ from $H({\bf X},\cdot)$. The distributions of the calibration and test points are $P_{1,({\bf X},Y)\mid\tilde{\bf X}}\times P_{1,\tilde{\bf X}}$ and $P_{2,({\bf X},Y)\mid\tilde{\bf X}}\times P_{2,\tilde{\bf X}}$ where $P_{1,({\bf X},Y)\mid\tilde{\bf X}}$ and $P_{2,({\bf X},Y)\mid\tilde{\bf X}}$ denote the corresponding conditional distributions of calibration and test data points.

Notice that the super-uniform property still holds if the conditional distribution $P_{1,({\bf X},Y)\mid\tilde{\bf X}}=P_{2,({\bf X},Y)\mid\tilde{\bf X}}$. Therefore, the super-uniform bound holds for an independent tuple $({\bf X}^{*},Y^{*},\tilde{\bf X}^{*})\sim P_{1,({\bf X},Y)\mid{\bf X}}\times P
_{2,\tilde{\bf X}}$. That is

$$ $p_{{\rm L}}^{*}=\frac{\sum_{i\in{\mathcal{C}}}H({\bf X}_{1i},\tilde{\bf X}^{*} ){\mathbb{I}}\{\tilde{V}^{*}\leq{V}_{1i}\}+\xi^{*}\cdot H({\bf X}^{*},\tilde{ \bf X}^{*})}{\sum_{i\in{\mathcal{C}}}H({\bf X}_{1i},\tilde{\bf X}^{*})+H({\bf X }^{*},\tilde{\bf X}^{*})},$ $$

$$ $\Pr(p_{{\rm L}}^{*}\leq\alpha)\leq\alpha.$ $$

The probability for $({\bf X}_{2n+j},Y_{2n+j},\tilde{\bf X}_{2n+j})$ is then upper bounded by

$$ $\displaystyle\Pr(p_{{\rm L},j}\leq\alpha)\leq$ $\displaystyle\alpha+{\mathbb{E}}_{\tilde{\bf X}\sim P_{2,\tilde{\bf X}}}\left \{{\rm d}_{\rm TV}\left(P_{1,({\bf X},Y)\mid\tilde{\bf X}},P_{2,({\bf X},Y) \mid\tilde{\bf X}}\right)\right\}$ $\displaystyle=$ $\displaystyle\alpha+{\mathbb{E}}_{\tilde{\bf X}\sim P_{2,\tilde{\bf X}}}\left \{{\rm d}_{\rm TV}\left(P_{1,{\bf X}\mid\tilde{\bf X}},P_{2,{\bf X}\mid\tilde{ \bf X}}\right)\right\}.$ $$

For a fixed $\tilde{\bf X}$ we have

$$ $\displaystyle{\rm d}_{\rm TV}\left(P_{1,{\bf X}\mid\tilde{\bf X}},P_{2,{\bf X} \mid\tilde{\bf X}}\right)=$ $\displaystyle\frac{1}{2}{\mathbb{E}}_{{\bf X}\sim P_{1,\tilde{\bf X}\mid{\bf X }}}\left\{\left|\frac{{\rm d}P_{2,{\bf X}\mid\tilde{\bf X}}({\bf X})}{{\rm d}P _{1,{\bf X}\mid\tilde{\bf X}}({\bf X})}-1\right|\right\}$ $\displaystyle=$ $\displaystyle\frac{1}{2}{\mathbb{E}}_{{\bf X}\sim P_{1,\tilde{\bf X}\mid{\bf X }}}\left\{\left|\frac{g({\bf X})}{{\mathbb{E}}_{{\bf X}^{\prime}\sim P_{1,{\bf X }\mid\tilde{\bf X}}}\{g({\bf X}^{\prime})\}}-1\right|\right\}$ $\displaystyle\leq$ $\displaystyle\frac{{\mathbb{E}}_{{\bf X},{\bf X}^{\prime}\sim P_{1,{\bf X}\mid \tilde{\bf X}}}\{|g({\bf X})-g({\bf X}^{\prime})|\}}{2{\mathbb{E}}_{{\bf X} \sim P_{1,{\bf X}\mid\tilde{\bf X}}}\{g({\bf X})\}}$ $\displaystyle=$ $\displaystyle{\mathbb{E}}_{{\bf X},{\bf X}^{\prime}\sim P_{1,{\bf X}\mid\tilde {\bf X}}}\{|g({\bf X})-g({\bf X}^{\prime})|\}\frac{{\mathbb{E}}_{{\bf X}\sim P _{1,{\bf X}}}\{H({\bf X},\tilde{\bf X})\}}{2{\mathbb{E}}_{{\bf X}\sim P_{1,{ \bf X}}}\{g({\bf X})H({\bf X},\tilde{\bf X})\}}.$ $$

Taking expectation with respect to $\tilde{\bf X}$ we have

$$ $\displaystyle{\mathbb{E}}_{\tilde{\bf X}\sim P_{2,\tilde{\bf X}}}\left\{{\rm d }_{\rm TV}\left(P_{1,{\bf X}\mid\tilde{\bf X}},P_{2,{\bf X}\mid\tilde{\bf X}} \right)\right\}$ $\displaystyle\leq$ $\displaystyle\int{\mathbb{E}}_{{\bf X}\sim P_{1,{\bf X}}}\{g({\bf X})H({\bf X} ,{\bf x})\}{\mathbb{E}}_{{\bf X},{\bf X}^{\prime}\sim P_{1,{\bf X}\mid\tilde{ \bf X}={\bf x}}}\{|g({\bf X})-g({\bf X}^{\prime})|\}\frac{{\mathbb{E}}_{{\bf X }\sim P_{1,{\bf X}}}\{H({\bf X},{\bf x})\}}{2{\mathbb{E}}_{{\bf X}\sim P_{1,{ \bf X}}}\{g({\bf X})H({\bf X},{\bf x})\}}{\rm d}{\bf x}$ $\displaystyle=$ $\displaystyle\frac{1}{2}\int{\mathbb{E}}_{{\bf X},{\bf X}^{\prime}\sim P_{1,{ \bf X}\mid\tilde{\bf X}={\bf x}}}\{|g({\bf X})-g({\bf X}^{\prime})|\}{\mathbb{ E}}_{{\bf X}\sim P_{1,{\bf X}}}\{H({\bf X},{\bf x})\}{\rm d}{\bf x}$ $\displaystyle=$ $\displaystyle\frac{1}{2}\int{\mathbb{E}}_{{\bf X},{\bf X}^{\prime}\sim P_{1,{ \bf X}\mid\tilde{\bf X}={\bf x}}}\{|g({\bf X})-g({\bf X}^{\prime})|\}{\mathbb{ E}}_{{\bf X}\sim P_{1,{\bf X}}}{\rm d}P_{H,{\bf X}}$ $$

where $P_{H,{\bf X}}$ has a density function $f_{H,{\bf X}}({\bf x})={\mathbb{E}}_{{\bf X}\sim P_{1,{\bf X}}}\{H({\bf X},{
\bf x})\}$.

By integration

$$ $\displaystyle{\mathbb{E}}_{{\bf X},{\bf X}^{\prime}\sim P_{1,{\bf X}\mid\tilde {\bf X}={\bf x}}}\{|g({\bf X})-g({\bf X}^{\prime})|\}$ $\displaystyle=$ $\displaystyle\int\frac{1}{h^{2d}}K\left(\frac{{\bf x}^{\prime}-{\bf x}}{h} \right)K\left(\frac{{\bf x}^{\prime\prime}-{\bf x}}{h}\right)f_{1,{\bf X}}({ \bf x}^{\prime})f_{1,{\bf X}}({\bf x}^{\prime\prime})|g({\bf x}^{\prime})-g({ \bf x}^{\prime\prime})|{\rm d}{\bf x}^{\prime}{\rm d}{\bf x}^{\prime\prime}$ $\displaystyle=$ $\displaystyle\int K({\bm{u}})K({\bm{v}})|g({\bf x}+h{\bm{u}})-g({\bf x}+h{\bm{ v}})|f_{1,{\bf X}}({\bf x}+h{\bm{u}})f_{1,{\bf X}}({\bf x}+h{\bm{v}}){\rm d}{ \bm{u}}{\rm d}{\bm{v}}$ $\displaystyle\leq$ $\displaystyle 2\|f_{1,{\bf X}}\|_{\infty}{\mathbb{E}}_{{\bm{U}}\sim K(\cdot)} \{|g({\bf x}+h{\bm{U}})-g({\bf x})|\}.$ $$

Combining the results above we conclude

$$ $\displaystyle\Pr(p_{{\rm L},j}\leq\alpha)\leq$ $\displaystyle\alpha+{\mathbb{E}}_{\tilde{\bf X}\sim P_{2,\tilde{\bf X}}}\left \{{\rm d}_{\rm TV}\left(P_{1,{\bf X}\mid\tilde{\bf X}},P_{2,{\bf X}\mid\tilde{ \bf X}}\right)\right\}$ $\displaystyle\leq$ $\displaystyle\alpha+\|f_{1,{\bf X}}\|_{\infty}{\mathbb{E}}_{{\bf X}\sim P_{H,{ \bf X}},{\bm{U}}\sim K(\cdot)}\{|g({\bf X}+h{\bm{U}})-g({\bf X})|\}.$ $$

$\hfill\qed$

### A.2 Proof of Theorem 3

Proof.

Remember the definition of the RBF and box kernel

$$ $H_{\rm RBF}({\bf x},{\bf x}^{\prime})=\frac{1}{V_{d,\rm RBF}h^{d}}\exp\left\{- \frac{\|{\bf x}-{\bf x}^{\prime}\|_{2}^{2}}{2h^{2}}\right\},\quad H_{\rm box}( {\bf x},{\bf x}^{\prime})=\frac{1}{V_{d,\rm box}h^{d}}{\mathbb{I}}\{\|{\bf x}- {\bf x}^{\prime}\|_{2}\leq\sqrt{2}h\}$ $$

where $V_{d,\rm RBF},V_{d,\rm box}$ are normalizing constants.

The LCP function is

$$ $p_{\rm L}({\bf x},y)=\frac{\sum_{i\in{\mathcal{C}}}H({\bf X}_{1i},\tilde{\bf X }){\mathbb{I}}\{{v}\leq{V}_{1i}\}+\xi\cdot H({\bf x},\tilde{\bf X})}{\sum_{i \in{\mathcal{C}}}H({\bf X}_{1i},\tilde{\bf X})+H({\bf x},\tilde{\bf X})}.$ (15) $$

For the difference we have

$$ $\displaystyle|p_{\rm L}({\bf x},y)-(1-F_{{V}\mid{\bf X}={\bf x}}({v}))|$ $\displaystyle=$ $\displaystyle\left|\frac{\sum_{i\in{\mathcal{C}}}H({\bf X}_{1i},\tilde{\bf X}) [{\mathbb{I}}\{{v}\leq{V}_{1i}\}-\{1-F_{{V}\mid{\bf X}={\bf x}}({v})\}]+[\xi- \{1-F_{{V}\mid{\bf X}={\bf x}}({v})\}]\cdot H({\bf x},\tilde{\bf X})}{\sum_{i \in{\mathcal{C}}}H({\bf X}_{1i},\tilde{\bf X})+H({\bf x},\tilde{\bf X})}\right|$ $\displaystyle\leq$ $\displaystyle\left|\frac{\sum_{i\in{\mathcal{C}}}H({\bf X}_{1i},\tilde{\bf X}) [{\mathbb{I}}\{{v}\leq{V}_{1i}\}-\{1-F_{{V}\mid{\bf X}={\bf x}}({v})\}]}{\sum_ {i\in{\mathcal{C}}}H({\bf X}_{1i},\tilde{\bf X})}\right|+\left|\frac{\|H({\bf x },{\bf x}^{\prime})\|_{\infty}}{\sum_{i\in{\mathcal{C}}}H({\bf X}_{1i},\tilde{ \bf X})}\right|$ $$

For the denominator $n_{H}=\sum_{i\in{\mathcal{C}}}H({\bf X}_{1i},\tilde{\bf X})$, first notice for the RBF kernel

$$ $\displaystyle n_{\rm RBF}$ $\displaystyle=\sum_{i\in{\mathcal{C}}}\frac{1}{V_{d,\rm RBF}h^{d}}\exp\left\{- \frac{\|{\bf X}_{1i}-\tilde{\bf X}\|_{2}^{2}}{2h^{2}}\right\}$ $\displaystyle\geq\exp\{-1\}\frac{V_{d,\rm box}}{V_{d,\rm RBF}}\sum_{i\in{ \mathcal{C}}}\frac{1}{V_{d,\rm box}h^{d}}{\mathbb{I}}\{\|{\bf X}_{1i}-\tilde{ \bf X}\|_{2}\leq\sqrt{2}h\}$ $\displaystyle=\exp\{-1\}\frac{V_{d,\rm box}}{V_{d,\rm RBF}}\cdot n_{\rm box}.$ $$

Define $n_{\rm box}^{*}=\sum_{i\in{\mathcal{C}}}{\mathbb{I}}\{\|{\bf X}_{1i}-\tilde{
\bf X}\|_{2}\leq\sqrt{2}h\}$, for constants $0<\lambda,\epsilon<1$ we have

$$ $\displaystyle\Pr\left({\mathbb{E}}(n_{\rm box}^{*})-n^{*}_{\rm box}\geq{ \lambda{\mathbb{E}}(n^{*}_{\rm box})}\mid\tilde{\bf X}\right)$ $\displaystyle=$ $\displaystyle\Pr\left(\exp\left\{{\mathbb{E}}(n^{*}_{\rm box})-n^{*}_{\rm box} \right\}\geq\exp\left\{\lambda{\mathbb{E}}(n^{*}_{\rm box})\right\}\mid\tilde{ \bf X}\right)$ $\displaystyle\leq$ $\displaystyle{\mathbb{E}}\left[\exp\left\{{\mathbb{E}}(n^{*}_{\rm box})-n^{*}_ {\rm box}\right\}\mid\tilde{\bf X}\right]\exp\left\{-\lambda{\mathbb{E}}(n^{*} _{\rm box})\right\}$ $\displaystyle=$ $\displaystyle{\mathbb{E}}\left[\exp\left\{{\mathbb{I}}\{{\bf X}^{\prime}\in B_ {\sqrt{2}h}(\tilde{\bf X})\}-\Pr({\bf X}^{\prime}\in B_{\sqrt{2}h}(\tilde{\bf X }))\right\}\mid\tilde{\bf X}\right]^{|{\mathcal{C}}|}\exp\left\{-\lambda{ \mathbb{E}}(n^{*}_{\rm box})\right\}$ $\displaystyle=$ $\displaystyle\left[\Pr({\bf X}\in B_{\sqrt{2}h}(\tilde{\bf X}))\exp\left\{\Pr( {\bf X}\notin B_{\sqrt{2}h}(\tilde{\bf X}))\right\}+\Pr({\bf X}\notin B_{\sqrt {2}h}(\tilde{\bf X}))\exp\left\{-\Pr({\bf X}\in B_{\sqrt{2}h}(\tilde{\bf X})) \right\}\right]^{|{\mathcal{C}}|}$ $\displaystyle\cdot\exp\left\{-\lambda{\mathbb{E}}(n^{*}_{\rm box})\right\}$ $\displaystyle\leq$ $\displaystyle\left[\Pr({\bf X}\in B_{\sqrt{2}h}(\tilde{\bf X}))\exp\{1\}+\{1- \Pr({\bf X}\in B_{\sqrt{2}h}(\tilde{\bf X}))\}\{1-\epsilon\cdot\Pr({\bf X}\in B _{\sqrt{2}h}(\tilde{\bf X}))\}\right]^{|{\mathcal{C}}|}\exp\left\{-\lambda{ \mathbb{E}}(n^{*}_{\rm box})\right\}$ $\displaystyle=$ $\displaystyle\left[1+(e-1-\epsilon)\Pr({\bf X}\in B_{\sqrt{2}h}(\tilde{\bf X}) )+\epsilon\Pr({\bf X}\in B_{\sqrt{2}h}(\tilde{\bf X}))^{2}\right]^{|{\mathcal{ C}}|}\exp\left\{-\lambda|{\mathcal{C}}|\Pr({\bf X}^{\prime}\in B_{\sqrt{2}h}( \tilde{\bf X}))\right\}$ $\displaystyle\leq$ $\displaystyle\exp\left\{-|{\mathcal{C}}|(1+\epsilon+\lambda-e)\Pr({\bf X}\in B _{\sqrt{2}h}(\tilde{\bf X}))+\epsilon|{\mathcal{C}}|\Pr({\bf X}\in B_{\sqrt{2} h}(\tilde{\bf X}))^{2}\right\}$ $$

and

$$ $2C_{d}h^{d}f({\bf x})\geq C_{d}h^{d}\{f({\bf x})+o(1)\}\geq\Pr({\bf X}\in B_{h }(\tilde{\bf X}))\geq C_{d}h^{d}\{f({\bf x})-o(1)\}\geq\frac{C_{d}h^{d}f({\bf x })}{2}$ $$

for sufficiently large $n$, where $C_{d}>0$ only depends on $d$. Taking $\epsilon=\lambda=0.9$ we have

$$ $\Pr\left(n_{\rm box}\geq\frac{|{\mathcal{C}}|f({\bf x})}{20V_{d,\rm box}} \right)\geq 1-\exp\left\{-\frac{2.8-e}{2}nh^{d}\gamma C_{d}f({\bf x})+3.6nh^{2 d}\gamma C_{d}^{2}f({\bf x})^{2}\right\}\to 1.$ $$

Therefore with probability tending to 1 we have $n_{H}\geq C\cdot|{\mathcal{C}}|f({\bf x})$ for some fixed constant $C>0$. Then

$$ $\displaystyle|p_{\rm L}({\bf x},y)-(1-F_{{V}\mid{\bf X}={\bf x}}({v}))|$ (16) $\displaystyle\leq$ $\displaystyle\frac{1}{Cf({\bf x})}\left\{\left|\frac{\sum_{i\in{\mathcal{C}}}H ({\bf X}_{1i},\tilde{\bf X})[{\mathbb{I}}\{{v}\leq{V}_{1i}\}-\{1-F_{{V}\mid{ \bf X}={\bf x}}({v})\}]}{|{\mathcal{C}}|}\right|+\left|\frac{1}{nh^{d}\gamma V _{d,H}}\right|\right\}.$ $$

For the first term

$$ $\displaystyle{\mathbb{E}}\left\{\frac{(\sum_{i\in{\mathcal{C}}}H({\bf X}_{1i}, \tilde{\bf X})[{\mathbb{I}}\{{v}\leq{V}_{1i}\}-\{1-F_{{V}\mid{\bf X}={\bf x}}( {v})\}])^{2}}{|{\mathcal{C}}|^{2}}\right\}$ $\displaystyle=$ $\displaystyle\frac{1}{|{\mathcal{C}}|}{\mathbb{E}}\left(H({\bf X}_{1i},\tilde{ \bf X})^{2}[{\mathbb{I}}\{{v}\leq{V}_{1i}\}-\{1-F_{{V}\mid{\bf X}={\bf x}}({v} )\}]^{2}\right)$ $\displaystyle+\frac{|{\mathcal{C}}|-1}{|{\mathcal{C}}|}{\mathbb{E}}\left(H({ \bf X}_{1i},\tilde{\bf X})H({\bf X}_{1j},\tilde{\bf X})[{\mathbb{I}}\{{v}\leq{ V}_{1i}\}-\{1-F_{{V}\mid{\bf X}={\bf x}}({v})\}]\cdot[{\mathbb{I}}\{{v}\leq{V} _{1j}\}-\{1-F_{{V}\mid{\bf X}={\bf x}}({v})\}]\right)$ $\displaystyle\leq$ $\displaystyle\frac{1}{|{\mathcal{C}}|}{\mathbb{E}}\left\{H({\bf X}_{1i},\tilde {\bf X})^{2}\right\}+{\mathbb{E}}\left\{H({\bf X}_{1i},\tilde{\bf X})H({\bf X} _{1j},\tilde{\bf X})\|F_{{V}\mid{\bf X}={\bf X}_{1i}}-F_{{V}\mid{\bf X}={\bf x }}\|_{\infty}\|F_{{V}\mid{\bf X}={\bf X}_{1j}}-F_{{V}\mid{\bf X}={\bf x}}\|_{ \infty}\right\}$ $$

By integration

$$ $\displaystyle{\mathbb{E}}\left\{H({\bf X}_{1i},\tilde{\bf X})^{2}\right\}$ $\displaystyle=$ $\displaystyle{\mathbb{E}}\left\{\int\frac{1}{h^{2d}}K^{2}\left(\frac{{\bf x}^{ \prime}-\tilde{\bf X}}{h}\right)f_{1,{\bf X}}({\bf x}^{\prime}){\rm d}{\bf x}^ {\prime}\right\}$ $\displaystyle=$ $\displaystyle\frac{1}{h^{d}}{\mathbb{E}}\left\{\int K^{2}\left({\bm{u}}\right) f_{1,{\bf X}}(\tilde{\bf X}+h{\bm{u}}){\rm d}{\bm{u}}\right\}$ $\displaystyle\leq$ $\displaystyle\frac{\|f_{1,{\bf X}}\|_{\infty}}{h^{d}}\int K^{2}({\bm{u}}){\rm d }{\bm{u}}$ $$

$$ $\displaystyle{\mathbb{E}}\left\{H({\bf X}_{1i},\tilde{\bf X})H({\bf X}_{1j}, \tilde{\bf X})\|F_{{V}\mid{\bf X}={\bf X}_{1i}}-F_{{V}\mid{\bf X}={\bf x}}\|_{ \infty}\|F_{{V}\mid{\bf X}={\bf X}_{1j}}-F_{{V}\mid{\bf X}={\bf x}}\|_{\infty}\right\}$ $\displaystyle=$ $\displaystyle{\mathbb{E}}\left\{\int\frac{1}{h^{2d}}K\left(\frac{{\bf x}^{ \prime}-\tilde{\bf X}}{h}\right)K\left(\frac{{\bf x}^{\prime\prime}-\tilde{\bf X }}{h}\right)\|F_{{V}\mid{\bf X}={\bf x}^{\prime}}-F_{{V}\mid{\bf X}={\bf x}}\| _{\infty}\|F_{{V}\mid{\bf X}={\bf x}^{\prime\prime}}-F_{{V}\mid{\bf X}={\bf x} }\|_{\infty}f_{1,{\bf X}}({\bf x}^{\prime})f_{1,{\bf X}}({\bf x}^{\prime\prime }){\rm d}{\bf x}^{\prime}{\rm d}{\bf x}^{\prime\prime}\right\}$ $\displaystyle\leq$ $\displaystyle\|f_{1,{\bf X}}\|_{\infty}^{2}{\mathbb{E}}\left\{\int K\left({\bm {u}}\right)K\left({\bm{u}}^{\prime}\right)\|F_{{V}\mid{\bf X}=\tilde{\bf X}+h{ \bm{u}}}-F_{{V}\mid{\bf X}={\bf x}}\|_{\infty}\|F_{{V}\mid{\bf X}=\tilde{\bf X }+h{\bm{u}}^{\prime}}-F_{{V}\mid{\bf X}={\bf x}}\|_{\infty}{\rm d}{\bm{u}}{\rm d }{\bm{u}}^{\prime}\right\}$ $\displaystyle\leq$ $\displaystyle\|f_{1,{\bf X}}\|_{\infty}^{2}{\mathbb{E}}\left\{\int K\left({\bm {u}}\right)K\left({\bm{u}}^{\prime}\right)\|\tilde{\bf X}-{\bf x}+h{\bm{u}}\|_ {2}^{\beta}\|\tilde{\bf X}-{\bf x}+h{\bm{u}}^{\prime}\|_{2}^{\beta}{\rm d}{\bm {u}}{\rm d}{\bm{u}}^{\prime}\right\}$ $\displaystyle=$ $\displaystyle\|f_{1,{\bf X}}\|_{\infty}^{2}\int K\left({\bm{u}}\right)K\left({ \bm{u}}^{\prime}\right)\|\tilde{\bf x}-{\bf x}+h{\bm{u}}\|_{2}^{\beta}\|\tilde {\bf x}-{\bf x}+h{\bm{u}}^{\prime}\|_{2}^{\beta}\frac{1}{h^{d}}H\left(\frac{ \tilde{\bf x}-{\bf x}}{h}\right){\rm d}{\bm{u}}{\rm d}{\bm{u}}^{\prime}{\rm d} \tilde{\bf x}$ $\displaystyle=$ $\displaystyle h^{2\beta}\|f_{1,{\bf X}}\|_{\infty}^{2}\int K\left({\bm{u}} \right)K\left({\bm{u}}^{\prime}\right)K\left({\bm{u}}^{\prime\prime}\right)\|{ \bm{u}}+{\bm{u}}^{\prime\prime}\|_{2}^{\beta}\|{\bm{u}}^{\prime}+{\bm{u}}^{ \prime\prime}\|_{2}^{\beta}{\rm d}{\bm{u}}{\rm d}{\bm{u}}^{\prime}{\rm d}{\bm{ u}}^{\prime\prime}$ $\displaystyle\leq$ $\displaystyle 3h^{2\beta}\|f_{1,{\bf X}}\|_{\infty}^{2}\left\{\left(\int K({ \bm{u}})\|{\bm{u}}\|_{2}^{\beta}{\rm d}{\bm{u}}\right)^{2}+\int K({\bm{u}})\|{ \bm{u}}\|_{2}^{2\beta}{\rm d}{\bm{u}}\right\}$ $$

As all integrations in the final expressions exist, we have

$$ $\displaystyle{\mathbb{E}}\left\{\frac{(\sum_{i\in{\mathcal{C}}}H({\bf X}_{1i}, \tilde{\bf X})[{\mathbb{I}}\{{v}\leq{V}_{1i}\}-\{1-F_{{V}\mid{\bf X}={\bf x}}( {v})\}])^{2}}{|{\mathcal{C}}|^{2}}\right\}$ $\displaystyle\leq$ $\displaystyle\frac{C_{K,1}\|f_{1,{\bf X}}\|_{\infty}}{nh^{d}}+C_{K,2}\|f_{1,{ \bf X}}\|_{\infty}^{2}h^{2\beta}.$ $$

Together with inequality (16) we complete the proof.$\hfill\qed$

### A.3 Proof of Theorem 4

Proof.
By the construction of the refined LCP’s, they are valid conditional on the event $Y_{2j}\notin{\mathcal{A}}$ in finite sample

$$ $\Pr(p_{{\rm r}{\rm L},j}\leq\alpha)\leq\alpha,$ $$

and marginal PSER control result is proved. For the conditional PSER inflation bound, the proof is exactly the same to Theorem 7 with the only difference that the distribution of ${\bf X}$ is replaced by the conditional distribution of ${\bf X}$ given the event $Y\notin{\mathcal{A}}$. We therefore delay the computation of the deviation term to the proof of Theorem 7.

### A.4 Proof of Theorem 5

Proof.

Denote the index set of inliers in ${\mathcal{D}}_{2}$ as ${\mathbb{H}}_{0}^{*}$, We firstly need a lemma commonly used in literature relating the conditional calibration technique.

###### Lemma A.1 .

The pruned rejection set ${\mathcal{R}}$ satisfies

$$ $\mathrm{FDR}={\mathbb{E}}\left[\frac{\sum_{j=1}^{m}{\mathbb{I}}\{j\in{\mathcal {R}},j\in{\mathbb{H}}_{0}^{*}\}}{|{\mathcal{R}}|\vee 1}\right]\leq\sum_{j=1}^{ m}{\mathbb{E}}\left[\frac{{\mathbb{I}}\{p_{{\rm L},j}\leq\frac{\alpha|\widehat {{\mathcal{R}}}_{j\to 0}|}{m},j\in{\mathbb{H}}_{0}^{*}\}}{|\widehat{{\mathcal{ R}}}_{j\to 0}|}\right].$ $$

The proof of Lemma A.1 can be found in Jin and Candès () and is therefore omitted.

Denote ${\bf Z}_{1i}$ and ${\bf Z}_{2j}$ as tuples ${\bf Z}_{1i}=({\bf X}_{1i},Y_{1i}),{\bf Z}_{2j}=({\bf X}_{2j},Y_{2j})$ and the index set of calibration data ${\mathcal{C}}=\{i_{1},i_{2},\dots,i_{n_{c}}\}$ where $|{\mathcal{C}}|=n_{c}$. Let ${\mathcal{Z}}=[{\bf Z}_{1i_{1}},\dots,{\bf Z}_{1i_{n_{c}}},{\bf Z}_{2j}]$ be the unordered value set of ${\bf Z}_{1i_{1}},\dots,{\bf Z}_{1i_{n_{c}}},{\bf Z}_{2j}$. Let $\tilde{\mathcal{X}}=\{\tilde{\bf X}_{21},\dots,\tilde{\bf X}_{2m}\}$ be the set of all sampled covariates. Note that the unordered value set $[p_{{\rm L},l}^{(j)}]_{l\neq j}$ are fully determined by $\tilde{\mathcal{X}}$, ${\mathcal{Z}}$ and $\{{\bf Z}_{2l}\}_{l\neq j}$. Moreover, the $p$-value $p_{{\rm L},j}$ is fully determined by $\tilde{\bf X}_{2j}$, ${\mathcal{Z}}$ and ${\bf Z}_{2j}$. As $\{{\bf Z}_{2l}\}_{l\neq j}$ is independent of $\{{\bf Z}_{1i_{1}},\dots,{\bf Z}_{1i_{n_{c}}},{\bf Z}_{2j}\}$ conditional on $\tilde{\mathcal{X}}$, we know $p_{{\rm L},j}$ is independent of $\{p_{{\rm L},l}^{(j)}\}_{l\neq j}$ conditional on $\tilde{\mathcal{X}}$ and ${\mathcal{Z}}$. By the fact that $|\widehat{{\mathcal{R}}}_{j\to 0}|$ is fully determined by $[p_{{\rm L},l}^{(j)}]_{l\neq j}$, we further have

$$ $p_{{\rm L},j}\perp\!\!\!\perp|\widehat{{\mathcal{R}}}_{j\to 0}|\;\Big{|}\; \tilde{\mathcal{X}},{\mathcal{Z}}.$ $$

By the independency we have

$$ $\displaystyle{\mathbb{E}}\left[\frac{{\mathbb{I}}\{p_{{\rm L},j}\leq\frac{ \alpha|\widehat{{\mathcal{R}}}_{j\to 0}|}{m},j\in{\mathbb{H}}_{0}\}}{|\widehat {{\mathcal{R}}}_{j\to 0}|}\;\Big{|}\;\tilde{\mathcal{X}},{\mathcal{Z}}\right]$ $\displaystyle\leq{\mathbb{E}}\left[\frac{{\mathbb{I}}\{p_{{\rm L},j}\leq\frac{ \alpha|\widehat{{\mathcal{R}}}_{j\to 0}|}{m}\}}{|\widehat{{\mathcal{R}}}_{j\to 0 }|}\;\Big{|}\;\tilde{\mathcal{X}},{\mathcal{Z}}\right]$ $\displaystyle=\frac{\Pr\left(p_{{\rm L},j}\leq\frac{\alpha|\widehat{{\mathcal{ R}}}_{j\to 0}|}{m}\;\Big{|}\;\tilde{\mathcal{X}},{\mathcal{Z}}\right)}{| \widehat{{\mathcal{R}}}_{j\to 0}|}$ $\displaystyle\leq\frac{\Pr\left(p_{{\rm L},j}^{*}\leq\frac{\alpha|\widehat{{ \mathcal{R}}}_{j\to 0}|}{m}\;\Big{|}\;\tilde{\mathcal{X}},{\mathcal{Z}}\right) }{|\widehat{{\mathcal{R}}}_{j\to 0}|}.$ $$

where

$$ $p_{{\rm L},j}^{*}=\frac{\sum_{i\in{\mathcal{C}}}H({\bf X}_{1i},\tilde{\bf X}_{ 2j})({\mathbb{I}}\{{V}_{2j}<{V}_{1i}\}+\xi_{j}\cdot{\mathbb{I}}\{{V}_{2j}={V}_ {1i}\})+\xi_{j}\cdot H({\bf X}_{2j},\tilde{\bf X}_{2j})}{\sum_{i\in{\mathcal{C }}}H({\bf X}_{1i},\tilde{\bf X}_{2j})+H({\bf X}_{2j},\tilde{\bf X}_{2j})}.$ $$

By the weighted exchangeability, $p_{{\rm L},j}^{*}\mid\tilde{\mathcal{X}},{\mathcal{Z}}\sim{\rm U}[0,1]$. Taking the expectation we have

$$ $\displaystyle\mathrm{FDR}\leq\sum_{j=1}^{m}{\mathbb{E}}\left[{\mathbb{E}}\left \{\frac{{\mathbb{I}}\{p_{{\rm L},j}\leq\frac{\alpha|\widehat{{\mathcal{R}}}_{j \to 0}|}{m}\}}{|\widehat{{\mathcal{R}}}_{j\to 0}|}\;\Big{|}\;\tilde{\mathcal{X }},{\mathcal{Z}}\right\}\right]$ $\displaystyle\leq\sum_{j=1}^{m}{\mathbb{E}}\left\{\frac{\Pr\left(p_{{\rm L},j} ^{*}\leq\frac{\alpha|\widehat{{\mathcal{R}}}_{j\to 0}|}{m}\;\Big{|}\;\tilde{ \mathcal{X}},{\mathcal{Z}}\right)}{|\widehat{{\mathcal{R}}}_{j\to 0}|}\right\}$ $\displaystyle=\sum_{j=1}^{m}\frac{\alpha}{m}=\alpha,$ $$

which completes the proof.$\hfill\qed$

###### Lemma A.1 .

### A.5 Proof of Theorem 6

Define the uncomputable oracle $p$-value as

$$ $p_{{\rm L},j}^{*}=\frac{\sum_{i\in{\mathcal{C}}}H({\bf X}_{1i},\tilde{\bf X}_{ 2j}){\mathbb{I}}\{\bar{V}_{2j}\leq\bar{V}_{1i}\}+\xi_{j}\cdot H({\bf X}_{2j}, \tilde{\bf X}_{2j})}{\sum_{i\in{\mathcal{C}}}H({\bf X}_{1i},\tilde{\bf X}_{2j} )+H({\bf X}_{2j},\tilde{\bf X}_{2j})}.$ $$

By Theorem 1, if $\{({\bf X}_{1i},{\bf Y}_{1i},S_{1i})\}_{i\in{\mathcal{C}}}\cup\{({\bf X}_{2j},
{\bf Y}_{2j},S_{2j})\}_{j=1}^{m}$ are exchangeable, this oracle $p$-value will be super-uniform

$$ $\Pr(p_{{\rm L},j}^{*}\leq\alpha)\leq\alpha.$ $$

Note that $\bar{V}_{2j}=\max\{{V}_{2j,s}:Y_{2j,s}\notin{\mathcal{A}}_{s}\}$. This indicates

$$ $p_{{\rm L},j}^{*}=\min\{p_{{\rm L},j,s}:Y_{2j,s}\notin{\mathcal{A}}_{s}\}.$ $$

By direct tranformation we have

$$ $\displaystyle{\rm FWER}$ $\displaystyle=\Pr\left(\sum_{s=1}^{S_{2j}}{\mathbb{I}}\{Y_{2j,s}\notin{ \mathcal{A}}_{s},p_{{\rm L},j,s}\leq\alpha\}>0\right)$ $\displaystyle=\Pr\left(\bigcup_{Y_{2j,s}\notin{\mathcal{A}}_{s}}\{p_{{\rm L},j ,s}\leq\alpha\}\right)$ $\displaystyle=\Pr(p_{{\rm L},j}^{*}\leq\alpha)\leq\alpha,$ $$

which completes the proof.$\hfill\qed$

### A.6 Proof of Theorem 7

Proof.
By our screening procedure, the conditional FWER can be transformed as

$$ $\displaystyle\Pr\left(\sum_{s=1}^{S_{2j}}{\mathbb{I}}\{Y_{2j,s}\notin{\mathcal {A}}_{s},\delta_{j,s}=1\}>0\;\Big{|}\;{\bf X}_{2j}\in{\mathcal{B}}\right)$ $\displaystyle=\Pr\left(\bigcup_{Y_{2j,s}\notin{\mathcal{A}}_{s}}\{p_{{\rm L},j ,s}\leq\alpha\}\;\Big{|}\;{\bf X}_{2j}\in{\mathcal{B}}\right)$ $\displaystyle=\Pr(p_{{\rm L},j}^{*}\leq\alpha\mid{\bf X}_{2j}\in{\mathcal{B}}).$ $$

Since we assume exchangeability, this is equivalent to the covariate shift setting with $g({\bf x})={\mathbb{I}}\{{\bf x}\in{\mathcal{B}}\}/\Pr({\bf X}_{2j}\in{
\mathcal{B}})$. Therefore, we only need to compute the excess term in Theorem 2 with this specific $g$. By transformation

$$ $\displaystyle{\mathbb{E}}_{{\bm{U}}\sim K(\cdot)}\{|g({\bf x}+h{\bm{U}})-g({ \bf x})|\}$ $\displaystyle=$ $\displaystyle\frac{1}{\Pr({\bf X}_{2j}\in{\mathcal{B}})}\int K({\bm{u}})({ \mathbb{I}}\{x+h{\bm{u}}\in{\mathcal{B}},{\bf x}\notin{\mathcal{B}}\}+{\mathbb {I}}\{x+h{\bm{u}}\notin{\mathcal{B}},{\bf x}\in{\mathcal{B}}\}){\rm d}{\bm{u}}$ $\displaystyle\leq$ $\displaystyle\frac{2}{\Pr({\bf X}_{2j}\in{\mathcal{B}})}\int K({\bm{u}}){ \mathbb{I}}\{\|{\bm{u}}\|_{2}\geq h^{-1}d({\bf x},\partial{\mathcal{B}})\}{\rm d }{\bm{u}}$ $\displaystyle=$ $\displaystyle 2\cdot\frac{\Pr_{{\bm{U}}\sim K(\cdot)}(\|{\bm{U}}\|_{2}\geq h^{ -1}d({\bf x},\partial{\mathcal{B}}))}{\Pr({\bf X}_{2j}\in{\mathcal{B}})}.$ $$

Following the same proof to Theorem 2 we conclude

$$ $\Pr\left(\sum_{s=1}^{S_{2j}}{\mathbb{I}}\{Y_{2j,s}\notin{\mathcal{A}}_{s}, \delta_{j,s}=1\}>0\;\Big{|}\;{\bf X}_{2j}\in{\mathcal{B}}\right)\leq\alpha+2\| f_{1,{\bf X}}\|_{\infty}\frac{\Pr_{{\bf X}\sim P_{H,{\bf X}},{\bm{U}}\sim K( \cdot)}(\|U\|_{2}\geq h^{-1}d({\bf X},\partial{\mathcal{B}}))}{\Pr({\bf X}_{2j }\in{\mathcal{B}})}.$ $$

$\hfill\qed$

### A.7 Proof of Theorem 8

Proof.
Remember that we assume $n_{1}=n_{2}$ in the main text. We first introduce a lemma about our defined U-statistic.

###### Lemma A.2 .

For some kernel function $k({\bf z},{\bf z}^{\prime})$ depending on $n_{1}$, define the two-sample U-statistic and its projection as

$$ $U_{n_{1}}=\frac{1}{n_{1}^{2}}\sum_{i=1}^{n_{1}}\sum_{j=1}^{n_{1}}k({\bf Z}_{1i },{\bf Z}_{2j})$ $$

and

$$ $\widehat{U}_{n_{1}}=\frac{1}{n_{1}}\sum_{i=1}^{n_{1}}{\mathbb{E}}\{k({\bf Z}_{ 1i},{\bf Z}_{21})\mid{\bf Z}_{1i}\}+\frac{1}{n_{1}}\sum_{j=1}^{n_{1}}{\mathbb{ E}}\{k({\bf Z}_{11},{\bf Z}_{21})\mid{\bf Z}_{2j}\}-{\mathbb{E}}\{k({\bf Z}_{1 i},{\bf Z}_{2j})\}.$ $$

Then if ${\mathbb{E}}\{k({\bf Z}_{1i},{\bf Z}_{2j})^{2}\}=o(n_{1})$, $U_{n_{1}}$ and $\widehat{U}_{n_{1}}$ satisfy

$$ $\sqrt{n_{1}}(U_{n_{1}}-\widehat{U}_{n_{1}})=o_{p}(1).$ $$

This theorem is an extension of Lemma 3.1 in Powell et al. () which constructs a similar result for one sample U-statistics of degree 2. The proof follows exactly the same and is therefore omitted.

Denote the unnormalized version of $\widehat{T}_{w}$ and its projection as $\widehat{T}^{*}_{w}$ and $\widehat{T}^{*}_{w,p}$. In our defined statistic $k({\bf Z}_{1i},{\bf Z}_{2j})=H({\bf X}_{1i},{\bf X}_{2j})\widehat{D}_{ij}$. We first check the condition in Lemma A.2. By integration and $\widehat{D}_{ij}<1$

$$ $\displaystyle{\mathbb{E}}\{k({\bf Z}_{1i},{\bf Z}_{2j})^{2}\}\leq$ $\displaystyle{\mathbb{E}}\{H({\bf X}_{1i},{\bf X}_{2j})^{2}\}$ $\displaystyle=$ $\displaystyle\int\frac{1}{h^{2}d}K\left(\frac{{\bf x}^{\prime}-{\bf x}}{h} \right)f_{1,{\bf X}}({\bf x})f_{2,{\bf X}}({\bf x}^{\prime}){\rm d}{\bf x}{\rm d }{\bf x}^{\prime}$ $\displaystyle=$ $\displaystyle\frac{1}{h^{d}}\int K({\bm{u}})^{2}f_{1,{\bf X}}({\bf x})f_{2,{ \bf X}}({\bf x}+h{\bm{u}}){\rm d}{\bf x}{\rm d}{\bm{u}}$ $\displaystyle\leq$ $\displaystyle\frac{1}{h^{d}}\int K({\bm{u}})^{2}{\rm d}{\bm{u}}.$ $$

Together with the assumption $n_{1}h^{d}\to\infty$ we have ${\mathbb{E}}\{k({\bf Z}_{1i},{\bf Z}_{2j})^{2}\}=o(n_{1})$.

Define the centralized projection statistics as $\psi_{1,n_{1}}({\bf Z}_{1i})={\mathbb{E}}\{k({\bf Z}_{1i},{\bf Z}_{21})\mid{
\bf Z}_{1i}\},\psi_{2,n_{1}}({\bf Z}_{2j})={\mathbb{E}}\{k({\bf Z}_{11},{\bf Z
}_{2j})\mid{\bf Z}_{2j}\}$ and

$$ $\psi_{1,n_{1}}=\frac{1}{n_{1}}\sum_{i=1}^{n_{1}}{\mathbb{E}}\{k({\bf Z}_{1i},{ \bf Z}_{21})\mid{\bf Z}_{1i}\}-{\mathbb{E}}\{k({\bf Z}_{1i},{\bf Z}_{2j})\},$ $$

$$ $\psi_{2,n_{1}}=\frac{1}{n_{1}}\sum_{j=1}^{m_{1}}{\mathbb{E}}\{k({\bf Z}_{11},{ \bf Z}_{2j})\mid{\bf Z}_{2j}\}-{\mathbb{E}}\{k({\bf Z}_{1i},{\bf Z}_{2j})\}.$ $$

The projection can be decomposed as

$$ $\displaystyle\psi_{1,n_{1}}({\bf Z}_{1i})=$ $\displaystyle{\mathbb{E}}\{k({\bf Z}_{1i},{\bf Z}_{21})\mid{\bf Z}_{1i}\}$ $\displaystyle=$ $\displaystyle\int\frac{1}{h^{d}}K\left(\frac{{\bf x}-{\bf X}_{1i}}{h}\right) \left[\frac{1}{2}-{\mathbb{I}}\{{V}_{1i}<{V}({\bf x},y)\}-\frac{1}{2}{\mathbb{ I}}\{{V}_{1i}={V}({\bf x},y)\}\right]f_{2,{\bf X}}({\bf x})f_{2}(y\mid{\bf x}) {\rm d}{\bf x}{\rm d}y$ $\displaystyle=$ $\displaystyle\int K({\bm{u}})\left[\frac{1}{2}-{\mathbb{I}}\{{V}_{1i}<{V}({\bf X }_{1i}+h{\bm{u}},y)\}-\frac{1}{2}{\mathbb{I}}\{{V}_{1i}={V}({\bf X}_{1i}+h{\bm {u}},y)\}\right]$ $\displaystyle\cdot f_{2,{\bf X}}({\bf X}_{1i}+h{\bm{u}})f_{2}(y\mid{\bf X}_{1i }+h{\bm{u}}){\rm d}{\bm{u}}{\rm d}y$ $\displaystyle=$ $\displaystyle\int K({\bm{u}})\left[\frac{1}{2}-{\mathbb{I}}\{{V}_{1i}<\widehat {V}^{*}({\bf X}_{1i},y)\}-\frac{1}{2}{\mathbb{I}}\{{V}_{1i}=\widehat{V}^{*}({ \bf X}_{1i},y)\}\right]f_{2,{\bf X}}({\bf X}_{1i})f_{2}(y\mid{\bf X}_{1i}){\rm d }{\bm{u}}{\rm d}y$ $\displaystyle+\psi_{1,n_{1},r}({\bf Z}_{1i}).$ $\displaystyle=$ $\displaystyle\psi_{1}({\bf Z}_{1i})+\psi_{1,n_{1},r}({\bf Z}_{1i}).$ $$

By Assumption 1 and $h\to 0$ we know $\psi_{1,n_{1},r}({\bf Z}_{1i})=o_{p}(1)$. Similar results also hold for $\psi_{2,n_{1}}({\bf Z}_{2j})$ and $\psi_{2,n_{1},r}({\bf Z}_{2j})$.

Note that under the null hypothesis $v({\bf x},y)\equiv 1$. So we have

$$ ${\mathbb{E}}\{H({\bf X}_{1i},{\bf X}_{2j})D_{ij}\}={\mathbb{E}}\left\{H({\bf X }_{1i},{\bf X}_{2j})\left(\frac{1}{2}-\xi_{j}\right)\right\}=0$ $$

If Assumption 2 holds then

$$ $\sqrt{n_{1}}{\mathbb{E}}\{H({\bf X}_{1i},{\bf X}_{2j})\widehat{D}_{ij}\}=\sqrt {n_{1}}{\mathbb{E}}\{H({\bf X}_{1i},{\bf X}_{2j})(\widehat{D}_{ij}-D_{ij})\}=o _{p}(1)$ $$

If $P_{1,{\bf X}}=P_{2,{\bf X}}$ then under the null hypothesis we have $P_{1}=P_{2}$ and therefore ${\mathbb{E}}\{H({\bf X}_{1i},{\bf X}_{2j})\widehat{D}_{ij}\}=0$ by symmetric.

Now the statistic can be decomposed as

$$ $\displaystyle\widehat{T}^{*}_{w}=$ $\displaystyle(\widehat{T}^{*}_{w}-\widehat{T}^{*}_{w,r})+\frac{1}{n_{1}}\sum_{ i=1}^{n_{1}}[\psi_{1}({\bf Z}_{1i})-{\mathbb{E}}\{\psi_{1}({\bf Z}_{1i})\}]+ \frac{1}{n_{1}}\sum_{j=1}^{n_{1}}[\psi_{2}({\bf Z}_{2j})-{\mathbb{E}}\{\psi_{2 }({\bf Z}_{2j})\}]$ $\displaystyle+\frac{1}{n_{1}}\sum_{i=1}^{n_{1}}[\psi_{1,n_{1},r}({\bf Z}_{1i}) -{\mathbb{E}}\{\psi_{1,n_{1},r}({\bf Z}_{1i})\}]+\frac{1}{n_{1}}\sum_{j=1}^{n_ {1}}[\psi_{2,n_{1},r}({\bf Z}_{2j})-{\mathbb{E}}\{\psi_{2,n_{1},r}({\bf Z}_{2j })\}]$ $\displaystyle+{\mathbb{E}}\{H({\bf X}_{1i},{\bf X}_{2j})\widehat{D}_{ij}\}$ $\displaystyle=$ $\displaystyle\frac{1}{n_{1}}\sum_{i=1}^{n_{1}}[\psi_{1}({\bf Z}_{1i})-{\mathbb {E}}\{\psi_{1}({\bf Z}_{1i})\}]+\frac{1}{n_{1}}\sum_{j=1}^{n_{1}}[\psi_{2}({ \bf Z}_{2j})-{\mathbb{E}}\{\psi_{2}({\bf Z}_{2j})\}]+o_{p}(1/\sqrt{n_{1}}).$ $$

As $\psi_{1}({\bf Z}_{1i})$ and $\psi_{2}({\bf Z}_{2j})$ are independent random variables not depending on $n_{1}$, we have

$$ $\frac{\widehat{T}_{w}^{*}}{\sigma_{n_{1}}}\stackrel{{\scriptstyle d}}{{\to}}N \left(0,1\right).$ (17) $$

where

$$ $\sigma^{2}_{n_{1}}=\frac{1}{n_{1}}{\rm Var}\{\psi_{1}({\bf Z}_{1i})\}+\frac{1} {n_{1}}{\rm Var}\{\psi_{2}({\bf Z}_{2j})\}.$ $$

Hereafter we only need to prove the consistency of the variance estimator. Denote $\sigma_{n_{1}}^{*2}={\rm Var}(\widehat{T}^{*}_{w})$, the non-asymptotic variance can be decomposed as

$$ $\displaystyle\sigma_{n_{1}}^{*2}=$ $\displaystyle\frac{1}{n_{1}^{2}}{\mathbb{E}}\{H({\bf X}_{1i},{\bf X}_{2j})^{2} \widehat{D}_{ij}^{2}\}+\frac{n_{1}-1}{n_{1}^{2}}{\mathbb{E}}\left\{H({\bf X}_{ 1i},{\bf X}_{2j})H({\bf X}_{1k},{\bf X}_{2j})\widehat{D}_{ij}\widehat{D}_{kj}\right\}$ $\displaystyle+\frac{n_{1}-1}{n_{1}^{2}}{\mathbb{E}}\left\{H({\bf X}_{1i},{\bf X }_{2j})H({\bf X}_{1i},{\bf X}_{2k})\widehat{D}_{ij}\widehat{D}_{ik}\right\}- \frac{2n_{1}-1}{n_{1}^{2}}{\mathbb{E}}\left[\left\{H({\bf X}_{1i},{\bf X}_{2j} )\widehat{D}_{ij}\right\}\right]^{2}$ $$

By similar integration computation, the cross-term expectation converges to ${\rm Var}\{\psi_{1}({\bf Z}_{1i})\}$ and ${\rm Var}\{\psi_{2}({\bf Z}_{2j})\}$ in probability. Removing the vanishing term we have $\sigma_{n_{1}}^{*2}-\sigma_{n_{1}}^{2}=o_{p}(1/n_{1})$ and $\sigma_{n_{1}}^{*}/\sigma_{n_{1}}\stackrel{{\scriptstyle p}}{{\to}}1$.

The variance estimator $\widehat{\sigma}_{w}^{2}$ takes the form

$$ $\displaystyle\widehat{\sigma}_{w}^{2}=$ $\displaystyle\frac{1}{n_{1}^{2}}\sum_{i=1}^{n_{1}}\left\{\frac{1}{n_{1}}\sum_{ j=1}^{n_{1}}H({\bf X}_{1i},{\bf X}_{2j})\widehat{D}_{ij}\right\}^{2}+\frac{1}{ n_{1}^{2}}\sum_{j=1}^{n_{1}}\left\{\frac{1}{n_{1}}\sum_{i=1}^{n_{1}}H({\bf X}_ {1i},{\bf X}_{2j})\widehat{D}_{ij}\right\}^{2}$ $\displaystyle-\frac{1}{n_{1}^{4}}\sum_{i=1}^{n_{1}}\sum_{j=1}^{n_{1}}H({\bf X} _{1i},{\bf X}_{2j})^{2}\widehat{D}_{ij}^{2}-\frac{2}{n_{1}}\left\{\frac{1}{n_{ 1}^{2}}\sum_{i=1}^{n_{1}}\sum_{j=1}^{n_{1}}H({\bf X}_{1i},{\bf X}_{2j}) \widehat{D}_{ij}\right\}^{2}$ $\displaystyle=$ $\displaystyle\frac{1}{n_{1}^{2}}\left\{\frac{1}{n_{1}^{2}}\sum_{i=1}^{n_{1}} \sum_{j=1}^{n_{1}}H({\bf X}_{1i},{\bf X}_{2j})^{2}\widehat{D}_{ij}^{2}\right\} +\frac{1}{n_{1}}\cdot\frac{1}{n_{1}^{3}}\sum_{i=1}^{n_{1}}\sum_{j\neq k}H({\bf X }_{1i},{\bf X}_{2j})H({\bf X}_{1i},{\bf X}_{2k})\widehat{D}_{ij}\widehat{D}_{ik}$ $\displaystyle+\frac{1}{n_{1}}\cdot\frac{1}{n_{1}^{3}}\sum_{j=1}^{n_{1}}\sum_{1 \neq k}H({\bf X}_{1i},{\bf X}_{2j})H({\bf X}_{1k},{\bf X}_{2j})\widehat{D}_{ij }\widehat{D}_{kj}-\frac{2}{n_{1}}\left\{\frac{1}{n_{1}^{2}}\sum_{i=1}^{n_{1}} \sum_{j=1}^{n_{1}}H({\bf X}_{1i},{\bf X}_{2j})\widehat{D}_{ij}\right\}^{2}$ $$

It is easy to see that $\widehat{\sigma}^{2}_{w}$ consists of term-wise approximations of the expectations in $\sigma_{n_{1}}^{*2}$. By further computing the second moments of the estimators and Markov’s inequality we have $\widehat{\sigma}_{w}^{2}-\sigma^{*2}_{n_{1}}=o_{p}(1/n_{1})$. Together with (17) we conclude

$$ $\widehat{T}_{w}=\frac{\widehat{T}_{w}^{*}}{\widehat{\sigma}_{w}}\stackrel{{ \scriptstyle d}}{{\to}}N(0,1).$ $$

$\hfill\qed$

###### Lemma A.2 .

### A.8 Proof of Theorem 9

Proof.
By the same proof with Theorem 5 we know

$$ $\frac{\widehat{T}_{w}^{*}-{\mathbb{E}}\{H({\bf X}_{1i},{\bf X}_{2j})\widehat{D }_{ij}\}}{\widehat{\sigma}_{w}}\stackrel{{\scriptstyle d}}{{\to}}Z\sim N(0,1).$ (18) $$

By Assumption 2 we have ${\mathbb{E}}\{H({\bf X}_{1i},{\bf X}_{2j})(\widehat{D}_{ij}-D_{ij})\}=o_{p}(1/
\sqrt{n_{1}})$. Combining with the consistency of $\widehat{\sigma}_{w}$ we know $\sqrt{n_{1}}\widehat{\sigma}_{w}/\sigma_{w}\stackrel{{\scriptstyle p}}{{\to}}1$ and

$$ $\frac{\widehat{T}_{w}^{*}-{\mathbb{E}}\{H({\bf X}_{1i},{\bf X}_{2j})\widehat{D }_{ij}\}}{\widehat{\sigma}_{w}}=Z+\frac{{\mathbb{E}}\{H({\bf X}_{1i},{\bf X}_{ 2j}){D}_{ij}\}}{\sigma_{w}/\sqrt{n_{1}}}(1+o_{p}(1))+o_{p}(1).$ $$

The rest is to compute the bias term ${\mathbb{E}}\{H({\bf X}_{1i},{\bf X}_{2j}){D}_{ij}\}$. By integration

$$ $\displaystyle{\mathbb{E}}\{H({\bf X}_{1i},{\bf X}_{2j}){D}_{ij}\}$ $\displaystyle=$ $\displaystyle\int\frac{1}{h^{d}}K\left(\frac{{\bf x}_{1}-{\bf x}_{2}}{h}\right )\left[\frac{1}{2}-{\mathbb{I}}\{V^{*}({\bf x}_{1},y_{1})<V^{*}({\bf x}_{2},y_ {2})\}\right]f_{1,{\bf X}}({\bf x}_{1})f_{2,{\bf X}}({\bf x}_{2})f_{1}(y_{1} \mid{\bf x}_{1})f_{2}(y_{2}\mid{\bf x}_{2}){\rm d}{\bf x}_{1}{\rm d}{\bf x}_{2 }{\rm d}y_{1}{\rm d}y_{2}$ $\displaystyle=$ $\displaystyle\int K\left({\bm{u}}\right)\left[\frac{1}{2}-{\mathbb{I}}\{V^{*}( {\bf x}_{1},y_{1})<V^{*}({\bf x}_{1}+h{\bm{u}},y_{2})\}\right]f_{1,{\bf X}}({ \bf x}_{1})f_{2,{\bf X}}({\bf x}_{1}+h{\bm{u}})f_{1}(y_{1}\mid{\bf x}_{1})f_{2 }(y_{2}\mid{\bf x}_{1}+h{\bm{u}})$ $\displaystyle\quad{\rm d}{\bf x}_{1}{\rm d}{\bm{u}}{\rm d}y_{1}{\rm d}y_{2}$ $\displaystyle=$ $\displaystyle\left(\int\left[\frac{1}{2}-{\mathbb{I}}\{V^{*}({\bf x}_{1},y_{1} )<V^{*}({\bf x}_{1},y_{2})\}\right]f_{1,{\bf X}}({\bf x}_{1})f_{2,{\bf X}}({ \bf x}_{1})f_{1}(y_{1}\mid{\bf x}_{1})f_{2}(y_{2}\mid{\bf x}_{1}){\rm d}{\bf x }_{1}{\rm d}y_{1}{\rm d}y_{2}\right)(1+o_{p}(1))$ $\displaystyle=$ $\displaystyle\left(\int\left[\frac{1}{2}-{\mathbb{I}}\{V^{*}({\bf x}_{1},y_{1} )<V^{*}({\bf x}_{1},y_{2})\}\right]V^{*}({\bf x}_{1},y_{1})f_{1,{\bf X}}({\bf x }_{1})f_{2,{\bf X}}({\bf x}_{1})f_{2}(y_{1}\mid{\bf x}_{1})f_{2}(y_{2}\mid{\bf x }_{1}){\rm d}{\bf x}_{1}{\rm d}y_{1}{\rm d}y_{2}\right)(1+o_{p}(1))$ $\displaystyle=$ $\displaystyle{\mathbb{E}}_{{\bf X}\sim P_{2,{\bf X}}}\left\{f_{1,{\bf X}}({\bf X })\left(\frac{1}{2}-{\mathbb{E}}_{Y_{1},Y_{2}\sim P_{2,Y\mid{\bf X}}}\left[V^{ *}({\bf X},Y_{1}){\mathbb{I}}\{V^{*}({\bf X},Y_{1})<V^{*}({\bf X},Y_{2})\} \right]\right)\right\}(1+o_{p}(1))$ $$

And by transformation

$$ $\displaystyle{\mathbb{E}}_{Y_{1},Y_{2}\sim P_{2,Y\mid{\bf X}}}\left[V^{*}({\bf X },Y_{1}){\mathbb{I}}\{V^{*}({\bf X},Y_{1})<V^{*}({\bf X},Y_{2})\}\right]$ $\displaystyle=$ $\displaystyle\frac{1}{2}{\mathbb{E}}_{Y_{1},Y_{2}\sim P_{2,Y\mid{\bf X}}}\left [V^{*}({\bf X},Y_{1}){\mathbb{I}}\{V^{*}({\bf X},Y_{1})<V^{*}({\bf X},Y_{2})\} \right]+\frac{1}{2}-\frac{1}{2}{\mathbb{E}}_{Y_{1},Y_{2}\sim P_{2,Y\mid{\bf X} }}\left[V^{*}({\bf X},Y_{1}){\mathbb{I}}\{V^{*}({\bf X},Y_{1})\geq V^{*}({\bf X },Y_{2})\}\right]$ $\displaystyle=$ $\displaystyle\frac{1}{2}-\frac{1}{2}{\mathbb{E}}_{Y_{1},Y_{2}\sim P_{2,Y\mid{ \bf X}}}\left[\{V^{*}({\bf X},Y_{1})-V^{*}({\bf X},Y_{2})\}{\mathbb{I}}\{V^{*} ({\bf X},Y_{1})\geq V^{*}({\bf X},Y_{2})\}\right]$ $\displaystyle=$ $\displaystyle\frac{1}{2}-\frac{1}{4}{\mathbb{E}}_{Y_{1},Y_{2}\sim P_{2,Y\mid{ \bf X}}}\{|V^{*}({\bf X},Y_{1})-V^{*}({\bf X},Y_{2})|\}.$ $$

The bias term is then simplified as

$$ ${\mathbb{E}}\{H({\bf X}_{1i},{\bf X}_{2j}){D}_{ij}\}=\frac{1}{4}{\mathbb{E}}_{ {\bf X}\sim P_{2,{\bf X}},Y,Y^{\prime}\sim P_{2,Y\mid{\bf X}}}\{f_{1,{\bf X}}( {\bf X})|V^{*}({\bf X},Y)-V^{*}({\bf X},Y^{\prime})|\}(1+o_{p}(1)).$ $$

Combining all the results above we conclude

$$ $\widehat{T}_{w}=\frac{\widehat{T}_{w}^{*}}{\widehat{\sigma}_{w}}=Z+\frac{{ \mathbb{E}}\{H({\bf X}_{1i},{\bf X}_{2j}){D}_{ij}\}}{\sigma_{w}/\sqrt{n_{1}}} \{1+o_{p}(1)\}+o_{p}(1)=\frac{\sqrt{n_{1}}\delta_{w}}{4\sigma_{w}}\{1+o_{p}(1) \}+Z+o_{p}(1).$ $$

$\hfill\qed$

## Appendix B Additional details

### B.1 A flow chart of our work

[Uncaptioned image]: x7.png

## Peer Reviews

confidence: 4
contribution: 3
initial_rating: 6
presentation: 3
questions: 1. Could the authors provide a rigorous proof of the density ratio of $X_{2j}$ and $X_{1i}$ conditional on $\tilde{X}_{2j}$.

2. Where is $d$ defined? 

3. In different applications of conditional testing, what are the score functions $V$?

4. Please clarify the statement "This indicates that using the LCP for data selection can lead to a more balanced selection result since the PSER inflation for different sub-groups is bounded", and the statement related to fairness.

5. Avoid using abbreviations before introducing them, such as PRDS.

6. In conditional outlier detection, what are the theoretical and empirical performances if $P_{1,X} \neq P_{2,X}$?

7. From my understanding, the theoretical results do not account for the estimation errors. Moreover, kernel functions can lead to the curse of dimensionality, which hinders application in high-dimensional settings. 

8. How do the tuning parameters in kernel functions affect the performance, and how should these parameters be chosen in practice?

9. Why does the method in two-sample conditional distribution testing not require randomization? Does the proposed method in this context require the marginal density ratio? Moreover, why does the type I error increase with sample size in Figure 7?
soundness: 3
strengths: This paper presents the concept of localized conformal $p$-values and demonstrates their application to some interesting testing problems. The authors conduct appropriate experiments to illustrate the performance of their method.
summary: The paper introduces localized conformal $p$-values and applies them to several conditional testing problems, including conditional outlier detection, conditional label screening, and two-sample conditional distribution testing.
weaknesses: Please refer to the questions below.

---

confidence: 3
contribution: 3
initial_rating: 6
presentation: 3
questions: 1. In the application of conditional outlier detection, the goal was to control the FDR using the BH procedure, whereas in the conditional label screening problem, LCP guarantees FWER control. Is there any reason behind controlling different quantities in each case? What motivated the decision to adhere to FWER control instead of FDR control in conditional label screening despite this conservativeness?
  
  2. In Section 3.1, within the balanced data selection problem, it is assumed that the response variable is not observed. In this case, how is $V_{2j}$ specifically obtained? My understanding is that both $X_{2j}$ and $Y_{2j}$ are required for this, but $Y_{2j}$  is not observed. In this case, is an arbitrary value of $Y_{2j}$ (i.e., any y which is not in $\mathcal{A}$) satistfing $\mathbb{H}_{0j}$ used?
  
  3. Could you provide more detailed explanation or intuition for how the specific choice of g(x) makes the covariate shift problem equivalent to conditional validity?

  4. In Section 3.3, the context of large language models’ factuality is introduced to frame the conditional label screening problem. However, the numerical study presents results only on more structured synthetic and real datasets. I was wondering if any numerical study reflecting the natural language processing context described in the paper has been attempted. If so, what were the outcomes of those experiments? If not, what additional research would be necessary to conduct such studies?
soundness: 3
strengths: The most notable strength of this work lies in the variety of applications presented. The proposed applications of LCP are all promising, largely due to the LCP’s ability to effectively address conditional testing. In particular, the authors contextualize each application; for instance, in the case of the conditional label screening problem, they suggest that this application could be used to ensure the factuality of large language models, thereby justifying its utility.

Furthermore, the authors thoroughly discuss the theoretical justification of the proposed applications. They rigorously prove how each problem controls specific quantities (e.g., FSER, FDR, and FWER) by synthesizing a considerable amount of literature to support their claims. This strength, the ability to creatively adapt existing methodologies and introduce multiple new applications, demonstrating an original contribution to the field.​
summary: Authors introduce a novel (conformal) p-value by converting an existing conformal prediction method that is locally valid, asymptotically conditionally valid, and computationally advantageous. They further discuss the applicability of this approach in various multiple conditional testing problems. From an application perspective, their contributions are four folds: balanced data selection, conditional outlier detection, conditional label screening, and a two-sample conditional distribution test. Each application is rigorously justified through theoretical analysis, and the utility of the proposed methods is empirically demonstrated via extensive numerical experiments.
weaknesses: While they have successfully introduced locally conformal p-values and thoroughly demonstrated their various applications and theoretical properties, their work seems limited in terms of novelty. Specifically, the locally conformal p-values appear to be derived from directly converting the prediction intervals proposed by Hore & Barber (2023), and their application seems to involve integrating these p-values into several already established methods.

Meanwhile, one of the main contributions of their work lies in achieving the asymptotically conditional super-uniform property of the new conformal p-values. Specifically, Theorem 4 and Theorem 7 provide theoretical justification for this, though the authors merely mention that a specific choice of $g(x)$ renders the covariate shift problem equivalent to conditional validity, which is not clear. While this approach poses no issue in terms of soundness, as previously discussed by Hore & Barber (2023), it may lack readability in this regard.

---

confidence: 3
contribution: 3
initial_rating: 6
presentation: 3
questions: 1.What circumstances the "average FDP above nominal level" shown in Figure 1 would become negative?

2.Based on the experimental results in the paper, it is observed that in many cases, LCP-od exhibits greater fluctuations compared to CP. How can this phenomenon be explained?
soundness: 3
strengths: The paper presents a clear problem statement, solid theoretical results, and the experimental results effectively reflect the efficiency of their proposed method.
summary: This paper introduces localized conformal p-values for conditional testing problems.
Specifically, the authors inverting the prediction intervals which are constructed by
 existing works to adapt to the conditional distribution of the response. They establish theoretical results on the fundamental properties of their defined p-values, as well as applications of these p-values to conditional testing. The empirical results demonstrate the effectiveness of their proposed methods.
weaknesses: The structure of paper could be better. The authors could give concise and appropriate names to the important theorems to summarize their meanings, and mark the others as lemmas. There are many theorems in the main text of the paper, so presenting the theorems this way would make them more intuitive and help readers better understand the meaning of the theorems.

---

confidence: 4
contribution: 3
initial_rating: 6
presentation: 2
questions: 1. Could the authors provide clarifications on the goal of Theorem 3? It feels somewhat distracting from the main focus of this work, as it essentially presents an 'asymptotic property under additional assumptions,' while the main point of the conformal prediction framework is the finite-sample theory without distributional assumptions.

2. Regarding Section 3.2, 'Conditional Outlier Detection,' I'm not sure if the hypothesis (3.1) is what is actually being tested. Specifically, isn't the p-value super-uniform under a weaker condition than $H_{0,j}$ in (3.2), since it is marginally valid? 

My understanding is that the localized conformal prediction method from Hore and Barber basically achieves the marginal coverage guarantee, while the conditional miscoverage rates are "likely to be small" if we frame everything in a distribution-free sense.

Thus, I feel that the outlier detection counterpart of the localized conformal prediction framework controls the FDR for testing marginal outliers, but conditional outliers are more likely to be detected—rather than directly detecting conditional outliers with a distribution-free guarantee. Am I missing something?

3. (continued from point 2) In Theorem 5, is the goal of the condition $P_{1,X}=P_{2,X}$ to claim that any detected distribution shift is a label shift rather than a covariate shift, i.e., that any outlier is a conditional outlier? My confusion is that under the condition $P_{1,X}=P_{2,X}$, the null hypothesis in (3.1) is essentially equivalent to stating that the marginal distribution $P_{(X,Y)}$ is the same for the test point and the calibration set, since it is the combination of "$P_X$ is the same" and "$P_{Y|X}$ is the same". 

So, to me, Theorem 5 sounds like "Algorithm 1 controls FDR for testing marginal outliers. But if we additionally assume that $P_X$ is the same, then an outlier means $P_{Y|X}$ is different, implying that it is a conditional outlier", which is not very interesting compared to directly detecting the conditional outliers.

Therefore, as mentioned in point 2, for a more useful result, shouldn't the statement be something like: "The procedure detects marginal outliers, but conditional outliers are likely to be better detected if we use the localized conformal p-values"?

4. Could the authors provide explanations for the terms in Theorem 4 and 7, since it's difficult to see how small they are?

5. minor comment: "independency" -> "independence" in page 28
soundness: 3
strengths: This work extends the localized conformal prediction methods to a broader range of inferential targets.
summary: This work investigates the possible application of localized conformal p-values, which can be naturally constructed from recent localized conformal prediction methods.
weaknesses: I believe the writing and presentation should be improved, and more effort needs to be made to demonstrate the usefulness of the results.

Meta-review: This paper applies conformal inference techniques to perform conditional testing. They define a new localized conformal p value, and use this to perform several practical conditional tests including outlier detecting and label screening. Reviewers found this to be novel and some were more positive after a healthy rebuttal period. I agree with their assessment and appreciate the clean ideas, as well as their application to classical tasks and connections to U-statistics.

Decision: Accept (Poster)