Conditional Stochastic Dominance with Nearest Observations

statisticsrandomization inference

Suppose we want to compare two outcome distributions at a specified covariate value. If every neighborhood of that value has positive probability, a growing sample contains observations whose covariates are arbitrarily close to it. Bugni, Canay, and Kim (2025) select a fixed number of these observations from each sample. Under continuity of the conditional cdfs in the covariate, the selected outcomes converge jointly to independent draws from the two target conditional distributions. The limiting test therefore compares two samples of fixed size.

1. The joint limit of the selected observations

Observe two independent samples from \((Y,Z^Y)\) and \((X,Z^X)\), with i.i.d. observations within each sample. The outcomes and covariates are real-valued. Write \(n_y,n_x\) for the sample sizes and \(n=\min\{n_y,n_x\}\). The covariate distributions may differ between samples. Define the conditional cdfs

\[ F_Y(t\mid z)=P(Y\leq t\mid Z^Y=z), \qquad F_X(t\mid z)=P(X\leq t\mid Z^X=z). \]

At finitely many distinct, fixed points \(z_1,\ldots,z_L\), the null hypothesis is

\[ F_Y(t\mid z_\ell)\leq F_X(t\mid z_\ell) \quad\text{for every }t\in\mathbb R,\ \ell=1,\ldots,L. \]

With larger outcomes preferred, this says that \(Y\) stochastically dominates \(X\) at every target. Fix positive integers \(q_y^\ell,q_x^\ell\), and select that many outcomes from the respective samples whose covariates are nearest \(z_\ell\). Order them by covariate distance, resolving equal distances by the original observation order. This rule uses no outcomes. The selected vector is

\[ S_n^\ell=(Y^\ell_{n,[1]},\ldots,Y^\ell_{n,[q_y^\ell]}, X^\ell_{n,[1]},\ldots,X^\ell_{n,[q_x^\ell]}), \qquad q^\ell=q_y^\ell+q_x^\ell. \]

Theorem 1. Suppose every neighborhood of each target has positive probability in each sample, and the conditional cdfs are continuous at the target in the uniform norm:

\[ \sup_t|F_a(t\mid z)-F_a(t\mid z_\ell)|\longrightarrow0, \qquad z\to z_\ell,\quad a\in\{X,Y\}. \]

Here the limit is taken within the corresponding covariate support. As both original sample sizes diverge, \((S_n^1,\ldots,S_n^L)\) converges jointly in distribution to independent vectors \((S^1,\ldots,S^L)\). The coordinates of \(S^\ell\) are independent, with the first \(q_y^\ell\) distributed as \(Y\mid Z^Y=z_\ell\) and the remaining \(q_x^\ell\) as \(X\mid Z^X=z_\ell\).

This is Theorem 3 of the paper's November 19, 2025 version. A target may be an atom of the covariate distribution. The number of selected outcomes stays fixed as the original samples grow. The paper also studies increasing numbers of selected observations under stronger assumptions; this note concerns the fixed-size result.

2. Why the selected outcomes have this limit

Consider one sample and one target. In this calculation, let \(m\) denote that sample's size, let \(k\) be the fixed number selected, and let \(Z_{m,[k]}\) be the covariate at the \(k\)th closest observation. For a radius \(\varepsilon>0\), let \(B_m\) count observations within that radius of the target. If the neighborhood probability is \(p_\varepsilon>0\), then

\[ P\{|Z_{m,[k]}-z_\ell|>\varepsilon\} \leq P\{B_m<k\}\longrightarrow0, \qquad B_m\sim\operatorname{Binomial}(m,p_\varepsilon). \]

Once the neighborhood contains at least \(k\) observations, all selected covariates lie inside it. The law of large numbers gives \(B_m/m\xrightarrow{P} p_\varepsilon\), whereas \(k/m\to0\). Thus every selected covariate converges in probability to the target.

Conditional on all covariates, the selected observation indices are fixed and their outcomes are independent. For one target, the joint conditional cdf is therefore a product of conditional outcome cdfs evaluated at the selected covariates. Each factor converges in probability to its target cdf, uniformly over the outcome threshold. The difference between the two products is bounded by the sum of these errors, as shown in Section 5.

For several targets, choose pairwise disjoint neighborhoods around them. With probability tending to one, each neighborhood contains all covariates selected for its target. Within each sample, the selected index sets are then pairwise disjoint. Conditional on all covariates, the joint cdf factors across targets as well as observations. Since the probability of overlap tends to zero, it does not affect the joint limit.

3. Constructing the test

