where $X, X' \stackrel{\text{iid}}{\sim} p$ and $Y, Y' \stackrel{\text{iid}}{\sim} q$ are all independent of each other. We deduce that

$$
\begin{align*}
\mathbb{E}_{p \times q} \left[ \frac{1}{m^2(m-1)^2} \sum_{1 \le i \ne j \le m+n} k_{\lambda}(U_i, U_j)^2 \right] &\le \frac{(m+n)(m+n-1)}{m^2(m-1)^2} \frac{M \kappa_2}{\lambda_1 \cdots \lambda_d} \\
&\le \frac{4 M \kappa_2}{\lambda_1 \cdots \lambda_d} \frac{(m+n)^2}{m^4} \\
&= \frac{64 M \kappa_2}{\lambda_1 \cdots \lambda_d} \frac{(m+n)^2}{(2m)^4} \\
&\le \frac{64 M \kappa_2}{\lambda_1 \cdots \lambda_d} \frac{(m+n)^2}{(m+C^{-1}n)^4} \\
&\le \frac{64 M \kappa_2 C^4}{\lambda_1 \cdots \lambda_d} \frac{1}{(m+n)^2}
\end{align*}
$$

where we use the fact that $n \le Cm$. Using Markov's inequality, we get that, for any $\delta \in (0, 1)$, we have

$$
\begin{align*}
& 1 - \frac{\delta}{2} \\
\le {}& \mathbb{P}_{p \times q} \left( \frac{1}{m^2(m-1)^2} \sum_{1 \le i \ne j \le m+n} k_{\lambda}(U_i, U_j)^2 \le \frac{2}{\delta} \mathbb{E}_{p \times q} \left[ \frac{1}{m^2(m-1)^2} \sum_{1 \le i \ne j \le m+n} k_{\lambda}(U_i, U_j)^2 \right] \right) \\
\le {}& \mathbb{P}_{p \times q} \left( \frac{1}{m^2(m-1)^2} \sum_{1 \le i \ne j \le m+n} k_{\lambda}(U_i, U_j)^2 \le \frac{2}{\delta(m+n)^2 \lambda_1 \cdots \lambda_d} \right) \\
\le {}& \mathbb{P}_{p \times q} \left( \hat{q}_{1-\alpha/2}^{\lambda, \infty}(\mathbb{X}_m, \mathbb{Y}_n) \le \frac{1}{\sqrt{\delta}} 8c_1 C^2 \sqrt{2M\kappa_2} \frac{\ln(\frac{2}{\alpha})}{(m+n)\sqrt{\lambda_1 \cdots \lambda_d}} \right) \\
\le {}& \mathbb{P}_{p \times q} \left( \hat{q}_{1-\alpha/2}^{\lambda, \infty}(\mathbb{X}_m, \mathbb{Y}_n) \le \frac{1}{\sqrt{\delta}} 16c_1 C^2 \sqrt{2M\kappa_2} \frac{\ln(\frac{1}{\alpha})}{(m+n)\sqrt{\lambda_1 \cdots \lambda_d}} \right)
\end{align*}
$$

as $\ln(\frac{2}{\alpha}) \le 2 \ln(\frac{1}{\alpha})$ since $\alpha \in (0, 0.5)$. We now let $C_2(M, d) := 16c_1 C^2 \sqrt{2M\kappa_2}$. Then, for all $B \in \mathcal{N}$ such that $B \ge \frac{3}{\alpha^2} (\ln(\frac{4}{\delta}) + \alpha(1-\alpha))$, we have

$$
\begin{align*}
& \mathbb{P}_{p \times q \times r} \left( \hat{q}_{1-\alpha}^{\lambda, B}(\mathbb{Z}_B | \mathbb{X}_m, \mathbb{Y}_n) \le \frac{1}{\sqrt{\delta}} C_2(M, d) \frac{\ln(\frac{1}{\alpha})}{(m+n) \sqrt{\lambda_1 \cdots \lambda_d}} \right) \\
& \ge \mathbb{P}_{p \times q \times r} \left( \left\{ \hat{q}_{1-\alpha}^{\lambda, B}(\mathbb{Z}_B | \mathbb{X}_m, \mathbb{Y}_n) \le \hat{q}_{1-\alpha/2}^{\lambda, \infty}(\mathbb{X}_m, \mathbb{Y}_n) \right\} \right. \\
& \qquad \left. \cap \left\{ \hat{q}_{1-\alpha/2}^{\lambda, \infty}(\mathbb{X}_m, \mathbb{Y}_n) \le \frac{1}{\sqrt{\delta}} C_2(M, d) \frac{\ln(\frac{1}{\alpha})}{(m+n) \sqrt{\lambda_1 \cdots \lambda_d}} \right\} \right) \\
& \ge 1 - \frac{\delta}{2} - \frac{\delta}{2} \\
& = 1 - \delta
\end{align*}
$$
where we use the standard fact that for events $\mathcal{B}$ and $\mathcal{C}$ satisfying $\mathbb{P}(\mathcal{B}) \ge 1 - \delta_1$ and $\mathbb{P}(\mathcal{C}) \ge 1 - \delta_2$, we have $\mathbb{P}(\mathcal{B} \cap \mathcal{C}) = 1 - \mathbb{P}(\mathcal{B}^c \cup \mathcal{C}^c) \ge 1 - \mathbb{P}(\mathcal{B}^c) - \mathbb{P}(\mathcal{C}^c) \ge 1 - \delta_1 - \delta_2$.

**Quantile bound for MMD estimator $\widehat{\text{MMD}}_{\lambda,b}^2$ defined in Equation (6).**

For this case, in order to upper bound $\hat{q}_{1-\alpha}^{\lambda,\infty}(\mathbb{X}_n, \mathbb{Y}_n)$, we can use the result of de la Peña and Giné (1999, Corollary 3.2.6) and Markov's inequality as done by Fromont et al. (2012, Appendix D). We obtain that there exists a positive constant $\tilde{c}_1$ such that

$$ \mathbb{P}_r \left( \left| \sum_{1 \le i \ne j \le n} \epsilon_i \epsilon_j h_{\lambda}(X_i, X_j, Y_i, Y_j) \right| \ge \tilde{c}_1 \sqrt{\sum_{1 \le i \ne j \le n} h_{\lambda}(X_i, X_j, Y_i, Y_j)^2} \ln\left(\frac{2}{\alpha}\right) \middle| \mathbb{X}_n, \mathbb{Y}_n \right) \le \alpha $$

where $\epsilon_1, \dots, \epsilon_n$ are i.i.d. Rademacher variables, and so $\sum_{1 \le i \ne j \le n} \epsilon_i \epsilon_j h_{\lambda}(X_i, X_j, Y_i, Y_j)$ is a Rademacher chaos. We deduce that

$$ \hat{q}_{1-\alpha}^{\lambda,\infty}(\mathbb{X}_n, \mathbb{Y}_n) \le \tilde{c}_1 \sqrt{\frac{1}{n^2(n-1)^2} \sum_{1 \le i \ne j \le n} h_{\lambda}(X_i, X_j, Y_i, Y_j)^2} \ln\left(\frac{2}{\alpha}\right) $$

almost surely. Using Equation (23), we have

$$ \begin{aligned} & \mathbb{E}_{p \times q} \left[ \frac{1}{n^2(n-1)^2} \sum_{1 \le i \ne j \le n} h_{\lambda}(X_i, X_j, Y_i, Y_j)^2 \right] \\ &= \frac{1}{n^2(n-1)^2} \mathbb{E}_{p \times q} \left[ \sum_{1 \le i \ne j \le n} \left( k(X_i, X_j) + k(Y_i, Y_j) - k(X_i, Y_j) - k(X_j, Y_i) \right)^2 \right] \\ &\le \frac{4}{n(n-1)} \left( \mathbb{E}_{X,X'} [k_{\lambda}(X, X')]^2 + \mathbb{E}_{Y,Y'} [k_{\lambda}(Y, Y')]^2 + 2 \mathbb{E}_{X,Y} [k_{\lambda}(X, Y)]^2 \right) \\ &\le \frac{32M\kappa_2}{n^2\lambda_1 \cdots \lambda_d} \end{aligned} $$

where $X, X' \stackrel{\text{iid}}{\sim} p$ and $Y, Y' \stackrel{\text{iid}}{\sim} q$ are all independent of each other, and where $\kappa_2$ is the constant defined in Equation (21) depending on $d$. Similarly to the previous case, we can then use Markov's inequality to get that, for any $\delta \in (0, 1)$, we have

$$ \begin{aligned} & 1 - \frac{\delta}{2} \\ \le & \mathbb{P}_{p \times q} \left( \frac{1}{n^2(n-1)^2} \sum_{1 \le i \ne j \le n} h_{\lambda}(X_i, X_j, Y_i, Y_j)^2 \le \frac{2}{\delta} \mathbb{E}_{p \times q} \left[ \frac{1}{n^2(n-1)^2} \sum_{1 \le i \ne j \le n} h_{\lambda}(X_i, X_j, Y_i, Y_j)^2 \right] \right) \\ \le & \mathbb{P}_{p \times q} \left( \frac{1}{n^2(n-1)^2} \sum_{1 \le i \ne j \le n} h_{\lambda}(X_i, X_j, Y_i, Y_j)^2 \le \frac{2}{\delta} \frac{32M\kappa_2}{n^2\lambda_1 \cdots \lambda_d} \right) \\ \le & \mathbb{P}_{p \times q} \left( \hat{q}_{1-\alpha/2}^{\lambda,\infty}(\mathbb{X}_n, \mathbb{Y}_n) \le \frac{1}{\sqrt{\delta}} 8\tilde{c}_1 \sqrt{M\kappa_2} \frac{\ln(\frac{4}{\alpha})}{n\sqrt{\lambda_1 \cdots \lambda_d}} \right) \\ \le & \mathbb{P}_{p \times q} \left( \hat{q}_{1-\alpha/2}^{\lambda,\infty}(\mathbb{X}_n, \mathbb{Y}_n) \le \frac{1}{\sqrt{\delta}} 48\tilde{c}_1 \sqrt{M\kappa_2} \frac{\ln(\frac{1}{\alpha})}{2n\sqrt{\lambda_1 \cdots \lambda_d}} \right) \end{aligned} $$
as $\ln(\frac{4}{\alpha}) \le 3\ln(\frac{1}{\alpha})$ since $\alpha \in (0, 0.5)$. Letting $\tilde{C}_2(M, d) := 48\tilde{c}_1\sqrt{M\kappa_2}$ and applying the same reasoning as earlier, we get

