  Testing the equality of two conditional distributions is at the core of many
modern applications such as domain adaption, transfer learning, and algorithmic
fairness. However, to our surprise, little effort has been paid to studying
this fundamental problem. In this paper, we contribute to the scarce literature
by developing a new two-sample measure named conditional energy distance (CED)
to quantify the discrepancy between two conditional distributions without
imposing restrictive parametric assumptions. We study the fundamental
properties of CED and apply CED to construct a two-sample test for the equality
of two conditional distributions. A local bootstrap is developed to approximate
the finite sample distribution of the test statistic. The reliable performance
of the proposed two-sample conditional distribution test is demonstrated
through simulations and a real data analysis.