For the size and power statements below, suppose the assumptions of Theorem 1 hold and each target conditional cdf has only finitely many discontinuities. The extra condition limits the number of jumps as the outcome threshold varies. This is Assumption 3 of the paper; it is not part of the joint-convergence result in Theorem 1. Fix one target, call it \(z_0\), and write \(S_n,S\) for the selected vector and its limit, with group sizes \(q_y,q_x\). Form the empirical cdfs from the selected observations and use

\[ T(S_n)=\sup_t(\widehat F_{n,Y}(t)-\widehat F_{n,X}(t)). \]

Large positive values indicate a violation of the null. Fix \(\alpha\in(0,1)\). Let \(U_1,\ldots,U_q\) be independent \(U(0,1)\) variables, where \(q=q_y+q_x\). Compute the same statistic from these uniforms, using the first \(q_y\) as the first sample and the remaining \(q_x\) as the second. Define

\[ c_\alpha(q_y,q)=\inf\{c:P(T(U)\leq c)\geq1-\alpha\}. \]

Reject when \(T(S_n)>c_\alpha(q_y,q)\). The strict inequality matters because the reference statistic is discrete even though the uniforms are continuous.

The proof of size control bounds the null statistic in the limit experiment by the uniform statistic. It also shows that the rejection probability based on the selected observations converges to that of the limit test, even when outcomes can tie. For every fixed distribution satisfying the assumptions and the null, the limiting rejection probability is at most \(\alpha\).

For \(L\) targets, use the per-target level

\[ \alpha_L=1-(1-\alpha)^{1/L}. \]

Reject if any target rejects at level \(\alpha_L\), using critical value \(c_{\alpha_L}(q_y^\ell,q^\ell)\) at target \(z_\ell\). Under the joint null, the limiting probability of any rejection is at most \(1-(1-\alpha_L)^L=\alpha\). Section 6 explains how joint convergence and the treatment of ties justify this calculation.

4. Distance from the target

We can also bound the probability that a selected covariate lies far from the target. The following calculation allows a vector covariate \(Z\in\mathbb R^d\), with Euclidean distance. For one sample of size \(m\), let \(p(r)=P(\|Z-z_0\|\leq r)\), and let \(R_{m,k}\) be the distance of the \(k\)th closest covariate. Let \(B_m\) count observations in this closed ball, so it is binomial with parameters \(m,p(r)\). Whenever \(k\leq mp(r)/2\),

\[ P(R_{m,k}>r) \leq P\{B_m\leq mp(r)/2\} \leq e^{-mp(r)/8}. \]

To obtain the last inequality, write \(p=p(r)\) and apply Markov's inequality to \(e^{-tB_m}\) for \(t>0\):

\[ P(B_m\leq mp/2) \leq e^{tmp/2}(1-p+pe^{-t})^m \leq\exp(mp(t/2+e^{-t}-1)). \]

Taking \(t=\log2\) makes the exponent at most \(-mp/8\). No covariate density is required.

Suppose \(p(r)\geq cr^d\) for some \(c>0\) and all sufficiently small positive \(r\). Take \(r=M m^{-1/d}\). Choose \(M\) large enough that \(cM^d\geq2k\). For all sufficiently large \(m\), the displayed probability is at most \(\exp(-cM^d/8)\). Letting \(M\) increase proves \(R_{m,k}=O_p(m^{-1/d})\) for fixed \(k\). The bound need not tend to zero with \(m\) when \(M\) is fixed.

If \(p_0=P(Z=z_0)>0\), the number of exact matches is binomial with mean \(mp_0\). With probability tending to one, there are at least \(k\) exact matches. On this event, all selected covariates equal \(z_0\); conditional on all covariates, the selected outcomes are independent draws from the target conditional distribution. Resolving equal distances by observation order preserves this conclusion. Choosing the largest outcomes among the exact matches would change their distribution.

5. Conditional cdfs and independence

The product bound used in Section 2 follows from a telescoping identity. For \(a_j,b_j\in[0,1]\),

\[ \prod_{j=1}^qa_j-\prod_{j=1}^qb_j =\sum_{j=1}^q(a_j-b_j) \left(\prod_{k<j}a_k\right) \left(\prod_{k>j}b_k\right). \]

Hence the absolute difference is no larger than \(\sum_j|a_j-b_j|\). Write \(Z^Y_{n,[j]},Z^X_{n,[j]}\) for the selected covariates in the two samples. Given all covariates, set \(a_j=F_Y(s_j\mid Z^Y_{n,[j]})\) and \(b_j=F_Y(s_j\mid z_0)\) for the first sample, and use the corresponding factors for the second. Uniformly over all outcome thresholds, the difference between the conditional joint cdf and the target product cdf is bounded by

\[ \sum_{j=1}^{q_y}\sup_t|F_Y(t\mid Z^Y_{n,[j]})-F_Y(t\mid z_0)| +\sum_{j=1}^{q_x}\sup_t|F_X(t\mid Z^X_{n,[j]})-F_X(t\mid z_0)|. \]

