# Biswas--Ghosh (2014) two-sample test: validation record ## Scope and status This record applies to `pysht.equaldist.bg_2samp`. It separates four questions that must not be conflated: 1. whether the code evaluates the intended finite-sample statistic; 2. whether label permutations are calibrated correctly; 3. whether numerical safeguards preserve the mathematical test; and 4. whether an asymptotic approximation has been independently validated. The first three have executable validation evidence. The fourth does not, so asymptotic calibration is deliberately unavailable. This is a computational validation record, not a new proof of the consistency or power results in the paper. Primary reference: M. Biswas and A. K. Ghosh, "A nonparametric two-sample test applicable to high dimensional data," *Journal of Multivariate Analysis* 123 (2014), 160--171, . The authors' preprint is available at . The legacy comparison target is SHT 0.1.9 at Git commit `4e29cda1257f86dd0237d37329af358b54d04f2b`, as recorded in the [legacy audit](legacy-audit.md). ## Hypotheses and assumptions The public alternative is two-sided in distribution space: $$ H_0:F_X=F_Y, \qquad H_1:F_X\ne F_Y. $$ The implemented randomization inference relies on the following conditions. - `x` and `y` are independent samples, and observations are independent within each sample under the sampling design. - Under the null, the pooled observations are exchangeable with respect to the two sample labels. Exactness is conditional on the pooled observations and follows from this exchangeability. - Every observation is a finite real vector in a common Euclidean feature space. Rows are observations and columns are features. Univariate input is interpreted as a one-column matrix. - Both sample sizes are at least two, because each within-sample distance mean has denominator $\binom{n}{2}$ or $\binom{m}{2}$. - The two samples have the same number of features. Missing values, infinities, complex values, and Boolean arrays are outside the accepted data contract. These assumptions exclude paired, clustered, stratified, weighted, and serially dependent designs. Such designs require a permutation scheme that respects their dependence structure; unrestricted relabeling is not valid for them. ## Formula ledger Let $X_1,\ldots,X_n\in\mathbb R^d$ and $Y_1,\ldots,Y_m\in\mathbb R^d$. The distance is the ordinary Euclidean metric $d(a,b)=\lVert a-b\rVert_2$. | Symbol | Quantity evaluated | Finite-sample denominator | |---|---|---:| | $\bar d_{XX}$ | $\sum_{i