$$ \mathbb{P}_{p \times q \times r} \left( \hat{q}_{1-\alpha}^{\lambda, B}(\mathbb{Z}_B | \mathcal{X}_m, \mathcal{Y}_n) \le \frac{1}{\sqrt{\delta}} \tilde{C}_2(M, d) \frac{\ln(\frac{1}{\alpha})}{2n\sqrt{\lambda_1 \cdots \lambda_d}} \right) \le 1 - \delta $$

for all $B \in \mathbb{N}$ satisfying $B \ge \frac{3}{\alpha^2}(\ln(\frac{4}{\delta}) + \alpha(1 - \alpha))$.

### E.5 Proof of Theorem 5

First, as shown by Gretton et al. (2012a, Lemma 6), the Maximum Mean Discrepancy can be written as

$$ \begin{aligned} \text{MMD}_{\lambda}^{2}(p, q) &= \mathbb{E}_{X,X'}[k_{\lambda}(X, X')] - 2\mathbb{E}_{X,Y}[k_{\lambda}(X, Y)] + \mathbb{E}_{Y,Y'}[k_{\lambda}(Y, Y')] \\ &= \int_{\mathbb{R}^d} \int_{\mathbb{R}^d} k_{\lambda}(x, x')p(x)p(x')dx dx' \\ &\quad - 2\int_{\mathbb{R}^d} \int_{\mathbb{R}^d} k_{\lambda}(x, y)p(x)q(y)dx dy \\ &\quad + \int_{\mathbb{R}^d} \int_{\mathbb{R}^d} k_{\lambda}(y, y')q(y)q(y')dy dy' \\ &= \int_{\mathbb{R}^d} \int_{\mathbb{R}^d} k_{\lambda}(u, u')(p(u) - q(u))(p(u') - q(u'))dudu' \end{aligned} $$

for $X, X' \stackrel{\text{iid}}{\sim} p$ and $Y, Y' \stackrel{\text{iid}}{\sim} q$ all independent of each other. Using the function $\varphi_{\lambda}$ defined in Equation (9) and $\psi := p - q$, we obtain

$$ \begin{aligned} \text{MMD}_{\lambda}^{2}(p, q) &= \int_{\mathbb{R}^d} \int_{\mathbb{R}^d} \varphi_{\lambda}(u - u')\psi(u)\psi(u')dudu' \\ &= \int_{\mathbb{R}^d} \psi(u)\int_{\mathbb{R}^d} \psi(u')\varphi_{\lambda}(u - u')du'du \\ &= \int_{\mathbb{R}^d} \psi(u)(\psi * \varphi_{\lambda})(u)du \\ &= \langle \psi, \psi * \varphi_{\lambda} \rangle_2 \\ &= \frac{1}{2}(\|\psi\|_2^2 + \|\psi * \varphi_{\lambda}\|_2^2 - \|\psi - \psi * \varphi_{\lambda}\|_2^2) \end{aligned} $$

where the last equality is obtained by expanding $\|\psi - \psi * \varphi_{\lambda}\|_2^2$. By Lemma 2, a sufficient condition to ensure that $\mathbb{P}_{p \times q \times r}(\Delta_{\alpha}^{\lambda, B}(\mathcal{X}_m, \mathcal{Y}_n, \mathbb{Z}_B) = 0) \le \beta$ is

$$ \mathbb{P}_{p \times q \times r} \left( \text{MMD}_{\lambda}^{2}(p, q) \ge \sqrt{\frac{2}{\beta}\text{var}_{p \times q}(\widehat{\text{MMD}}_{\lambda}^{2}(\mathcal{X}_m, \mathcal{Y}_n))} + \hat{q}_{1-\alpha}^{\lambda, B}(\mathbb{Z}_B | \mathcal{X}_m, \mathcal{Y}_n) \right) \ge 1 - \frac{\beta}{2} $$

and an equivalent sufficient condition is

$$ \mathbb{P}_{p \times q \times r} \left( \|\psi\|_2^2 \ge \|\psi - \psi * \varphi_{\lambda}\|_2^2 - \|\psi * \varphi_{\lambda}\|_2^2 + 2\sqrt{\frac{2}{\beta}\text{var}_{p \times q}(\widehat{\text{MMD}}_{\lambda}^2)} + 2\hat{q}_{1-\alpha}^{\lambda, B} \right) \ge 1 - \frac{\beta}{2}. $$
By Proposition 3, we have

$$
\begin{align*}
\mathrm{var}_{p \times q} (\widehat{\mathrm{MMD}}_{\lambda}^{2}(\mathbb{X}_{m}, \mathbb{Y}_{n})) &\le C_{1}(M, d) \left( \frac{\|\psi * \varphi_{\lambda}\|_{2}^{2}}{m + n} + \frac{1}{(m + n)^{2} \lambda_{1} \cdots \lambda_{d}} \right) \\
2 \sqrt{\frac{2}{\beta}} \mathrm{var}_{p \times q} (\widehat{\mathrm{MMD}}_{\lambda}^{2}(\mathbb{X}_{m}, \mathbb{Y}_{n})) &\le 2 \sqrt{\frac{2C_{1}}{\beta} \frac{\|\psi * \varphi_{\lambda}\|_{2}^{2}}{m + n} + \frac{2C_{1}}{\beta(m + n)^{2} \lambda_{1} \cdots \lambda_{d}}} \\
&\le 2 \sqrt{\|\psi * \varphi_{\lambda}\|_{2}^{2} \frac{2C_{1}}{\beta(m + n)} + \frac{2\sqrt{2C_{1}}}{\sqrt{\beta(m + n)} \sqrt{\lambda_{1} \cdots \lambda_{d}}}} \\
&\le \|\psi * \varphi_{\lambda}\|_{2}^{2} + \frac{2C_{1}}{\beta(m + n)} + \frac{2\sqrt{2C_{1}}}{\sqrt{\beta(m + n)} \sqrt{\lambda_{1} \cdots \lambda_{d}}} \\
&\le \|\psi * \varphi_{\lambda}\|_{2}^{2} + \frac{2C_{1} + 2\sqrt{2C_{1}}}{\beta(m + n) \sqrt{\lambda_{1} \cdots \lambda_{d}}} \ln\left(\frac{1}{\alpha}\right) \\
&\le \|\psi * \varphi_{\lambda}\|_{2}^{2} + \frac{6C_{1}}{\beta(m + n) \sqrt{\lambda_{1} \cdots \lambda_{d}}} \ln\left(\frac{1}{\alpha}\right) \\
\|\psi * \varphi_{\lambda}\|_{2}^{2} - 2\sqrt{\frac{2}{\beta}} \mathrm{var}_{p \times q} (\widehat{\mathrm{MMD}}_{\lambda}^{2}) &\ge -6C_{1} \frac{\ln\left(\frac{1}{\alpha}\right)}{\beta(m + n) \sqrt{\lambda_{1} \cdots \lambda_{d}}}
\end{align*}
$$

where for the third inequality we used the fact that $\sqrt{x+y} \le \sqrt{x} + \sqrt{y}$ for all $x, y > 0$, for the fourth inequality we used the fact that $2\sqrt{xy} \le x + y$ for all $x, y > 0$, and for the fifth inequality we use the fact that $\lambda_1 \cdots \lambda_d \le 1$, $\beta \in (0, 1)$ and $\ln(\frac{1}{\alpha}) > 1$. A similar reasoning has been used by Fromont et al. (2013, Theorem 1) and Albert et al. (2022, Theorem 1).

Let $C_3(M, d) := 6C_1(M, d) + 2\sqrt{2}C_2(M, d)$ where $C_1$ and $C_2$ are the constants from Propositions 3 and 4, respectively. Assume that our condition holds, that is

$$ \|\psi\|_2^2 - \|\psi - \psi * \varphi_\lambda\|_2^2 \ge (2\sqrt{2}C_2 + 6C_1) \frac{\ln(\frac{1}{\alpha})}{\beta(m+n)\sqrt{\lambda_1 \cdots \lambda_d}}. $$

Omitting the variables for $\hat{q}_{1-\alpha}^{\lambda, B}(\mathbb{Z}_B|\mathbb{X}_m, \mathbb{Y}_n)$ and for $\widehat{\mathrm{MMD}}_{\lambda}^{2}(\mathbb{X}_m, \mathbb{Y}_n)$, we then get

$$
\begin{align*}
\mathbb{P}_{p \times q \times r} \left( 2 \hat{q}_{1-\alpha}^{\lambda, B} &\le \|\psi\|_2^2 - \|\psi - \psi * \varphi_{\lambda}\|_2^2 + \|\psi * \varphi_{\lambda}\|_2^2 - 2 \sqrt{\frac{2}{\beta}} \mathrm{var}_{p \times q} (\widehat{\mathrm{MMD}}_{\lambda}^2) \right) \\
&\ge \mathbb{P}_{p \times q \times r} \left( 2 \hat{q}_{1-\alpha}^{\lambda, B} \le (6C_1 + 2\sqrt{2}C_2) \frac{\ln(\frac{1}{\alpha})}{\beta(m+n)\sqrt{\lambda_1 \cdots \lambda_d}} - 6C_1 \frac{\ln(\frac{1}{\alpha})}{\beta(m+n)\sqrt{\lambda_1 \cdots \lambda_d}} \right) \\
&= \mathbb{P}_{p \times q \times r} \left( \hat{q}_{1-\alpha}^{\lambda, B} \le \sqrt{2}C_2 \frac{\ln(\frac{1}{\alpha})}{\beta(m+n)\sqrt{\lambda_1 \cdots \lambda_d}} \right) \\
&\ge \mathbb{P}_{p \times q \times r} \left( \hat{q}_{1-\alpha}^{\lambda, B} \le C_2 \sqrt{\frac{2}{\beta(m+n)\sqrt{\lambda_1 \cdots \lambda_d}}} \right) \\
&\ge 1 - \frac{\beta}{2}
\end{align*}
$$
where the third inequality holds because $\beta \in (0, 1)$ and the last one holds by Proposition 4 since $B \ge \frac{3}{\alpha^2}(\ln(\frac{8}{\beta}) + \alpha(1 - \alpha))$. Lemma 2 then implies that

$$ \mathbb{P}_{p \times q \times r} \left( \Delta_{\alpha}^{\lambda, B} (\mathbb{X}_m, \mathbb{Y}_n, \mathbb{Z}_B) = 0 \right) \le \beta. $$

## E.6 Proof of Theorem 6

Theorem 5 gives us a condition on $\|\psi\|_2^2 - \|\psi - \psi * \varphi_\lambda\|_2^2$ to control the power of the test $\Delta_{\alpha}^{\lambda, B}$. We now want to upper bound $\|\psi - \psi * \varphi_\lambda\|_2^2$ in terms of the bandwidths when assuming that the difference of the densities lie in a Sobolev ball. We first prove that if $\psi := p - q \in S_d^s(R)$ for some $s > 0$ and $R > 0$, then there exists some $S \in (0, 1)$ such that

$$ \|\psi - \psi * \varphi_\lambda\|_2^2 - S^2 \|\psi\|_2^2 \le C'_4(d, s, R) \sum_{i=1}^{d} \lambda_i^{2s} \quad (24) $$

for some positive constant $C'_4(d, s, R)$.

For $j = 1, \dots, d$, since $K_j \in L^1(\mathbb{R}) \cap L^2(\mathbb{R})$, it follows by the Riemann-Lebesgue Lemma that its Fourier transform $\hat{K}_j$ is continuous. For $j = 1, \dots, d$, note that

$$ \hat{K}_j(0) = \int_{\mathbb{R}} K_j(x)e^{-ix0}dx = \int_{\mathbb{R}} K_j(x)dx = 1 $$

and, since $K_j \in L^1(\mathbb{R}) \cap L^2(\mathbb{R})$, also that

$$ \prod_{j=1}^{d} |\hat{K}_j(\xi_j)| \le \prod_{j=1}^{d} \int_{\mathbb{R}} |K_j(x)e^{-ix\xi_j}| dx = \prod_{j=1}^{d} \int_{\mathbb{R}} |K_j(x)| dx =: \kappa_1 < \infty $$

as defined in Equation (21). We deduce that $|1 - \prod_{i=1}^d \hat{K}_i(\xi_i)| \le 1 + \kappa_1$ for all $\xi \in \mathbb{R}^d$. Let us define $g: \mathbb{R}^d \to \mathbb{R}$ by $g(\xi) = 1 - \prod_{i=1}^d \hat{K}_i(\xi_i)$ for $\xi \in \mathbb{R}^d$. We have $g(0, \dots, 0) = 0$, so by continuity of $g$, there exists some $t > 0$ such that

$$ S := \sup_{\|\xi\|_2 \le t} |g(\xi)| < 1. $$

For any $s > 0$, we also define

$$ T_s := \sup_{\|\xi\|_2 > t} \frac{|1 - \prod_{i=1}^d \hat{K}_i(\xi_i)|}{\|\xi\|_2^s} \le \frac{1 + \kappa_1}{t^s} < \infty. $$

Let $\Psi := \psi - \psi * \varphi_\lambda$. As it is a scaled product of $K_1, \dots, K_d \in L^1(\mathbb{R}) \cap L^2(\mathbb{R})$, we have $\varphi_\lambda \in L^1(\mathbb{R}^d) \cap L^2(\mathbb{R}^d)$. Since we assume that $\psi \in S_d^s(R)$, we have $\psi \in L^1(\mathbb{R}^d) \cap L^2(\mathbb{R}^d)$. For $p \in \{1, 2\}$, since $\psi \in L^1(\mathbb{R}^d)$, we have $\|\psi * \varphi_\lambda\|_p \le \|\psi\|_1 \|\varphi_\lambda\|_p < \infty$. Hence, we deduce that $\Psi \in L^1(\mathbb{R}^d) \cap L^2(\mathbb{R}^d)$. By Plancherel's Theorem, we then have

$$ (2\pi)^d \|\Psi\|_2^2 = \|\hat{\Psi}\|_2^2 \\ (2\pi)^d \|\psi - \psi * \varphi_\lambda\|_2^2 = \|(1 - \hat{\varphi}_\lambda)\hat{\psi}\|_2^2. $$
In general, for $a > 0$ the Fourier transform of a function $x \mapsto \frac{1}{a}f(\frac{x}{a})$ is $\xi \mapsto \hat{f}(a\xi)$. Since $\varphi_{\lambda}(u) := \prod_{i=1}^{d} \frac{1}{\lambda_i} K_i(\frac{u_i}{\lambda_i})$ for $u \in \mathbb{R}^d$, we deduce that $\hat{\varphi}_{\lambda}(\xi) = \prod_{i=1}^{d} \hat{K}_i(\lambda_i \xi_i)$ for $\xi \in \mathbb{R}^d$. Therefore, we have

$$
\begin{aligned}
& (2\pi)^d \|\psi - \psi * \varphi_{\lambda}\|_2^2 \\
&= \left\| (1 - \hat{\varphi}_{\lambda}) \hat{\psi} \right\|_2^2 \\
&= \int_{\mathbb{R}^d} |1 - \hat{\varphi}_{\lambda}(\xi)|^2 |\hat{\psi}(\xi)|^2 d\xi \\
&= \int_{\mathbb{R}^d} \left| 1 - \prod_{i=1}^d \hat{K}(\lambda_i \xi_i) \right|^2 |\hat{\psi}(\xi)|^2 d\xi \\
&= \int_{\|\xi\|_2 \le t} \left| 1 - \prod_{i=1}^d \hat{K}(\lambda_i \xi_i) \right|^2 |\hat{\psi}(\xi)|^2 d\xi + \int_{\|\xi\|_2 > t} \left| 1 - \prod_{i=1}^d \hat{K}(\lambda_i \xi_i) \right|^2 |\hat{\psi}(\xi)|^2 d\xi \\
&\le S^2 \int_{\|\xi\|_2 \le t} |\hat{\psi}(\xi)|^2 d\xi + T_s^2 \int_{\|\xi\|_2 > t} \|(\lambda_1 \xi_1, \dots, \lambda_d \xi_d)\|_2^{2s} |\hat{\psi}(\xi)|^2 d\xi \\
&\le S^2 \left\| \hat{\psi} \right\|_2^2 + T_s^2 \int_{\mathbb{R}^d} \left( \sum_{i=1}^d \lambda_i^2 \xi_i^2 \right)^s |\hat{\psi}(\xi)|^2 d\xi \\
&\le S^2 (2\pi)^d \|\psi\|_2^2 + T_s^2 \int_{\mathbb{R}^d} \left( \sum_{i=1}^d \lambda_i^2 \right)^s \left( \sum_{i=1}^d \xi_i^2 \right)^s |\hat{\psi}(\xi)|^2 d\xi \\
&= S^2 (2\pi)^d \|\psi\|_2^2 + T_s^2 \|\lambda\|_2^{2s} \int_{\mathbb{R}^d} \|\xi\|_2^{2s} |\hat{\psi}(\xi)|^2 d\xi \\
&\le S^2 (2\pi)^d \|\psi\|_2^2 + T_s^2 \|\lambda\|_2^{2s} (2\pi)^d R^2
\end{aligned}
$$

since $\psi \in S_d^s(\mathbb{R})$, and where we have used Plancherel's Theorem for $\psi \in L^1(\mathbb{R}^d) \cap L^2(\mathbb{R}^d)$.
We have proved that there exists some $S \in (0, 1)$ such that

$$ \|\psi - \psi * \varphi_{\lambda}\|_{2}^{2} \leq S^{2}\|\psi\|_{2}^{2} + T_{s}^{2}R^{2}\|\lambda\|_{2}^{2s}. $$

If $s \ge 1$, then $x \mapsto x^s$ is convex and, by Jensen's inequality (finite form), we have

$$ \|\lambda\|_2^{2s} = \left( \sum_{i=1}^{d} \lambda_i^2 \right)^s = d^s \left( \sum_{i=1}^{d} \frac{1}{d} \lambda_i^2 \right)^s \le d^s \sum_{i=1}^{d} \frac{1}{d} (\lambda_i^2)^s = d^{s-1} \sum_{i=1}^{d} \lambda_i^{2s} \le d^{1+s} \sum_{i=1}^{d} \lambda_i^{2s}. $$

If $s < 1$, then $\gamma := \frac{1}{s} > 1$ and so, it is a standard result that $\|\cdot\|_{\gamma} \le \|\cdot\|_{1}$. We then have

$$ \|\lambda\|_2^{2s} = \left( \sum_{i=1}^{d} \lambda_i^2 \right)^s = \left( \sum_{i=1}^{d} (\lambda_i^{2s})^{\gamma} \right)^{1/\gamma} = \|\lambda^{2s}\|_{\gamma} \le \|\lambda^{2s}\|_{1} = \sum_{i=1}^{d} \lambda_i^{2s} \le d^{1+s} \sum_{i=1}^{d} \lambda_i^{2s}. $$

Hence, for all $s > 0$, we have $\|\lambda\|_2^{2s} \le d^{1+s} \sum_{i=1}^{d} \lambda_i^{2s}$. We conclude that

$$ \|\psi - \psi * \varphi_{\lambda}\|_{2}^{2} \leq S^{2}\|\psi\|_{2}^{2} + T_{s}^{2}R^{2}d^{1+s}\sum_{i=1}^{d}\lambda_{i}^{2s} $$
which proves the statement presented in Equation (24) with $C'_4(d, s, R) := T_s^2 R^2 d^{1+s}$.
We now consider the constant $C_3(M, d)$ from Theorem 5. Suppose we have

$$
\begin{align*}
\|\psi\|_2^2 &\ge \frac{T_s^2 R^2 d^{1+s}}{1-S^2} \sum_{i=1}^d \lambda_i^{2s} + \frac{C_3}{(1-S^2)} \frac{\ln\left(\frac{1}{\alpha}\right)}{\beta(m+n)\sqrt{\lambda_1 \cdots \lambda_d}} \\
(1-S^2)\|\psi\|_2^2 &\ge T_s^2 R^2 d^{1+s} \sum_{i=1}^d \lambda_i^{2s} + C_3 \frac{\ln\left(\frac{1}{\alpha}\right)}{\beta(m+n)\sqrt{\lambda_1 \cdots \lambda_d}} \\
\|\psi\|_2^2 &\ge S^2 \|\psi\|_2^2 + T_s^2 R^2 d^{1+s} \sum_{i=1}^d \lambda_i^{2s} + C_3 \frac{\ln\left(\frac{1}{\alpha}\right)}{\beta(m+n)\sqrt{\lambda_1 \cdots \lambda_d}} \\
\|\psi\|_2^2 &\ge \|\psi - \psi * \varphi_\lambda\|_2^2 + C_3 \frac{\ln\left(\frac{1}{\alpha}\right)}{\beta(m+n)\sqrt{\lambda_1 \cdots \lambda_d}}
\end{align*}
$$

then, by Theorem 5, we can ensure that

$$
\mathbb{P}_{p \times q \times r} \left( \Delta_{\alpha}^{\lambda, B} (\mathbb{X}_m, \mathbb{Y}_n, \mathbb{Z}_B) = 0 \right) \le \beta.
$$

By definition of uniform separation rates, we deduce that

$$
\begin{align*}
\rho \left( \Delta_{\alpha}^{\lambda, B}, S_d^s(R), \beta, M \right)^2 &\le \frac{T_s^2 R^2 d^{1+s}}{1-S^2} \sum_{i=1}^d \lambda_i^{2s} + \frac{C_3}{(1-S^2)} \frac{\ln\left(\frac{1}{\alpha}\right)}{\beta(m+n)\sqrt{\lambda_1 \cdots \lambda_d}} \\
&\le C_4(M, d, s, R, \beta) \left( \sum_{i=1}^d \lambda_i^{2s} + \frac{\ln\left(\frac{1}{\alpha}\right)}{(m+n)\sqrt{\lambda_1 \cdots \lambda_d}} \right)
\end{align*}
$$

$$
\text{for } C_4(M, d, s, R, \beta) := \max \left\{ \frac{T_s^2 R^2 d^{1+s}}{1-S^2}, \frac{C_3(M, d)}{\beta(1-S^2)} \right\}.
$$

E.7 Proof of Corollary 7

By Theorem 6, if $\lambda_1 \cdots \lambda_d \le 1$, we have

$$
\rho \left( \Delta_{\alpha}^{\lambda, B}, S_d^s(R), \beta, M \right)^2 \le C_4(M, d, s, R, \beta) \left( \sum_{i=1}^d \lambda_i^{2s} + \frac{\ln\left(\frac{1}{\alpha}\right)}{(m+n)\sqrt{\lambda_1 \cdots \lambda_d}} \right).
$$

We want to express the bandwidths in terms of the sum of sample sizes $m+n$ raised to some negative power such that the terms $\sum_{i=1}^d \lambda_i^{2s}$ and $\frac{1}{(m+n)\sqrt{\lambda_1 \cdots \lambda_d}}$ have the same behaviour in $m+n$. With the choice of bandwidths $\lambda_i^* := (m+n)^{-2/(4s+d)}$ for $i=1, \dots, d$, the term $\sum_{i=1}^d (\lambda_i^*)^{2s}$ has order $(m+n)^{-4s/(4s+d)}$ and the term $\frac{1}{(m+n)\sqrt{\lambda_1^* \cdots \lambda_d^*}}$ has order $(m+n)^{d/(4s+d)-1} = (m+n)^{-4s/(4s+d)}$. So, indeed, this choice of bandwidths leads to the same behaviour in $m+n$ for the two terms, which gives the smallest order of $m+n$ possible.
It is clear that $\lambda_1^* \cdots \lambda_d^* < 1$, we find that

$$ \begin{aligned} \rho(\Delta_{\alpha}^{\lambda^*,B}, S_d^s(R), \beta, M)^2 &\le C_4(M, d, s, R, \beta) \left( \sum_{i=1}^d (\lambda_i^*)^{2s} + \frac{\ln(\frac{1}{\alpha})}{(m+n)\sqrt{\lambda_1^* \cdots \lambda_d^*}} \right) \\ &\le C_4(M, d, s, R, \beta) \left( (m+n)^{-4s/(4s+d)} + \ln(\frac{1}{\alpha}) (m+n)^{-4s/(4s+d)} \right) \\ &\le C_4(M, d, s, R, \beta) \ln(\frac{1}{\alpha}) (m+n)^{-4s/(4s+d)} \\ &= C_5(M, d, s, R, \alpha, \beta)^2 (m+n)^{-4s/(4s+d)} \end{aligned} $$

for $C_5(M, d, s, R, \alpha, \beta) := \sqrt{C_4(M, d, s, R, \beta) \ln(\frac{1}{\alpha})}$. We deduce that

$$ \rho(\Delta_{\alpha}^{\lambda^*,B}, S_d^s(R), \beta, M) \le C_5(M, d, s, R, \alpha, \beta) (m+n)^{-2s/(4s+d)}. $$

## E.8 Proof of Proposition 8

By definition of $u_{\alpha}^{B_2}$, we have

$$ \frac{1}{B_2} \sum_{b=1}^{B_2} 1 \left( \max_{\lambda \in \Lambda} \left( \hat{M}_{\lambda,2}^b \left( \mu^{(b,2)} |\mathbb{X}_m, \mathbb{Y}_n \right) - \hat{q}_{1-u_{\alpha}^{B_2}}^{\lambda, B_1} \left( \mathbb{Z}_{B_2} | \mathbb{X}_m, \mathbb{Y}_n, \mathbb{Z}_{B_1} \right) \right) w_{\lambda} \left( \mathbb{Z}_{B_1} | \mathbb{X}_m, \mathbb{Y}_n \right) \right) > 0 \le \alpha. $$

Taking the expectation on both sides, we get

$$ \mathbb{P}_{p \times p \times r \times r} \left( \max_{\lambda \in \Lambda} \left( \widehat{\text{MMD}}_{\lambda}^2 (\mathbb{X}_m, \mathbb{Y}_n) - \hat{q}_{1-u_{\alpha}^{B_2}}^{\lambda, B_1} (\mathbb{Z}_{B_2} | \mathbb{X}_m, \mathbb{Y}_n, \mathbb{Z}_{B_1}) w_{\lambda} (\mathbb{Z}_{B_1} | \mathbb{X}_m, \mathbb{Y}_n) \right) > 0 \right) \le \alpha $$

as under the null hypothesis $\mathcal{H}_0: p = q$, we have $(\hat{M}_{\lambda,2}^b(\mu^{(b,2)}|\mathbb{X}_m, \mathbb{Y}_n))_{1\le b \le B_2}$ distributed like $\widehat{\text{MMD}}_{\lambda}^2(\mathbb{X}_m, \mathbb{Y}_n)$. Using the bisection search approximation which satisfies

$$ \hat{u}_{\alpha}^{B_2:3}(\mathbb{Z}_{B_2} | \mathbb{X}_m, \mathbb{Y}_n, \mathbb{Z}_{B_1}) \le u_{\alpha}^{B_2}(\mathbb{Z}_{B_2} | \mathbb{X}_m, \mathbb{Y}_n, \mathbb{Z}_{B_1}), $$

we get

$$ \begin{aligned} & \mathbb{P}_{p \times p \times r \times r} \left( \max_{\lambda \in \Lambda} \left( \widehat{\text{MMD}}_{\lambda}^2 (\mathbb{X}_m, \mathbb{Y}_n) - \hat{q}_{1-u_{\alpha}^{B_2:3}}^{\lambda, B_1} (\mathbb{Z}_{B_2} | \mathbb{X}_m, \mathbb{Y}_n, \mathbb{Z}_{B_1}) w_{\lambda} (\mathbb{Z}_{B_1} | \mathbb{X}_m, \mathbb{Y}_n) \right) > 0 \right) \\ & \le \mathbb{P}_{p \times p \times r \times r} \left( \max_{\lambda \in \Lambda} \left( \widehat{\text{MMD}}_{\lambda}^2 (\mathbb{X}_m, \mathbb{Y}_n) - \hat{q}_{1-u_{\alpha}^{B_2}}^{\lambda, B_1} (\mathbb{Z}_{B_2} | \mathbb{X}_m, \mathbb{Y}_n, \mathbb{Z}_{B_1}) w_{\lambda} (\mathbb{Z}_{B_1} | \mathbb{X}_m, \mathbb{Y}_n) \right) > 0 \right) \\ & \le \alpha. \end{aligned} $$

We deduce that

$$ \mathbb{P}_{p \times p \times r \times r} (\Delta_{\alpha}^{\lambda^w, B_{1:3}} (\mathbb{X}_m, \mathbb{Y}_n, \mathbb{Z}_{B_1}, \mathbb{Z}_{B_2}) = 1) \le \alpha. $$
## E.9 Proof of Theorem 9

Consider some $u^* \in (0, 1)$ to be determined later. For $b = 1, \dots, B_2$, let

$$W_b(\mu^{(b,2)}|\mathbb{X}_m, \mathbb{Y}_n, \mathbb{Z}_{B_1}) := 1\left(\max_{\lambda \in \Lambda} \left(\widehat{M}_b^\lambda(\mu^{(b,2)}|\mathbb{X}_m, \mathbb{Y}_n) - \hat{q}_{1-u^*w_\lambda}^{\lambda,B_1}(\mathbb{Z}_{B_1}|\mathbb{X}_m, \mathbb{Y}_n)\right) > 0\right),$$

so that, following a similar argument to the one presented in Appendix E.8, we obtain that $\mathbb{E}_{p \times q \times r \times r}[W_b(\mu^{(b,2)}|\mathbb{X}_m, \mathbb{Y}_n, \mathbb{Z}_{B_1})]$ is equal to

$$\mathbb{P}_{p \times p \times r} \left( \max_{\lambda \in \Lambda} \left( \widehat{\text{MMD}}_{\lambda}^2(\mathbb{X}_m, \mathbb{Y}_n) - \hat{q}_{1-u^*w_\lambda}^{\lambda,B_1}(\mathbb{Z}_{B_1}|\mathbb{X}_m, \mathbb{Y}_n) \right) > 0 \right).$$

Consider the events

$$\mathcal{A}' := \left\{ \frac{1}{B_2} \sum_{b=1}^{B_2} W_b(\mu^{(b,2)}|\mathbb{X}_m, \mathbb{Y}_n, \mathbb{Z}_{B_1}) - \mathbb{E}_r \left[ W_b(\mu^{(b,2)}|\mathbb{X}_m, \mathbb{Y}_n, \mathbb{Z}_{B_1}) \right] \le \sqrt{\frac{1}{2B_2} \ln\left(\frac{2}{\beta}\right)} \right\}$$

and

$$\mathcal{A} := \left\{ \frac{1}{B_2} \sum_{b=1}^{B_2} W_b(\mu^{(b,2)}|\mathbb{X}_m, \mathbb{Y}_n, \mathbb{Z}_{B_1}) - \mathbb{E}_{p \times q \times r \times r} \left[ W_b(\mu^{(b,2)}|\mathbb{X}_m, \mathbb{Y}_n, \mathbb{Z}_{B_1}) \right] \right. \\ \left. \le \sqrt{\frac{1}{2B_2} \ln\left(\frac{2}{\beta}\right)} \right\}.$$

Using Hoeffding's inequality, we obtain that $\mathbb{P}_r(\mathcal{A}'|\mathbb{X}_m, \mathbb{Y}_n, \mathbb{Z}_{B_1}) \ge 1 - \frac{\beta}{2}$ for any $\mathbb{X}_m, \mathbb{Y}_n$ and $\mathbb{Z}_{B_1}$, we deduce that $\mathbb{P}_{p \times q \times r \times r}(\mathcal{A}) \ge 1 - \frac{\beta}{2}$.

First, assuming that the event $\mathcal{A}$ holds, we show that $u_{\alpha}^{B_2}(\mathbb{Z}_{B_2}|\mathbb{X}_m, \mathbb{Y}_n, \mathbb{Z}_{B_1}) \ge \alpha$. Since we assume that the event $\mathcal{A}$ holds, the bounds we obtain hold with probability $1 - \frac{\beta}{2}$. We have

$$\begin{align*}
& \frac{1}{B_2} \sum_{b=1}^{B_2} 1 \left( \max_{\lambda \in \Lambda} \left( \widehat{M}_{\lambda,2}^b (\mu^{(b,2)}|\mathbb{X}_m, \mathbb{Y}_n) - \hat{q}_{1-u^*w_\lambda}^{\lambda,B_1}(\mathbb{Z}_{B_1}|\mathbb{X}_m, \mathbb{Y}_n) \right) > 0 \right) \\
&= \frac{1}{B_2} \sum_{b=1}^{B_2} W_b(\mu^{(b,2)}|\mathbb{X}_m, \mathbb{Y}_n, \mathbb{Z}_{B_1}) \\
&\le \mathbb{E}_{p \times p \times r \times r} \left[ W_b(\mu^{(b,2)}|\mathbb{X}_m, \mathbb{Y}_n, \mathbb{Z}_{B_1}) \right] + \sqrt{\frac{1}{2B_2} \ln\left(\frac{2}{\beta}\right)} \\
&= \mathbb{P}_{p \times p \times r} \left( \max_{\lambda \in \Lambda} \left( \widehat{\text{MMD}}_{\lambda}^2(\mathbb{X}_m, \mathbb{Y}_n) - \hat{q}_{1-u^*w_\lambda}^{\lambda,B_1}(\mathbb{Z}_{B_1}|\mathbb{X}_m, \mathbb{Y}_n) \right) > 0 \right) + \sqrt{\frac{1}{2B_2} \ln\left(\frac{2}{\beta}\right)} \\
&= \mathbb{P}_{p \times p \times r} \left( \bigcup_{\lambda \in \Lambda} \left\{ \widehat{\text{MMD}}_{\lambda}^2(\mathbb{X}_m, \mathbb{Y}_n) > \hat{q}_{1-u^*w_\lambda}^{\lambda,B_1}(\mathbb{Z}_{B_1}|\mathbb{X}_m, \mathbb{Y}_n) \right\} \right) + \sqrt{\frac{1}{2B_2} \ln\left(\frac{2}{\beta}\right)}.
\end{align*}$$
Using Boole's inequality, we obtain

$$
\begin{align*}
& \frac{1}{B_2} \sum_{b=1}^{B_2} \mathbb{1} \left( \max_{\lambda \in \Lambda} \left( \hat{M}_{\lambda,2}^b \left( \mu^{(b,2)} |\mathbb{X}_m, \mathbb{Y}_n \right) - \hat{q}_{1-u^*w_\lambda}^{\lambda, B_1} (\mathbb{Z}_{B_1} | \mathbb{X}_m, \mathbb{Y}_n) \right) > 0 \right) \\
\leq & \sum_{\lambda \in \Lambda} \mathbb{P}_{p \times p \times r} \left( \widehat{\text{MMD}}_{\lambda}^2 (\mathbb{X}_m, \mathbb{Y}_n) > \hat{q}_{1-u^*w_\lambda}^{\lambda, B_1} (\mathbb{Z}_{B_1} | \mathbb{X}_m, \mathbb{Y}_n) \right) + \sqrt{\frac{1}{2B_2} \ln \left( \frac{2}{\beta} \right)} \\
\leq & \sum_{\lambda \in \Lambda} u^* w_\lambda + \sqrt{\frac{1}{2B_2} \ln \left( \frac{2}{\beta} \right)} \\
\leq & u^* + \sqrt{\frac{1}{2B_2} \ln \left( \frac{2}{\beta} \right)} \\
= & \frac{3\alpha}{4} + \sqrt{\frac{1}{2B_2} \ln \left( \frac{2}{\beta} \right)}
\end{align*}
$$

for $u^* := \frac{3\alpha}{4}$, where we have used Proposition 1 and the fact that $\sum_{\lambda \in \Lambda} w_\lambda \le 1$. Now, for $B_2 \ge \frac{8}{\alpha^2} \ln(\frac{2}{\beta})$, we get

$$
\frac{3\alpha}{4} + \sqrt{\frac{1}{2B_2} \ln\left(\frac{2}{\beta}\right)} \le \alpha
$$

and so, we obtain

$$
\frac{1}{B_2} \sum_{b=1}^{B_2} \mathbb{1} \left( \max_{\lambda \in \Lambda} \left( \hat{M}_{\lambda,2}^b \left( \mu^{(b,2)} |\mathbb{X}_m, \mathbb{Y}_n \right) - \hat{q}_{1-u^*w_\lambda}^{\lambda, B_1} (\mathbb{Z}_{B_1} |\mathbb{X}_m, \mathbb{Y}_n) \right) > 0 \right) \le \alpha.
$$

Recall that $u_{\alpha}^{B_2}(\mathbb{Z}_{B_2}|\mathbb{X}_m, \mathbb{Y}_n, \mathbb{Z}_{B_1})$ is defined as

$$
\sup \left\{ u \in (0, \min_{\lambda \in \Lambda} w_{\lambda}^{-1}) : \frac{1}{B_2} \sum_{b=1}^{B_2} \mathbb{1} \left( \max_{\lambda \in \Lambda} \left( \hat{M}_{\lambda,2}^{b} \left( \mu^{(b,2)} | \mathbb{X}_m, \mathbb{Y}_n \right) - \hat{q}_{1-uw_{\lambda}}^{\lambda, B_1} \left( \mathbb{Z}_{B_1} | \mathbb{X}_m, \mathbb{Y}_n \right) \right) > 0 \right) \le \alpha \right\},
$$

we deduce that

$$
u_{\alpha}^{B_2}(\mathbb{Z}_{B_2} | \mathbb{X}_m, \mathbb{Y}_n, \mathbb{Z}_{B_1}) \geq u^* = \frac{3\alpha}{4}
$$

for $B_2 \ge \frac{8}{\alpha^2} \ln(\frac{2}{\beta})$ when the event $\mathcal{A}$ holds.

Under the event $\mathcal{A}$, after performing $B_3$ steps of the bisection method, we have

$$
\begin{align*}
\hat{u}_{\alpha}^{B_{2:3}}(\mathbb{Z}_{B_2} | \mathbb{X}_m, \mathbb{Y}_n, \mathbb{Z}_{B_1}) &\ge u_{\alpha}^{B_2}(\mathbb{Z}_{B_2} | \mathbb{X}_m, \mathbb{Y}_n, \mathbb{Z}_{B_1}) - \frac{\min_{\lambda \in \Lambda} w_{\lambda}^{-1}}{2^{B_3}} \\
&\ge \frac{3\alpha}{4} - \frac{\min_{\lambda \in \Lambda} w_{\lambda}^{-1}}{2^{B_3}} \\
&\ge \frac{\alpha}{2}
\end{align*}
$$
for $B_3 \ge \log_2(\frac{4}{\alpha} \min_{\lambda \in \Lambda} w_{\lambda}^{-1})$.

We are interested in upper bounding the probability of type II error $\mathbb{P}_{p \times q \times r \times r}(\mathcal{B})$ for the event $\mathcal{B} := \{\Delta_{\alpha}^{\Lambda^w, B_{1:3}}(\mathbb{X}_m, \mathbb{Y}_n, \mathbb{Z}_{B_1}, \mathbb{Z}_{B_2}) = 0\}$. We have

$$ \begin{aligned} \mathbb{P}_{p \times q \times r \times r}(\mathcal{B}) &= \mathbb{P}_{p \times q \times r \times r}(\mathcal{B} | \mathcal{A}) \mathbb{P}_{p \times q \times r \times r}(\mathcal{A}) + \mathbb{P}_{p \times q \times r \times r}(\mathcal{B} | \mathcal{A}^c) \mathbb{P}_{p \times q \times r \times r}(\mathcal{A}^c) \\ &\le \mathbb{P}_{p \times q \times r \times r}(\mathcal{B} | \mathcal{A}) + \frac{\beta}{2} \end{aligned} $$

where

$$ \begin{aligned} & \mathbb{P}_{p \times q \times r \times r}(\mathcal{B} | \mathcal{A}) \\ &= \mathbb{P}_{p \times q \times r \times r} \left( \Delta_{\alpha}^{\Lambda^w, B_{1:3}}(\mathbb{X}_m, \mathbb{Y}_n, \mathbb{Z}_{B_1}, \mathbb{Z}_{B_2}) = 0 \mid \mathcal{A} \right) \\ &= \mathbb{P}_{p \times q \times r \times r} \left( \bigcap_{\lambda \in \Lambda} \left\{ \widehat{\text{MMD}}_{\lambda}^2(\mathbb{X}_m, \mathbb{Y}_n) \le \hat{q}_{1-\hat{u}_{\alpha}^{B_{2:3}}(\mathbb{Z}_{B_2} | \mathbb{X}_m, \mathbb{Y}_n, \mathbb{Z}_{B_1})}^{\lambda, B_1} (\mathbb{Z}_{B_1} | \mathbb{X}_m, \mathbb{Y}_n) \right\} \mid \mathcal{A} \right) \\ &\le \min_{\lambda \in \Lambda} \mathbb{P}_{p \times q \times r \times r} \left( \widehat{\text{MMD}}_{\lambda}^2(\mathbb{X}_m, \mathbb{Y}_n) \le \hat{q}_{1-\hat{u}_{\alpha}^{B_{2:3}}(\mathbb{Z}_{B_2} | \mathbb{X}_m, \mathbb{Y}_n, \mathbb{Z}_{B_1})}^{\lambda, B_1} (\mathbb{Z}_{B_1} | \mathbb{X}_m, \mathbb{Y}_n) \mid \mathcal{A} \right) \\ &\le \min_{\lambda \in \Lambda} \mathbb{P}_{p \times q \times r} \left( \widehat{\text{MMD}}_{\lambda}^2(\mathbb{X}_m, \mathbb{Y}_n) \le \hat{q}_{1-\alpha w_{\lambda}/2}^{\lambda, B_1} (\mathbb{Z}_{B_1} | \mathbb{X}_m, \mathbb{Y}_n) \right) \\ &= \min_{\lambda \in \Lambda} \mathbb{P}_{p \times q \times r} \left( \Delta_{\alpha w_{\lambda}/2}^{\lambda, B_1} (\mathbb{Z}_{B_1} | \mathbb{X}_m, \mathbb{Y}_n) = 0 \right), \end{aligned} $$

we deduce that

$$ \mathbb{P}_{p \times q \times r \times r} (\Delta_{\alpha}^{\Lambda^w, B_{1:3}}(\mathbb{X}_m, \mathbb{Y}_n, \mathbb{Z}_{B_1}, \mathbb{Z}_{B_2}) = 0) \le \frac{\beta}{2} + \min_{\lambda \in \Lambda} \mathbb{P}_{p \times q \times r} (\Delta_{\alpha w_{\lambda}/2}^{\lambda, B_1}(\mathbb{Z}_{B_1} | \mathbb{X}_m, \mathbb{Y}_n) = 0). \quad (25) $$

In order to upper bound $\mathbb{P}_{p \times q \times r \times r} (\Delta_{\alpha}^{\Lambda^w, B_{1:3}}(\mathbb{X}_m, \mathbb{Y}_n, \mathbb{Z}_{B_1}, \mathbb{Z}_{B_2}) = 0)$ by $\beta$ it is sufficient to upper bound $\min_{\lambda \in \Lambda} \mathbb{P}_{p \times q \times r} (\Delta_{\alpha w_{\lambda}/2}^{\lambda, B_1}(\mathbb{X}_m, \mathbb{Y}_n, \mathbb{Z}_{B_1}) = 0)$ by $\frac{\beta}{2}$. By definition of uniform separation rates, it follows that

$$ \rho(\Delta_{\alpha}^{\Lambda^w, B_{1:3}}, S_d^s(R), \beta, M)^2 \le 4 \min_{\lambda \in \Lambda} \rho(\Delta_{\alpha w_{\lambda}/2}^{\lambda, B_1}, S_d^s(R), \beta, M)^2. $$

For each $\lambda \in \Lambda$, since $(1 - \alpha w_{\lambda}/2)\alpha w_{\lambda}/2 \le (1 - \alpha)\alpha$ as $\alpha \in (0, e^{-1})$ and $w_{\lambda} \le 1$, we have

$$ \begin{aligned} B_1 &\ge (\max_{\lambda \in \Lambda} w_{\lambda}^{-2}) \frac{12}{\alpha^2} \left( \log \left( \frac{8}{\beta} \right) + \alpha(1-\alpha) \right) \\ &\ge \frac{3}{(\alpha w_{\lambda}/2)^2} \left( \log \left( \frac{8}{\beta} \right) + \frac{\alpha w_{\lambda}}{2} \left( 1 - \frac{\alpha w_{\lambda}}{2} \right) \right), \end{aligned} $$
so we can apply Theorem 6 to the tests $(\Delta_{\alpha w_{\lambda}/2}^{\lambda, B_1})_{\lambda \in \Lambda}$ to obtain

$$
\begin{align*}
\rho(\Delta_{\alpha}^{\Lambda^{w}, B_{1:3}}, S_{d}^{s}(R), \beta, M)^{2} &\leq 4 \min_{\lambda \in \Lambda} \rho(\Delta_{\alpha w_{\lambda}/2}^{\lambda, B_{1}}, S_{d}^{s}(R), \beta, M)^{2} \\
&\leq 4C_{4}(M, d, s, R, \beta) \min_{\lambda \in \Lambda} \left( \sum_{i=1}^{d} \lambda_{i}^{2s} + \frac{\ln\left(\frac{2}{\alpha w_{\lambda}}\right)}{(m+n)\sqrt{\lambda_{1} \cdots \lambda_{d}}} \right) \\
&\leq C_{6}(M, d, s, R, \beta) \min_{\lambda \in \Lambda} \left( \sum_{i=1}^{d} \lambda_{i}^{2s} + \frac{\ln\left(\frac{1}{\alpha w_{\lambda}}\right)}{(m+n)\sqrt{\lambda_{1} \cdots \lambda_{d}}} \right)
\end{align*}
$$

for $C_6(M, d, s, R, \beta) := 8C_4(M, d, s, R, \beta)$ where $C_4(M, d, s, R, \beta)$ is the constant from Theorem 6, and where we used the fact that

$$
\ln\left(\frac{2}{\alpha w_{\lambda}}\right) = \ln(2) + \ln\left(\frac{1}{\alpha w_{\lambda}}\right) \leq (\ln(2) + 1) \ln\left(\frac{1}{\alpha w_{\lambda}}\right) \leq 2 \ln\left(\frac{1}{\alpha w_{\lambda}}\right)
$$

as $\ln(\frac{1}{\alpha w_{\lambda}}) \geq \ln(\frac{1}{\alpha}) > 1$ since $\alpha \in (0, e^{-1})$.

E.10 Proof of Corollary 10

First, note that we indeed have

$$
\sum_{\lambda \in \Lambda} w_{\lambda} < \frac{6}{\pi^2} \sum_{\ell=1}^{\infty} \frac{1}{\ell^2} = 1
$$

and also that for all $\lambda = (2^{-\ell}, \dots, 2^{-\ell}) \in \Lambda$ we have $\lambda_1 \cdots \lambda_d = 2^{-d\ell} < 1$ as $\ell, d \in \mathbb{N} \setminus \{0\}$.
Let $\lambda^* = (2^{-\ell^*}, \dots, 2^{-\ell^*}) \in \Lambda$ where

$$
\ell^* := \left\lceil \frac{2}{4s+d} \log_2 \left( \frac{m+n}{\ln(\ln(m+n))} \right) \right\rceil \le \left\lceil \frac{2}{d} \log_2 \left( \frac{m+n}{\ln(\ln(m+n))} \right) \right\rceil.
$$

Since $\min_{\lambda \in \Lambda} w_{\lambda}^{-1} = \frac{6}{\pi^2}$, we have $B_3 \ge \log_2(\frac{4}{\alpha} \min_{\lambda \in \Lambda} w_{\lambda}^{-1})$, so we can apply Theorem 9 to get

$$
\begin{align*}
\rho(\Delta_{\alpha}^{\Lambda^{w}, B_{1:3}}, S_{d}^{s}(R), \beta, M)^{2} &\leq C_{6}(M, d, s, R, \beta) \min_{\lambda \in \Lambda} \left( \sum_{i=1}^{d} \lambda_{i}^{2s} + \frac{\ln\left(\frac{1}{\alpha}\right) + \ln\left(\frac{1}{w_{\lambda}}\right)}{(m+n)\sqrt{\lambda_{1} \cdots \lambda_{d}}} \right) \\
&\leq C_{6}(M, d, s, R, \beta) \left( \sum_{i=1}^{d} (\lambda_{i}^{*})^{2s} + \frac{\ln\left(\frac{1}{\alpha}\right) + \ln\left(\frac{1}{w_{\lambda^{*}}}\right)}{(m+n)\sqrt{\lambda_{1}^{*} \cdots \lambda_{d}^{*}}} \right).
\end{align*}
$$

Note that $\ell^* \le \frac{2}{4s+d} \log_2\left(\frac{m+n}{\ln(\ln(m+n))}\right) + 1$ which gives $\lambda_i^* = 2^{-\ell^*} \ge 2^{-1} \left(\frac{m+n}{\ln(\ln(m+n))}\right)^{-2/(4s+d)}$
for $i=1, \dots, d$. We get $\sqrt{\lambda_1^* \cdots \lambda_d^*} \ge 2^{-\frac{d}{2}} \left(\frac{m+n}{\ln(\ln(m+n))}\right)^{-d/(4s+d)}$ and so

$$
\frac{1}{\sqrt{\lambda_1^* \cdots \lambda_d^*}} \le 2^{\frac{d}{2}} \left( \frac{m+n}{\ln(\ln(m+n))} \right)^{d/(4s+d)}.
$$
Note also that

$$ 
\begin{aligned}
\ell^* &\le \frac{2}{4s+d} \log_2 \left( \frac{m+n}{\ln(\ln(m+n))} \right) + 1 \\
&\le \frac{2}{4s+d} \log_2(m+n) + 1 \\
&\le \left( \frac{2}{d \ln(2)} + 1 \right) \ln(m+n) \\
&< 4 \ln(m+n)
\end{aligned}
$$

as $\ln(\ln(m+n)) > 1$ and $\ln(m+n) > 1$. We get

$$ 
\begin{aligned}
\ln\left(\frac{1}{w_{\lambda^*}}\right) &= 2\ln(\ell^*) + \ln\left(\frac{\pi^2}{6}\right) \\
&\le 2\ln(4\ln(m+n)) + \ln\left(\frac{\pi^2}{6}\right) \\
&\le \left(2\ln(4) + 1 + \ln\left(\frac{\pi^2}{6}\right)\right) \ln(\ln(m+n)) \\
&< 5\ln(\ln(m+n))
\end{aligned}
$$

as $\ln(\ln(m+n)) > 1$. Combining those upper bounds, we get

$$ 
\begin{aligned}
\frac{\ln\left(\frac{1}{\alpha}\right) + \ln\left(\frac{1}{w_{\lambda^*}}\right)}{(m+n)\sqrt{\lambda_1^* \dots \lambda_d^*}} &\le \frac{1}{(m+n)\sqrt{\lambda_1^* \dots \lambda_d^*}} \left(\ln\left(\frac{1}{\alpha}\right) + 5\ln(\ln(m+n))\right) \\
&\le \left(\ln\left(\frac{1}{\alpha}\right) + 5\right) \frac{\ln(\ln(m+n))}{m+n} \frac{1}{\sqrt{\lambda_1^* \dots \lambda_d^*}} \\
&\le 2^{\frac{d}{2}} \left(\ln\left(\frac{1}{\alpha}\right) + 5\right) \frac{\ln(\ln(m+n))}{m+n} \left(\frac{m+n}{\ln(\ln(m+n))}\right)^{d/(4s+d)} \\
&= 2^{\frac{d}{2}} \left(\ln\left(\frac{1}{\alpha}\right) + 5\right) \left(\frac{m+n}{\ln(\ln(m+n))}\right)^{-4s/(4s+d)}
\end{aligned}
$$

as $\ln(\ln(m+n)) > 1$. Note also that

$$ \ell^* \ge \frac{2}{4s+d} \log_2 \left( \frac{m+n}{\ln(\ln(m+n))} \right) $$

giving

$$ (\lambda_i^*)^{2s} = (2^{-\ell^*})^{2s} \le \left( \frac{m+n}{\ln(\ln(m+n))} \right)^{-4s/(4s+d)} $$

for $i = 1, \dots, d$. Hence, we get

$$ \sum_{i=1}^{d} (\lambda_i^*)^{2s} \le d \left( \frac{m+n}{\ln(\ln(m+n))} \right)^{-4s/(4s+d)} $$
We obtain

$$
\begin{align*}
\rho(\Delta_{\alpha}^{\Lambda^w, B_{1:3}}, \mathcal{S}_d^s(R), \beta, M)^2 &\le C_6(M, d, s, R, \beta) \left( \sum_{i=1}^d (\lambda_i^*)^{2s} + \frac{\ln(\frac{1}{\alpha}) + \ln(\frac{1}{w_{\lambda^*}})}{(m+n)\sqrt{\lambda_1^* \cdots \lambda_d^*}} \right) \\
&\le C_7(M, d, s, R, \alpha, \beta)^2 \left( \frac{m+n}{\ln(\ln(m+n))} \right)^{-4s/(4s+d)}
\end{align*}
$$

where $C_7(M, d, s, R, \alpha, \beta) := \sqrt{C_6(M, d, s, R, \beta) \max\{d, 2^{\frac{d}{2}}(\ln(\frac{1}{\alpha}) + 5)\}}$. We conclude that

$$
\rho(\Delta_{\alpha}^{\Lambda^w, B_{1:3}}, \mathcal{S}_d^s(R), \beta, M) \le C_7(M, d, s, R, \alpha, \beta) \left( \frac{m+n}{\ln(\ln(m+n))} \right)^{-2s/(4s+d)}.
$$

Hence, the test $\Delta_{\alpha}^{\Lambda^w, B_{1:3}}$ is optimal in the minimax sense up to an iterated logarithmic term. Since it does not depend on the unknown parameters $s$ and $R$, our aggregated MMDAgg test $\Delta_{\alpha}^{\Lambda^w, B_{1:3}}$ is minimax adaptive over the Sobolev balls $\{S_d^s(R) : s > 0, R > 0\}$.
References

M. Albert, B. Laurent, A. Marrel, and A. Meynaoui. Adaptive test of independence based on HSIC measures. *The Annals of Statistics*, 50(2):858–879, 2022.

N. Aronszajn. Theory of reproducing kernels. *Transactions of the American Mathematical Society*, 68(3):337–404, 1950.

Y. Baraud. Non-asymptotic minimax rates of testing in signal detection. *Bernoulli*, 1 (8(5):577–606), 2002.

P. J. Bickel. A distribution free version of the Smirnov two sample test in the $p$-variate case. *The Annals of Mathematical Statistics*, 40(1):1–23, 1969.

C. Butucea. Goodness-of-fit testing and quadratic functional estimation from indirect observations. Long version with Appendix. *The Annals of Statistics*, 35(5), 2007.

P. L. Chebyshev. Oeuvres. *Commissionnaires de l'Académie Impériale des Sciences*, 1, 1899.

S. X. Chen and Y.-L. Qin. A two-sample test for high-dimensional data with applications to gene-set testing. *The Annals of Statistics*, 38(2):808–835, 2010.

K. Chwialkowski, H. Strathmann, and A. Gretton. A kernel test of goodness of fit. In *International Conference on Machine Learning*, pages 2606–2615. PMLR, 2016.

V. H. de la Peña and E. Giné. *Decoupling: From Dependence to Independence*. Springer Science & Business Media, 1999.

A. Dvoretzky, J. Kiefer, and J. Wolfowitz. Asymptotic minimax character of the sample distribution function and of the classical multinomial estimator. *The Annals of Mathematical Statistics*, pages 642–669, 1956.

N. Erickson, J. Mueller, A. Shirkov, H. Zhang, P. Larroy, M. Li, and A. Smola. Autogluon-tabular: Robust and accurate automl for structured data. *arXiv preprint arXiv:2003.06505*, 2020.

H. S. Fisher, B. B. Wong, and G. G. Rosenthal. Alteration of the chemical environment disrupts communication in a freshwater fish. *Proceedings of the Royal Society B: Biological Sciences*, 273(1591):1187–1193, 2006.

W. Fithian, D. Sun, and J. Taylor. Optimal inference after model selection. *arXiv preprint arXiv:1410.2597*, 2014.

M. Fromont, B. Laurent, M. Lerasle, and P. Reynaud-Bouret. Kernels based tests with non-asymptotic bootstrap approaches for two-sample problems. In *Conference on Learning Theory*, volume 23 of *Journal of Machine Learning Research Proceedings*, 2012.

M. Fromont, B. Laurent, and P. Reynaud-Bouret. The two-sample problem for Poisson processes: Adaptive tests with a nonasymptotic wild bootstrap approach. *The Annals of Statistics*, 41(3):1431–1461, 2013.
K. Fukumizu, A. Gretton, X. Sun, and B. Schölkopf. Kernel measures of conditional dependence. In *Advances in Neural Information Processing Systems*, volume 1, pages 489–496, 2008.

A. Gretton, O. Bousquet, A. Smola, and B. Schölkopf. Measuring statistical dependence with Hilbert-Schmidt norms. In *International Conference on Algorithmic Learning Theory*. Springer, 2005.

A. Gretton, K. Borgwardt, M. Rasch, B. Schölkopf, and A. Smola. A kernel method for the two-sample problem. In *Advances in Neural Information Processing Systems*, pages 513–520, Cambridge, MA, 2007. MIT Press.

A. Gretton, K. M. Borgwardt, M. J. Rasch, B. Schölkopf, and A. Smola. A kernel two-sample test. *Journal of Machine Learning Research*, 13:723–773, 2012a.

A. Gretton, D. Sejdinovic, H. Strathmann, S. Balakrishnan, M. Pontil, K. Fukumizu, and B. K. Sriperumbudur. Optimal kernel choice for large-scale two-sample tests. In *Advances in Neural Information Processing Systems*, volume 1, pages 1205–1213, 2012b.

W. Hoeffding. A class of statistics with asymptotically normal distribution. In *Breakthroughs in Statistics*, pages 308–334. Springer, 1992.

L. Horváth, P. Kokoszka, and R. Reeder. Estimation of the mean of functional time series and a two-sample problem. *Journal of the Royal Statistical Society: Series B (Statistical Methodology)*, 75(1):103–122, 2013.

Y. I. Ingster. Minimax testing of nonparametric hypotheses on a distribution density in the $L_p$ metrics. *Theory of Probability & its Applications*, 31(2):333–337, 1987.

Y. I. Ingster. Asymptotically minimax hypothesis testing for nonparametric alternatives. *Journal of Soviet Mathematics*, 1(44:466–476), 1993a.

Y. I. Ingster. Minimax testing of the hypothesis of independence for ellipsoids in $l_p$. *Zapiski Nauchnykh Seminarov POMI*, 1(207:77–97), 1993b.

W. Jitkrittum, Z. Szabó, K. P. Chwialkowski, and A. Gretton. Interpretable distribution features with maximum testing power. In *Advances in Neural Information Processing Systems*, volume 29, pages 181–189, 2016.

I. Kim, S. Balakrishnan, and L. Wasserman. Minimax optimality of permutation tests. *The Annals of Statistics*, 50(1):225 – 251, 2022.

A. Krizhevsky. Learning multiple layers of features from tiny images. 2009.

J. M. Kübler, W. Jitkrittum, B. Schölkopf, and K. Muandet. Learning kernel tests without data splitting. In *Advances in Neural Information Processing Systems 33*, pages 6245–6255. Curran Associates, Inc., 2020.

J. M. Kübler, W. Jitkrittum, B. Schölkopf, and K. Muandet. A witness two-sample test. In *International Conference on Artificial Intelligence and Statistics*, pages 1403–1419. PMLR, 2022a.
J. M. Kübler, V. Stimper, S. Buchholz, K. Muandet, and B. Schölkopf. AutoML two-sample test. In A. H. Oh, A. Agarwal, D. Belgrave, and K. Cho, editors, *Advances in Neural Information Processing Systems 35: Annual Conference on Neural Information Processing Systems 2022, NeurIPS 2022*, 2022b.

Y. LeCun, C. Cortes, and C. Burges. MNIST handwritten digit database. AT&T Labs, 2010. URL http://yann.lecun.com/exdb/mnist/.

J. Lee. *U-statistics: Theory and Practice*. Citeseer, 1990.

J. D. Lee, D. L. Sun, Y. Sun, and J. E. Taylor. Exact post-selection inference, with application to the lasso. *The Annals of Statistics*, 44(3):907–927, 2016.

T. Li and M. Yuan. On the optimality of gaussian kernel based nonparametric tests against smooth alternatives. *arXiv preprint arXiv:1909.03302*, 2019.

F. Liu, W. Xu, J. Lu, G. Zhang, A. Gretton, and D. J. Sutherland. Learning deep kernels for non-parametric two-sample tests. In *International Conference on Machine Learning*, 2020.

Q. Liu, J. Lee, and M. Jordan. A kernelized Stein discrepancy for goodness-of-fit tests. In *International Conference on Machine Learning*, pages 276–284. PMLR, 2016.

P. Massart. The tight constant in the Dvoretzky-Kiefer-Wolfowitz inequality. *The Annals of Probability*, 18(3):1269–1283, 1990.

F. J. Massey Jr. The Kolmogorov-Smirnov test for goodness of fit. *Journal of the American Statistical Association*, 46(253):68–78, 1951.

R. R. Miles, R. F. Roberts, A. R. Putnam, and W. L. Roberts. Comparison of serum and heparinized plasma samples for measurement of chemistry analytes. *Clinical Chemistry*, 50(9):1704–1706, 2004.

A. Müller. Integral probability metrics and their generating classes of functions. *Advances in Applied Probability*, 1:429–443, 1997.

S. Rabanser, S. Günnemann, and Z. Lipton. Failing loudly: An empirical study of methods for detecting dataset shift. *Advances in Neural Information Processing Systems*, 32, 2019.

A. Ramdas, S. J. Reddi, B. Póczos, A. Singh, and L. Wasserman. On the decreasing power of kernel and distance based nonparametric hypothesis tests in high dimensions. In *Proceedings of the AAAI Conference on Artificial Intelligence*, volume 29, 2015.

S. Reddi, A. Ramdas, B. Póczos, A. Singh, and L. Wasserman. On the high dimensional power of a linear-time two sample test under mean-shift alternatives. In *Artificial Intelligence and Statistics*, pages 772–780. PMLR, 2015.

J. P. Romano and M. Wolf. Exact and approximate stepdown methods for multiple hypothesis testing. *Journal of the American Statistical Association*, 100(469):94–108, 2005a.
J. P. Romano and M. Wolf. Stepwise multiple testing as formalized data snooping. *Econometrica*, 73(4):1237–1282, 2005b.

A. Schrab, B. Guedj, and A. Gretton. KSD aggregated goodness-of-fit test. In A. H. Oh, A. Agarwal, D. Belgrave, and K. Cho, editors, *Advances in Neural Information Processing Systems 35: Annual Conference on Neural Information Processing Systems 2022, NeurIPS 2022*, 2022a.

A. Schrab, I. Kim, B. Guedj, and A. Gretton. Efficient aggregated kernel tests using incomplete U-statistics. In A. H. Oh, A. Agarwal, D. Belgrave, and K. Cho, editors, *Advances in Neural Information Processing Systems 35: Annual Conference on Neural Information Processing Systems 2022, NeurIPS 2022*, 2022b.

R. J. Serfling. *Approximation theorems of mathematical statistics*. John Wiley & Sons, 1980.

B. K. Sriperumbudur, K. Fukumizu, and G. R. Lanckriet. Universality, characteristic kernels and RKHS embedding of measures. *Journal of Machine Learning Research*, 12(7), 2011.

Student. The probable error of a mean. *Biometrika*, 1(1):1–25, 1908.

D. J. Sutherland, H.-Y. Tung, H. Strathmann, S. De, A. Ramdas, A. Smola, and A. Gretton. Generative models and model criticism via optimized maximum mean discrepancy. In *International Conference on Learning Representations*, 2017.

I. Tolstikhin, B. a. K. Sriperumbudur, and B. Schölkopf. Minimax estimation of maximum mean discrepancy with radial kernels. *Advances in Neural Information Processing Systems*, 29, 2016.

P. Vermeesch. Multi-sample comparison of detrital age distributions. *Chemical Geology*, 341:140–146, 2013.

G. Wynne and A. B. Duncan. A kernel two-sample test for functional data. *Journal of Machine Learning Research*, 23(73):1–51, 2022.

G. Wynne and S. Nagy. Statistical depth meets machine learning: Kernel mean embeddings and depth in functional data analysis. *arXiv preprint arXiv:2105.12778*, 2021.

M. Yamada, D. Wu, Y. H. Tsai, H. Ohta, R. Salakhutdinov, I. Takeuchi, and K. Fukumizu. Post selection inference with incomplete maximum mean discrepancy estimator. In *7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019*, 2019.