Statistical Methods
Separate Empirical Energy Distance from an Energy Test
Define the task
Energy distance compares distributions using pairwise absolute differences. This tool computes the distance between equally weighted one-dimensional empirical distributions. It does not produce a permutation p-value or an unbiased population-distance estimator. Keep measurement units, sampling design and any weighting requirements with the result. Unlike a maximum vertical CDF gap or a Wasserstein displacement, this statistic uses a different aggregation and scaling; select the summary according to the practical question.
Carry out the check
Average absolute differences across all cross-sample pairs. Separately average over all ordered within-sample pairs, including zero self-distances. Subtract the two within averages from twice the cross average, then take the square root. This empirical convention uses denominators n² and m², not n(n−1) and m(m−1). The squared distance has measurement units; the distance has their square root. Changing units therefore changes the reported numerical scale. Ties are valid, but dependence and sampling uncertainty still require separate treatment.
Worked hypothetical example
For hypothetical samples A=(0,2) and B=(1,3), the cross average is 1.5 and each within average is one. Squared distance is 2×1.5−1−1=1, so distance is one. Identical empirical distributions give zero even when observations are repeated proportionally. Multiplying every observation by four multiplies distance by two. Preserve the averaging convention and avoid presenting a positive descriptive distance as evidence of a statistically significant population difference.
Method checked 21 November 2026 against Primary method documentation: energy_distance.