Two-sample problems compare independent empirical measures rather than centering one empirical measure at a fixed law. The balanced scaling makes both samples contribute at order one. Permutation inference replaces the sampling law by the conditional randomness of labels and is exact only under the appropriate exchangeability null.
The two-sample empirical process
Definition. Let \(X_1,\ldots,X_m\overset{\mathrm{iid}}{\sim}P\) and \(Y_1,\ldots,Y_n\overset{\mathrm{iid}}{\sim}Q\), independently. Write \[ P_m=\frac1m\sum_{i=1}^m\delta_{X_i}, \qquad Q_n=\frac1n\sum_{j=1}^n\delta_{Y_j}, \] and define \[ \mathbb T_{m,n}f = \sqrt{\frac{mn}{m+n}}(P_m-Q_n)f. \]
Theorem. Suppose \(m/(m+n)\to\lambda\in(0,1)\), and \(\mathcal F\) is both \(P\)- and \(Q\)-Donsker. Then \[ \mathbb T_{m,n} -\sqrt{\frac{mn}{m+n}}(P-Q) \rightsquigarrow \sqrt{1-\lambda}\,\mathbb G_P -\sqrt{\lambda}\,\mathbb G_Q \] in \(\ell^\infty(\mathcal F)\), where the two bridges are independent. The limiting covariance is \[ (1-\lambda)\operatorname{Cov}_P(f,g) +\lambda\operatorname{Cov}_Q(f,g). \]
Proof. Algebra gives \[ \begin{aligned} \mathbb T_{m,n}f &-\sqrt{\frac{mn}{m+n}}(P-Q)f\\ &= \sqrt{\frac n{m+n}}\mathbb G_m^P f -\sqrt{\frac m{m+n}}\mathbb G_n^Q f. \end{aligned} \] Joint convergence follows from independence and the product-space Donsker theorem. The displayed covariance follows by independence of the two limits. \(\square\)
Corollary (equality null). Under \(H_0:P=Q=R\), \[ \mathbb T_{m,n}\rightsquigarrow\mathbb G_R, \] because \((1-\lambda)+\lambda=1\). The balanced scaling therefore removes the limiting dependence on the sampling fraction.
Permutation labels
Pool the observations as \(Z_1,\ldots,Z_N\), \(N=m+n\). Let \((I_1^\pi,\ldots,I_N^\pi)\) be uniformly distributed over all binary vectors with exactly \(m\) ones, independently of the data. The permuted empirical measures assign observations with \(I_i^\pi=1\) to the first group and the rest to the second.
Definition. The permutation process is \[ \mathbb T_{m,n}^{\pi}f = \sqrt{\frac{mn}{N}} \left[ \frac1m\sum_{i=1}^NI_i^\pi f(Z_i) - \frac1n\sum_{i=1}^N(1-I_i^\pi)f(Z_i) \right]. \]
Proposition. Conditional on the pooled data, \[ E_\pi\mathbb T_{m,n}^{\pi}f=0 \] and \[ E_\pi(\mathbb T_{m,n}^{\pi}f\, \mathbb T_{m,n}^{\pi}g) = \frac N{N-1} P_N\{(f-P_Nf)(g-P_Ng)\}, \] where \(P_N=N^{-1}\sum_{i=1}^N\delta_{Z_i}\).
Proof. Rewrite \[ \mathbb T_{m,n}^{\pi}f = \sqrt{\frac N{mn}} \sum_{i=1}^N \left(I_i^\pi-\frac mN\right)f(Z_i). \] Sampling \(m\) labels without replacement gives \[ E_\pi I_i^\pi=\frac mN,\quad \operatorname{Var}_\pi(I_i^\pi)=\frac{mn}{N^2},\quad \operatorname{Cov}_\pi(I_i^\pi,I_j^\pi) =-\frac{mn}{N^2(N-1)}. \] Substitute and collect the diagonal and off-diagonal sums. \(\square\)
Conditional permutation convergence
Theorem. Under \(H_0:P=Q=R\), if \(\mathcal F\) is \(R\)-Donsker and measurability is controlled, then conditionally on the pooled sample, \[ \mathbb T_{m,n}^{\pi}\rightsquigarrow\mathbb G_R \quad\text{in }\ell^\infty(\mathcal F), \] in probability.
Under the sharp equality null, the pooled observations are exchangeable, so the permutation test is finite-sample exact for any statistic whose randomization distribution includes all labelings with the observed group sizes. The process theorem additionally explains its Gaussian large-sample approximation.
Weak nulls and studentization
Example (equal means, unequal variances). Suppose the null is only \(P X=QY\), while \(\sigma_P^2\ne\sigma_Q^2\). The sampling variance of \(\sqrt{mn/N}(\bar X-\bar Y)\) tends to \[ (1-\lambda)\sigma_P^2+\lambda\sigma_Q^2. \] Permutation labels instead see the pooled mixture and generally produce a different variance. Thus the unstudentized permutation test need not have asymptotic level \(\alpha\). Dividing by a consistent two-sample standard error makes both sampling and permutation limits standard normal under regularity conditions.
This distinction is fundamental: exchangeability justifies exact permutation inference for \(P=Q\), but not automatically for weaker hypotheses about a mean, quantile, or treatment effect. Studentization can yield asymptotic validity because it removes the covariance mismatch.
Two-sample distributional statistics
Example (two-sample Kolmogorov–Smirnov). Under a continuous equality null, \[ \sqrt{\frac{mn}{m+n}}\sup_x|F_m(x)-G_n(x)| \rightsquigarrow \sup_{0\leq u\leq1}|B(u)|. \] This follows by applying the supremum map to the class of half-line indicators. The permutation distribution is exact under equality and converges to the same bridge functional.
Rank statistics arise similarly after indexing the pooled sample by threshold or score functions. Their distribution-free null behavior is an expression of the same label exchangeability.