Each selected covariate approaches the target, so continuity makes each summand converge to zero in probability. Each summand is bounded by one, and there are only finitely many of them. Their expectations therefore tend to zero. Taking expectations of the conditional cdf proves uniform convergence of the unconditional joint cdf to the target product cdf, and hence convergence in distribution.

Conditional independence by itself does not imply unconditional independence: averaging a product of random conditional cdfs need not give the product of their averages. Here every factor converges to a nonrandom target cdf. The limiting joint cdf is therefore a product. For several targets, the same calculation applies when the selected index sets are pairwise disjoint; the remaining error is at most the probability of overlap, which tends to zero.

For the vector covariates in Section 4, suppose that, within each sample's covariate support and sufficiently close to the target,

\[ \sup_t|F_a(t\mid z)-F_a(t\mid z_0)|\leq C\|z-z_0\|^\beta, \qquad a\in\{X,Y\}, \]

where \(C,\beta>0\). Suppose also that each sample's covariate probability in a ball of radius \(r\) is at least \(cr^d\) for some \(c>0\) and all sufficiently small positive radii. Here \(n=\min\{n_y,n_x\}\) and \(q=q_y+q_x\). Let \(R_n\) be the largest distance among the selected covariates. On \(R_n\leq r\), the conditional joint-cdf error is at most \(qCr^\beta\). On the complement, it is at most one. For a sufficiently small radius satisfying \(\max\{q_y,q_x\}\leq cnr^d/2\), apply the distance bound to each sample to obtain

\[ \sup_{s\in\mathbb{R}^q}|F_{S_n}(s)-F_S(s)| \leq qCr^\beta+2e^{-cnr^d/8}. \]

For any fixed \(A>0\), the choice \(r=(A\log n/n)^{1/d}\) satisfies these radius conditions for all sufficiently large \(n\). The second term is \(2n^{-cA/8}\), and the first is of order \((\log n/n)^{\beta/d}\). This rate bound uses the additional conditions above. Theorem 1 requires only continuity and positive probability in every neighborhood.

The exponent \(\beta/d\) decreases with covariate dimension. The cdf bound applies to events in which every coordinate is at or below its specified threshold. It is not a bound on the error for all events, including the test's rejection event. The calculation for outcomes at atoms proves convergence of rejection probabilities under the assumptions in Section 3.

6. Computing the statistic and the role of sample size

To compute \(T\), sort the distinct selected outcomes \(v_1<\cdots<v_K\). Both empirical cdfs are constant between these values, so

\[ T=\max\left(0,\max_{1\leq k\leq K} \left[\frac{\#\{j:Y_{n,[j]}\leq v_k\}}{q_y} -\frac{\#\{j:X_{n,[j]}\leq v_k\}}{q_x}\right]\right). \]

The counts range over the \(q_y\) and \(q_x\) selected observations, respectively. All observations tied at \(v_k\) enter their empirical cdfs together. Breaking outcome ties by arbitrarily ordering sample labels can give a different statistic. The zero in the maximum accounts for thresholds below all observations.

As the original samples grow, the selected conditional distributions converge to those at \(z_0\). The limiting comparison still uses only \(q\) outcomes. Under the assumptions in Section 3, the test's power at a fixed alternative converges to that of this fixed-size comparison, which can be below one. If \(q\) also grows, we need to bound the approximation error as more observations are selected. That requires a separate argument.

For multiple targets, joint convergence allows us to construct copies of the whole selected vector and its limit on one probability space so that the copies converge almost surely. Section 5 also gives uniform convergence of each coordinate's marginal cdf. Under the assumptions in Section 3, the argument for ties in the companion note therefore applies at each target: the coupled sample and limit statistics agree with probability tending to one. By a finite union bound, the coupled sample and limit statistics agree at all targets with probability tending to one. The limiting decisions are independent because each depends only on its own independent limit vector.

Let \(p_\ell\) be the rejection probability in the limit experiment at target \(z_\ell\), using level \(\alpha_L\). Under the joint null, each \(p_\ell\leq\alpha_L\), so

\[ P(\text{at least one rejection})\longrightarrow 1-\prod_{\ell=1}^L(1-p_\ell) \leq1-(1-\alpha_L)^L. \]

This is a limiting bound for each fixed distribution satisfying the null and the stated assumptions. The tests may be dependent in a finite sample. The targets must be fixed in advance; choosing them after looking at outcomes requires a separate analysis of that selection.

Bugni, Federico A., Ivan A. Canay, and Deborah Kim. 2025. “Testing Conditional Stochastic Dominance at Target Points.” arXiv. https://doi.org/10.48550/arXiv.2503.14747.

← All posts