# Testing High-dimensional Multinomials with Applications to Text Analysis

T. Tony Cai111University of Pennsylvania , Zheng Tracy Ke222Harvard University
, and Paxton Turner††footnotemark:

###### Abstract

Motivated by applications in text mining and discrete distribution inference,
we investigate the testing for equality of probability mass functions of $K$
groups of high-dimensional multinomial distributions. A test statistic, which
is shown to have an asymptotic standard normal distribution under the null, is
proposed. The optimal detection boundary is established, and the proposed test
is shown to achieve this optimal detection boundary across the entire
parameter space of interest. The proposed method is demonstrated in simulation
studies and applied to analyze two real-world datasets to examine variation
among consumer reviews of Amazon movies and diversity of statistical paper
abstracts.

> Keywords: authorship attribution, closeness testing, consumer reviews,
> martingale central limit theorem, minimax optimality, topic model

##  1 Introduction

Statistical inference for multinomial data has garnered considerable recent
interest (Diakonikolas and Kane, 2016; Balakrishnan and Wasserman, 2018). One
important application is in text mining, as it is common to model the word
counts in a text document by a multinomial distribution (Blei et al., 2003).
We consider a specific example in marketing, where the study of online
customer ratings and reviews has become a trending topic (Chevalier and
Mayzlin, 2006; Zhu and Zhang, 2010; Leung and Yang, 2020). Customer reviews
are a good proxy to the overall word of mouth (WOM) and can significantly
influence customers’ decisions (Zhu and Zhang, 2010). Many research works aim
to understand the patterns in online reviews and their impacts on sales.
Classical studies only use the numerical ratings but ignore the rich text
reviews because of their unstructured nature. More recent works have revealed
the importance of analyzing text reviews (Chevalier and Mayzlin, 2006),
especially for hedonic products such as books, movies, and hotels. A question
of great interest is to detect the heterogeneity in reviewers’ response
styles. For example, Leung and Yang (2020) discovered that younger travelers,
women, and travelers with less review expertise tend to give more positive
reviews and that guests staying in high-class hotels tend to have more extreme
response styles than those staying in low-class hotels. Knowing such
differences will offer valuable insights for hotel managers and online
rating/review sites.

The aforementioned heterogeneity detection can be cast as a hypothesis test on
multinomial data. Suppose reviews are written on a vocabulary of $p$ distinct
words. Let $X_{i}\in\mathbb{R}^{p}$ denote the word counts in review $i$. We
model that

$X_{i}\sim\mathrm{Multinomial}(N_{i},\Omega_{i}),\qquad 1\leq i\leq n,$ (1.1)

where $N_{i}$ is the total length of review $i$ and
$\Omega_{i}\in\mathbb{R}^{p}$ is a probability mass function (PMF) containing
the population word frequencies. These reviews are divided into $K$ groups by
reviewer characteristics (e.g., age, gender, new/returning customer), product
characteristics (e.g., high-class versus low-class hotels), and numeric
ratings (e.g., from 1 star to 5 stars), where $K$ can be presumably large. We
view $\Omega_{i}$ as representing the ‘true response’ of review $i$. The
“average response” of a group $k$ is defined by a weighted average of the
PMFs:

$\mu_{k}=(n_{k}\bar{N}_{k})^{-1}\sum_{i\in S_{k}}N_{i}\Omega_{i},\qquad 1\leq
k\leq K.$ (1.2)

Here $S_{k}\subset\\{1,2,\ldots,n\\}$ is the index set of group $k$,
$n_{k}=|S_{k}|$ is the total number of reviews in group $k$, and
$\bar{N}_{k}=n_{k}^{-1}\sum_{i\in S_{k}}N_{i}$ is the average length of
reviews in group $k$. We would like to test

$H_{0}:\quad\mu_{1}=\mu_{2}=\ldots=\mu_{K}.$ (1.3)

When the null hypothesis is rejected, it means there exist statistically
significant differences among the group-wise “average responses”.

We call (1.1)-(1.3) the “$K$-sample testing for equality of average PMFs in
multinomials” or “$K$-sample testing for multinomials” for short.
Interestingly, as $K$ varies, this problem includes several well-defined
problems in text mining and discrete distribution inference as special cases.

  1. 1.

Global testing for topic models. Topic modeling (Blei et al., 2003) is a
popular text mining tool. In a topic model, each $\Omega_{i}$ in (1.1) is a
convex combination of $M$ topic vectors. Before fitting a topic model to a
corpus, it is often desirable to determine if the corpus indeed contains
multiple topics. This boils down to the global testing problem, which tests
$M=1$ versus $M>1$. Under the null hypothesis, $\Omega_{i}$’s are equal to
each other, and in the alternative hypothesis, $\Omega_{i}$’s can take
continuous values in a high-dimensional simplex. This is a special case of our
problem with $K=n$ and $n_{k}=1$.

  2. 2.

Authorship attribution (Mosteller and Wallace, 1963; Kipnis, 2022). In these
applications, the goal is to determine the unknown authorship of an article
from other articles with known authors. A famous example (Mosteller and
Wallace, 2012) is to determine the actual authors of a few Federalist Papers
written by three authors but published under a single pseudonym. It can be
formulated (Mosteller and Wallace, 1963; Kipnis, 2022) as testing the equality
of population word frequencies between the article of interest and the corpus
from a known author, a special case of our problem with $K=2$.

  3. 3.

Closeness between discrete distributions (Chan et al., 2014; Bhattacharya and
Valiant, 2015; Balakrishnan and Wasserman, 2019). There has been a surge of
interest in discrete distribution inference. Closeness testing is one of most
studied problems. The data from two discrete distributions are summarized in
two multinomial vectors $\mathrm{Multinomial}(N_{1},\mu)$ and
$\mathrm{Multinomial}(N_{2},\theta)$. The goal is to test $\mu=\theta$. It is
a special case of our testing problem with $K=2$ and $n_{1}=n_{2}=1$.

In this paper, we provide a unified solution to all the aforementioned
problems. The key to our methodology is a flexible statistic called DELVE (DE-
biased and Length-assisted Variability Estimator). It provides a general
similarity measure for comparing groups of discrete distributions such as
count vectors associated with text corpora. Similarity measures (such as the
classical cosine similarity, log-likelihood ratio statistic, and others) are
fundamental in text mining and have been applied to problems in distribution
testing (Kim et al., 2022), computational linguistics (Gomaa et al., 2013),
econometrics (Hansen et al., 2018), and computational biology (Kolodziejczyk
et al., 2015). Our method is a new and flexible similarity measure that is
potentially useful in these areas.

We emphasize that our setting does not require that the $X_{i}$’s in the same
group are drawn from the same distribution. Under the null hypothesis (1.3),
the group-wise means are equal, but the $\Omega_{i}$’s within each group can
still be different from each other. As a result, the null hypothesis is
composite and designing a proper test statistic is non-trivial.

###  1.1 Our results and contributions

The dimensionality of the testing problem is captured by $(n,p,K)$ and
$\bar{N}:=n^{-1}\sum_{i=1}^{n}N_{i}$. We are interested in a high-dimensional
setting where

$n\bar{N}\to\infty,\quad p\to\infty,\quad\mbox{and}\quad
n^{2}\bar{N}^{2}/(Kp)\to\infty.$ (1.4)

In most places of this paper, we use a subscript $n$ to indicate asymptotics,
but our method and theory do apply to the case where $n$ is finite and
$\bar{N}\to\infty$. In text applications, $n\bar{N}$ is the total count of
words in the corpus, and a large $n\bar{N}$ means either there are
sufficiently many documents, or the documents are sufficiently long. Given
that $n\bar{N}\to\infty$, we further allow $(p,K)$ to grow with $n$ at a speed
such that $Kp\ll n^{2}\bar{N}^{2}$. In particular, our settings allow $K$ to
range from $2$ to $n$, so as to cover all the application examples.

We propose a test that enjoys the following properties:

  1. (a)

Parameter-free null distribution: We show that the test statistic $\psi\to
N(0,1)$ under $H_{0}$. Even under the null hypothesis (1.3), the model
contains a large number of free parameters because the null hypothesis is only
about the equality of “average” PMFs but still allows $(N_{i},\Omega_{i})$ to
differ within each group. As an appealing property, the null distribution of
$\psi$ does not depend on these individual multinomial parameters; hence, we
can always conveniently obtain the asymptotic $p$-value for our proposed test.

  2. (b)

Minimax optimal detection boundary: We define a quantity
$\omega_{n}:=\omega_{n}(\mu_{1},\mu_{2},\ldots,\mu_{K})$ in (3.5) that
measures the difference among the $K$ group-wise mean PMF’s. It satisfies that
$\omega_{n}=0$ if and only if the null hypothesis holds, and it has been
properly normalized so that $\omega_{n}$ is bounded under the alternative
hypothesis (provided some mild regularity conditions hold). We show that the
proposed test has an asymptotic full power if
$\omega_{n}^{4}n^{2}{\bar{N}}^{2}/(Kp)\to\infty.$ We also provide a matching
lower bound by showing that the null hypothesis and the alternative hypothesis
are asymptotically indistinguishable if
$\omega_{n}^{4}n^{2}\bar{N}^{2}/(Kp)\to 0.$ Therefore, the proposed test is
minimax optimal. Furthermore, in the boundary case where
$\omega_{n}^{4}n^{2}\bar{N}^{2}/(Kp)\to c_{0}$ for a constant $c_{0}>0$, for
some special settings, we show that $\psi\to N(0,1)$ under $H_{0}$, and
$\psi\to N(c_{1},1)$, under $H_{1}$, with the constant $c_{1}$ being an
explicit function of $c_{0}$.

To the best of our knowledge, this testing problem for a general $K$ has not
been studied before. The existing works primarily focused on closeness testing
and authorship attribution (see Section 1.2), which are special cases with
$K=2$. In comparison, our test is applicable to any value of $K$, offering a
unified solution to multiple applications. Even for $K=2$, the existing works
do not provide a test statistic that has a tractable null distribution. They
determined the rejection region and calculated $p$-values using either a
(conservative) large-deviation bound or a permutation procedure. Our test is
the first one equipped with a tractable null distribution. Our results about
the optimal detection boundary for a general $K$ are also new to the
literature. By varying $K$ in our theory, we obtain the optimal detection
boundary for different sub-problems. For some of them (e.g., global testing
for topic models, authorship attribution with moderate sparsity), the optimal
detection boundary was not known before; hence, our results help advance the
understanding of the statistical limits of these problems.

###  1.2 Related literature

First, we make a connection to discrete distribution inference. Let
$X\sim\mathrm{Multinomial}(N,\Omega)$ represent a size-$N$ sample from a
discrete distribution with $p$ categories. The one-sample closeness testing
aims to test $H_{0}:\Omega=\mu$, for a given PMF $\mu$. Existing works focus
on finding the minimum separation condition in terms of the $\ell^{1}$-norm or
$\ell^{2}$-norm of $\Omega-\mu$. Balakrishnan and Wasserman (2019) derived the
minimum $\ell^{1}$-separation condition and proposed a truncated chi-square
test to achieve it. Valiant and Valiant (2017) studied the “local critical
radius”, a local separation condition that depends on the “effective sparsity”
of $\mu$, and they proposed a “2/3rd + tail” test to achieve it. In the two-
sample closeness testing problem, given
$X_{1}\sim\mathrm{Multinomial}(N_{1},\Omega_{1})$ and
$X_{2}\sim\mathrm{Multinomial}(N_{2},\Omega_{2})$, it aims to test
$H_{0}:\Omega_{1}=\Omega_{2}$. Again, this literature focuses on finding the
minimum separation condition in terms of the $\ell^{1}$-norm or
$\ell^{2}$-norm of $\Omega_{1}-\Omega_{2}$. When $N_{1}=N_{2}$, Chan et al.
(2014) derived the minimum $\ell^{1}$-separation condition and proposed a
weighted chi-square test to attain it. Bhattacharya and Valiant (2015)
extended their results to the unbalanced case where $N_{1}\neq N_{2}$,
assuming $\|\Omega_{1}-\Omega_{2}\|_{1}\geq p^{-1/12}$. This assumption was
later removed by Diakonikolas and Kane (2016), who established the minimum
$\ell^{1}$-separation condition in full generality. Kim et al. (2022) proposed
a two-sample kernel $U$-statistic and showed that it attains the minimum
$\ell^{2}$-separation condition.

Since the two-sample closeness testing is a special case of our problem with
$K=2$ and $n_{1}=n_{2}=1$, our test is directly applicable. An appealing
property of our test is its tractable asymptotic null distribution of
$N(0,1)$. In contrast, for the chi-square statistic in Chan et al. (2014) or
the $U$-statistic in (Kim et al., 2022), the rejection region is determined by
either an upper bound from concentration inequalities or a permutation
procedure, which may lead to a conservative threshold or need additional
computational costs. Regarding the testing power, we show in Section 4.3 that
our test achieves the minimum $\ell^{2}$-separation condition, i.e., our
method is an optimal “$\ell^{2}$ testor.” Our test can also be turned into an
optimal “$\ell^{1}$ testor” (a test that achieves the minimum
$\ell^{1}$-separation condition) by re-weighting terms in the test statistic
(see Section 4.3).

Next, we make a connection to text mining. In this literature, a multinomial
vector $X\sim\mathrm{Multinomial}(N,\Omega)$ represents the word counts for a
document of length $N$ written with a dictionary containing $p$ words. In a
topic model, each $\Omega_{i}$ is a convex combination of $M$ “topic vectors”:
$\Omega_{i}=\sum_{k=1}^{M}w_{i}(k)A_{k}$, where each $A_{k}\in\mathbb{R}^{p}$
is a PMF and the combination coefficient vector $w_{i}\in\mathbb{R}^{K}$ is
called the “topic weight” vector for document $i$. Given a collection of
documents $X_{1},X_{2},\ldots,X_{n}$, the global testing problem aims to test
$M=1$ versus $M>1$. Interestingly, the optimal detection boundary for this
problem has never been rigorously studied. As we have explained, this problem
a special case of our testing problem with $K=n$. Our results (a) provide a
test statistic that has a tractable null distribution and (b) reveal that the
optimal detection boundary is
$\omega^{2}_{n}\asymp(\sqrt{n}\bar{N})^{-1}\sqrt{p}$. Both (a) and (b) are new
results. When comparing our results with those about estimation of $A_{k}$’s
(Ke and Wang, 2022), it suggests that global testing requires a strictly lower
signal strength than topic estimation.

For authorship attribution, Kipnis (2022) treats the corpus from a known
author as a single document and tests the null hypothesis that this combined
document and a new document have the same population word frequencies. It is a
two-sample closeness testing problem, except that sparsity is imposed on the
difference of two PMFs. Kipnis (2022) proposed a test which applies an “exact
binomial test” to obtain a $p$-value for each word and combines these
$p$-values using Higher Criticism (Donoho and Jin, 2004). Donoho and Kipnis
(2022) analyzed this test when the number of “useful words” is $o(\sqrt{p})$,
and they derived a sharp phase diagram (a related one-sample setting was
studied in Arias-Castro and Wang (2015)). In Section 4.2, we show that our
test is applicable to this problem and has some nice properties: (a) tractable
null distribution; (b) allows for $s\geq c\sqrt{p}$, where $s$ is the number
of useful words; and (c) does not require documents from the known author to
have identical population word frequencies, making the setting more realistic.
On the other hand, when $s=o(\sqrt{p})$, our test is less powerful than the
one in Kipnis (2022); Donoho and Kipnis (2022), as our test does not utilize
sparsity explicitly. We can further improve our test in this regime by
modifying the DELVE statistic to incorporate sparsity (see the remark in
Section 4.2).

###  1.3 Organization

The rest of this paper is arranged as follows. In Section 2, we introduce the
test statistic and explain the rationale behind it. We then present in Section
3 the main theoretical results, including the asymptotic null distribution,
power analysis, a matching lower bound, the study of two special cases ($K=n$
and $K=2$), and a discussion of the contiguity regime. Section 4 applies our
results to text mining and discrete distribution testing. Simulations are in
Section 5 and real data analysis is in Section 6. The paper is concluded with
a discussion in Section 7. All proofs are in the appendix.

##  2 The DELVE Test

Recall that $X_{i}\sim\mathrm{Multinomial}(N_{i},\Omega_{i})$ for $1\leq i\leq
n$. There is a known partition $\\{1,2,\ldots,n\\}=\cup_{k=1}^{K}S_{k}$. Write
$n_{k}=|S_{k}|$, $\bar{N}_{k}=n_{k}^{-1}\sum_{i\in S_{k}}N_{i}$, and
$\bar{N}=n^{-1}\sum_{i=1}^{n}N_{i}$. In (1.2), we have defined the group-wise
mean PMF $\mu_{k}=(n_{k}\bar{N}_{k})^{-1}\sum_{i\in S_{k}}N_{i}\Omega_{i}$. We
further define the overall mean PMF $\mu\in\mathbb{R}^{p}$ by

$\mu:=\frac{1}{n\bar{N}}\sum_{k=1}^{K}n_{k}\bar{N}_{k}\mu_{k}=\frac{1}{n\bar{N}}\sum_{i=1}^{n}N_{i}\Omega_{i}.$
(2.1)

We introduce a quantity $\rho^{2}=\rho^{2}(\mu_{1},\ldots,\mu_{K})$ by

$\rho^{2}:=\sum_{k=1}^{K}n_{k}\bar{N}_{k}\|\mu_{k}-\mu\|^{2}.$ (2.2)

This quantity measures the variations across $K$ group-wise mean PMFs. It is
true that the null hypothesis (1.3) holds if and only if $\rho^{2}=0$.
Inspired by this observation, we hope to construct an unbiased estimator of
$\rho^{2}$ and develop it to a test statistic.

We can easily obtain the minimum variance unbiased estimators of $\mu_{k}$ and
$\mu$:

$\hat{\mu}_{k}=\frac{1}{n_{k}\bar{N}_{k}}\sum_{i\in
S_{k}}X_{i},\qquad\mbox{and}\qquad\hat{\mu}=\frac{1}{n\bar{N}}\sum_{k=1}^{K}n_{k}\bar{N}_{k}\hat{\mu}_{k}=\frac{1}{n\bar{N}}\sum_{i=1}^{n}X_{i}.$
(2.3)

For each $1\leq j\leq p$, let $\mu_{kj}$, $\mu_{j}$, $\hat{\mu}_{kj}$ and
$\hat{\mu}_{j}$ represent the $j$th entry of $\mu_{k}$, $\mu$, $\hat{\mu}_{k}$
and $\hat{\mu}$, respectively. A naive estimator of $\rho^{2}$ is

$\widetilde{T}=\sum_{j=1}^{p}\widetilde{T}_{j},\qquad\mbox{where}\quad\widetilde{T}_{j}=\sum_{k=1}^{K}n_{k}\bar{N}_{k}(\hat{\mu}_{kj}-\hat{\mu}_{j})^{2}.$
(2.4)

This estimator is biased. In Section C.1 of the appendix , we show that
$\mathbb{E}[\widetilde{T}_{j}]=\sum_{k=1}^{K}\bigl{[}n_{k}\bar{N}_{k}(\mu_{kj}-\mu_{j})^{2}+\bigl{(}\frac{1}{n_{k}\bar{N}_{k}}-\frac{1}{n\bar{N}}\bigr{)}\sum_{i\in
S_{k}}N_{i}\Omega_{ij}(1-\Omega_{ij})\bigr{]}.$ It motivates us to debias
$\widetilde{T}_{j}$ by using an unbiased estimate of
$\Omega_{ij}(1-\Omega_{ij})$. By elementary properties of the multinomial
distribution,
$\mathbb{E}[X_{ij}(N_{i}-X_{ij})]=N_{i}(N_{i}-1)\Omega_{ij}(1-\Omega_{ij})$.
We thereby use $\frac{1}{N_{i}(N_{i}-1)}X_{ij}(N_{i}-X_{ij})$ to estimate
$\Omega_{ij}(1-\Omega_{ij})$. This gives rise to an unbiased estimator of
$\rho^{2}$ as

$T=\sum_{j=1}^{p}T_{j},\quad
T_{j}=\sum_{k=1}^{K}\biggl{[}n_{k}\bar{N}_{k}(\hat{\mu}_{kj}-\hat{\mu}_{j})^{2}-\Bigl{(}\frac{1}{n_{k}\bar{N}_{k}}-\frac{1}{n\bar{N}}\Bigr{)}\sum_{i\in
S_{k}}\frac{X_{ij}(N_{i}-X_{ij})}{N_{i}-1}\biggr{]}.$ (2.5)

######  Lemma 2.1.

Under Models (1.1)-(1.2), the estimator in (2.5) satisfies that
$\mathbb{E}[T]=\rho^{2}$.

To use $T$ for hypothesis testing, we need a proper standardization of this
statistic. In Sections A.1-A.2 of the appendix , we study $\mathbb{V}(T)$, the
variance of $T$. Under mild regularity conditions, it can be shown that
$\mathbb{V}(T)=\Theta_{n}\cdot[1+o(1)]$, where

$\displaystyle\Theta_{n}:=4\sum_{k=1}^{K}\sum_{j=1}^{p}n_{k}\bar{N}_{k}(\mu_{kj}-\mu_{j})^{2}\mu_{kj}+2\sum_{k=1}^{K}\sum_{i\in
S_{k}}\sum_{j=1}^{p}\Bigl{(}\frac{1}{n_{k}\bar{N}_{k}}-\frac{1}{n\bar{N}}\Bigr{)}^{2}\frac{N_{i}^{3}}{N_{i}-1}\Omega_{ij}^{2}$
(2.6) $\displaystyle+\frac{2}{n^{2}\bar{N}^{2}}\sum_{1\leq k\neq\ell\leq
K}\sum_{i\in S_{k}}\sum_{m\in
S_{\ell}}\sum_{j=1}^{p}N_{i}N_{m}\Omega_{ij}\Omega_{mj}+2\sum_{k=1}^{K}\sum_{\begin{subarray}{c}i\in
S_{k},m\in S_{k},\\\ i\neq
m\end{subarray}}\sum_{j=1}^{p}\Bigl{(}\frac{1}{n_{k}\bar{N}_{k}}-\frac{1}{n\bar{N}}\Bigr{)}^{2}N_{i}N_{m}\Omega_{ij}\Omega_{mj}.$

In $\Theta_{n}$, the first term vanishes under the null, so it suffices to
estimate the other three terms in $\Theta_{n}$. By properties of multinomial
distributions, $\mathbb{E}[X_{ij}X_{mj}]=N_{i}N_{m}\Omega_{ij}\Omega_{mj}$,
$\mathbb{E}[X^{2}_{ij}]=N_{i}^{2}\Omega_{ij}^{2}+N_{i}\Omega_{ij}(1-\Omega_{ij})$,
and
$\mathbb{E}[X_{ij}(N_{i}-X_{ij})]=N_{i}(N_{i}-1)\Omega_{ij}(1-\Omega_{ij})$.
It inspires us to estimate $\Omega_{ij}\Omega_{mj}$ by
$\frac{X_{ij}X_{mj}}{N_{i}N_{m}}$ and estimate $\Omega_{ij}^{2}$ by
$\frac{X_{ij}^{2}}{N_{i}^{2}}-\frac{X_{ij}(N_{i}-X_{ij})}{N^{2}_{i}(N_{i}-1)}=\frac{X_{ij}^{2}-X_{ij}}{N_{i}(N_{i}-1)}$.
Define

$\displaystyle V=2\sum_{k=1}^{K}\sum_{i\in
S_{k}}\sum_{j=1}^{p}\Bigl{(}\frac{1}{n_{k}\bar{N}_{k}}-\frac{1}{n\bar{N}}\Bigr{)}^{2}\frac{X_{ij}^{2}-X_{ij}}{N_{i}(N_{i}-1)}+\frac{2}{n^{2}\bar{N}^{2}}\sum_{k\neq\ell}\sum_{i\in
S_{k}}\sum_{m\in S_{\ell}}\sum_{j=1}^{p}X_{ij}X_{mj}$ (2.7)
$\displaystyle\qquad+2\sum_{k=1}^{K}\sum_{\begin{subarray}{c}i\in S_{k},m\in
S_{k},\\\ i\neq
m\end{subarray}}\sum_{j=1}^{p}\Bigl{(}\frac{1}{n_{k}\bar{N}_{k}}-\frac{1}{n\bar{N}}\Bigr{)}^{2}X_{ij}X_{mj}.$
(2.8)

The test statistic we propose is as follows (in the rate event $V<0$, we
simply set $\psi=0$):

$\psi=T/\sqrt{V}.$ (2.9)

We call $\psi$ the DEbiased and Length-adjusted Variability Estimator (DELVE).
In Section 3.1, we show that under mild regularity conditions, $\psi\to
N(0,1)$ under the null hypothesis. For any fixed $\alpha\in(0,1)$, the
asymptotic level-$\alpha$ DELVE test rejects $H_{0}$ if

$\psi>z_{\alpha},\qquad\mbox{where $z_{\alpha}$ is the $(1-\alpha)$-quantile
of $N(0,1)$}.$ (2.10)

###  2.1 The special cases of $K=n$ and $K=2$

As seen in Section 1, the application examples of $K=n$ and $K=2$ are
particularly intriguing. In these cases, we give more explicit expressions of
our test statistic.

When $K=n$, we have $S_{k}=\\{i\\}$ and $\hat{\mu}_{kj}=N_{i}^{-1}X_{ij}$. The
null hypothesis becomes $H_{0}:\Omega_{1}=\Omega_{2}=\ldots=\Omega_{n}.$ The
statistic in (2.5) reduces to

$T=\sum_{j=1}^{p}\sum_{i=1}^{n}\biggl{[}\frac{(X_{ij}-N_{i}\hat{\mu}_{j})^{2}}{N_{i}}-\Bigl{(}1-\frac{N_{i}}{n\bar{N}}\Bigr{)}\frac{X_{ij}(N_{i}-X_{ij})}{N_{i}(N_{i}-1)}\biggr{]}.$
(2.11)

Moreover, in the variance estimate (2.7), the last term is exactly zero, and
it can be shown that the third term is negligible compared to the first term.
We thereby consider a simpler variance estimator by only retaining the first
term in (2.7):

$V^{*}=2\sum_{i=1}^{n}\sum_{j=1}^{p}\Bigl{(}\frac{1}{N_{i}}-\frac{1}{n\bar{N}}\Bigr{)}^{2}\frac{X_{ij}^{2}-X_{ij}}{N_{i}(N_{i}-1)}.$
(2.12)

The simplified DELVE test statistic is $\psi^{*}=T/\sqrt{V^{*}}$.

When $K=2$, we observe two collections of multinomial vectors, denoted by
$\\{X_{i}\\}_{1\leq i\leq n}$ and $\\{G_{i}\\}_{1\leq i\leq m}$. We assume for
$1\leq i\leq n$ and $1\leq j\leq m$,

$X_{i}\sim\mathrm{Multinomial}(N_{i},\Omega_{i}),\qquad
G_{j}\sim\mathrm{Multinomial}(M_{j},\Gamma_{j}).$ (2.13)

Write $\bar{N}=n^{-1}\sum_{i=1}^{n}N_{i}$ and
$\bar{M}=m^{-1}\sum_{i=1}^{m}M_{i}$. The null hypothesis becomes

$H_{0}:\quad\eta=\theta,\qquad\mbox{where
}\eta=\frac{1}{n\bar{N}}\sum_{i=1}^{n}N_{i}\Omega_{i},\mbox{ and
}\theta=\frac{1}{m\bar{M}}\sum_{i=1}^{m}M_{i}\Gamma_{i},$ (2.14)

where $\theta$ and $\eta$ are the two group-wise mean PMFs. We estimate them
by $\hat{\eta}=(n\bar{N})^{-1}\sum_{i=1}^{n}X_{i}$ and
$\hat{\theta}=(m\bar{M})^{-1}\sum_{i=1}^{m}G_{i}$. The statistic in (2.5) has
an equivalent form as follows:

$T=\frac{n\bar{N}m\bar{M}}{n\bar{N}+m\bar{M}}\biggl{[}\|\hat{\eta}-\hat{\theta}\|^{2}-\sum_{i=1}^{n}\sum_{j=1}^{p}\frac{X_{ij}(N_{i}-X_{ij})}{n^{2}\bar{N}^{2}(N_{i}-1)}-\sum_{i=1}^{m}\sum_{j=1}^{p}\frac{G_{ij}(M_{i}-G_{ij})}{m^{2}\bar{M}^{2}(M_{i}-1)}\biggr{]}.$
(2.15)

The variance estimate (2.7) has an equivalent form as follows:

$\displaystyle
V=\frac{4\sum_{i=1}^{n}\sum_{i^{\prime}=1}^{m}\sum_{j=1}^{p}X_{ij}G_{i^{\prime}j}}{(n\bar{N}+m\bar{M})^{2}}+\frac{2m^{2}\bar{M}^{2}\big{[}\sum_{i=1}^{n}\frac{X_{ij}^{2}-X_{ij}}{N_{i}(N_{i}-1)}+\sum_{1\leq
i\neq i^{\prime}\leq
n}X_{ij}X_{i^{\prime}j}\big{]}}{n^{2}\bar{N}^{2}(n\bar{N}+m\bar{M})^{2}}$
(2.16)
$\displaystyle\quad+\frac{2n^{2}\bar{N}^{2}\big{[}\sum_{i=1}^{m}\frac{G_{ij}^{2}-G_{ij}}{M_{i}(M_{i}-1)}+\sum_{1\leq
i\neq i^{\prime}\leq
m}G_{ij}G_{i^{\prime}j}\big{]}}{m^{2}\bar{M}^{2}(n\bar{N}+m\bar{M})^{2}}.$
(2.17)

The DELVE test statistic is $\psi=T/\sqrt{V}$.

###  2.2 A variant: DELVE+

We introduce a variant of the DELVE test statistic to better suit real data.
Let $\hat{\mu}$, $T$ and $V$ be as in (2.3), (2.5) and (2.7). Define

$\psi^{+}=T/\sqrt{V^{+}},\qquad\mbox{where}\quad
V^{+}=V\cdot\bigl{(}1+\|\hat{\mu}\|_{2}T/\sqrt{V}\bigr{)}.$ (2.18)

We call (2.18) the DELVE+ test statistic. In theory, this modification has
little effect on the key properties of the test. To see this, we note that
$\|\hat{\mu}\|_{2}=o_{\mathbb{P}}(1)$ in high-dimensional settings. Suppose
$T/\sqrt{V}\to N(0,1)$ under $H_{0}$. Since $\|\hat{\mu}\|_{2}\to 0$, it is
seen immediately that $V^{+}/V\to 1$; hence, the asymptotic normality also
holds for $\psi^{+}$. Suppose $T/\sqrt{V}\to\infty$ under the alternative
hypothesis. It follows that $V^{+}\leq 2\max\\{V,\|\hat{\mu}\|_{2}\cdot
T\sqrt{V}\\}$ and
$\psi^{+}\geq\frac{1}{\sqrt{2}}\min\\{T/\sqrt{V},\,\|\hat{\mu}\|_{2}^{-1}(T/\sqrt{V})^{1/2}\\}\to\infty$.
We have proved the following lemma:

######  Lemma 2.2.

As $n\bar{N}\to\infty$, suppose $\|\hat{\mu}\|_{2}\to 0$ in probability. Under
$H_{0}$, if $T/\sqrt{V}\to N(0,1)$, then $T/\sqrt{V^{+}}\to N(0,1)$. Under
$H_{1}$, if $T/\sqrt{V}\to\infty$, then $T/\sqrt{V^{+}}\to\infty$.

In practice, this modification avoids extremely small $p$-values. In some real
datasets, $V$ is very small and leads to an extremely small $p$-value in the
original DELVE test. In DELVE+, as long as $T$ is positive, $\psi^{+}$ is
smaller than $\psi$, so that the $p$-value is adjusted.

In the numerical experiments, we consider both DELVE and DELVE+. For
theoretical analysis, since these two versions have almost identical
theoretical properties, we only focus on the original DELVE test statistic.

##  3 Theoretical Properties

We first present the regularity conditions. For a constant $c_{0}\in(0,1)$, we
assume

$\min_{1\leq i\leq n}N_{i}\geq 2,\qquad\max_{1\leq i\leq
n}\|\Omega_{i}\|_{\infty}\leq 1-c_{0},\qquad\max_{1\leq k\leq
K}\frac{n_{k}\bar{N}_{k}}{n\bar{N}}\leq 1-c_{0}.$ (3.1)

In (3.1), the first condition is mild. The second condition is also mild: note
that $\|\Omega_{i}\|_{1}=1$ for each $i$; this condition excludes those cases
where one of the $p$ categories has an extremely dominating probability in the
PMF $\Omega_{i}$. In the third condition, $n_{k}\bar{N}_{k}$ is the total
number of counts in all multinomials of group $k$, and this condition excludes
the extremely unbalanced case where one group occupies the majority of counts.
Note that in the special case of $K=2$, we relax this condition to allow for
severely unbalanced groups (see Section 3.4).

Recall that $\mu_{k}=\frac{1}{n_{k}\bar{N}_{k}}\sum_{i\in
S_{k}}N_{i}\Omega_{i}$ is the mean PMF within group $k$. We also define a
‘covariance’ matrix of PMF’s for group $k$ by
$\Sigma_{k}=\frac{1}{n_{k}\bar{N}_{k}}\sum_{i\in
S_{k}}N_{i}\Omega_{i}\Omega_{i}^{\prime}$. Let

$\alpha_{n}:=\max\left\\{\sum_{k=1}^{K}\frac{\|\mu_{k}\|_{3}^{3}}{n_{k}\bar{N}_{k}},\quad\sum_{k=1}^{K}\frac{\|\mu_{k}\|^{2}}{n_{k}^{2}\bar{N}_{k}^{2}}\right\\}\bigg{/}\bigg{(}\sum_{k=1}^{K}\|\mu_{k}\|^{2}\bigg{)}^{2},$
(3.2)

and

$\beta_{n}:=\max\biggl{\\{}\sum_{k=1}^{K}\sum_{i\in
S_{k}}\frac{N^{2}_{i}}{n_{k}^{2}\bar{N}_{k}^{2}}\|\Omega_{i}\|_{3}^{3},\quad\sum_{k=1}^{K}\|\Sigma_{k}\|_{F}^{2}\bigg{\\}}\bigg{/}(K\|\mu\|^{2}).$
(3.3)

We assume that as $n\bar{N}\to\infty$,

$\alpha_{n}=o(1),\qquad\beta_{n}=o(1),\qquad\mbox{and}\quad\frac{\|\mu\|_{4}^{4}}{K\|\mu\|^{4}}=o(1).$
(3.4)

Here $\alpha_{n}$ and $\beta_{n}$ only depend on group-wise quantities, such
as $\mu_{k}$, $\Sigma_{k}$ and $\sum_{i\in
S_{k}}N^{2}_{i}\|\Omega_{i}\|_{3}^{3}$; hence, a small number of ‘outliers’
(i.e., extremely large entries) in $\Omega$ has little effect on $\alpha_{n}$
and $\beta_{n}$. Furthermore, in a simple case where $\max_{k}n_{k}\leq
C\min_{k}n_{k}$, $\max_{k}\bar{N}_{k}\leq C\min_{k}\bar{N}_{k}$ and
$\|\Omega\|_{\max}=O(1/p)$, it holds that
$\alpha_{n}=O(\max\\{\frac{1}{n\bar{N}},\frac{Kp}{n^{2}\bar{N}^{2}}\\})$,
$\beta_{n}=O(\max\\{\frac{K^{2}}{n^{2}p},\frac{1}{p}\\})$ and
$\frac{\|\mu\|_{4}^{4}}{K\|\mu\|^{4}}=O(\frac{1}{Kp})$. When
$n\bar{N}\to\infty$ and $p\to\infty$, (3.4) reduces to
$n^{2}\bar{N}^{2}/(Kp)\to\infty$. This condition is necessary for successful
testing, because our lower bound in Section 3.3 implies that the two
hypotheses are asymptotically indistinguishable if $n^{2}\bar{N}^{2}/(Kp)\to
0$.

###  3.1 The asymptotic null distribution

Under the null hypothesis, the $K$ group-wise mean PMF’s
$\mu_{1},\mu_{2},\ldots,\mu_{K}$, are equal to each other, but this hypothesis
is still highly composite, as $(N_{i},\Omega_{i})$ are not necessarily the
same within each group. We show that the DELVE test statistic always enjoys a
parameter-free asymptotic null distribution. Let $T$, $\Theta_{n}$ and $V$ be
as in (2.5)-(2.7). The next two theorems are proved in the appendix.

######  Theorem 3.1.

Consider Models (1.1)-(1.2), where the null hypothesis (1.3) holds. Suppose
(3.1) and (3.4) are satisfied. As $n\bar{N}\to\infty$, $T/\sqrt{\Theta_{n}}\to
N(0,1)$ in distribution.

######  Theorem 3.2.

Under the conditions of Theorem 3.1, as $n{\bar{N}}\to\infty$,
$V/\Theta_{n}\to 1$ in probability, and $\psi:=T/\sqrt{V}\to N(0,1)$ in
distribution.

By Theorem 3.2, the asymptotic $p$-value is computed via $1-\Phi(\psi)$, where
$\Phi(\cdot)$ is the cumulative distribution function of the standard normal.
Moreover, for any fixed $\alpha\in(0,1)$, the rejection region of the
asymptotic level-$\alpha$ test is as given in (2.10).

The proofs of Theorems 3.1-3.2 contain two key steps: in the first step, we
decompose $T$ into the sum of mutually uncorrelated terms. We introduce a set
of independent, mean-zero random vectors $\\{Z_{ir}\\}_{1\leq i\leq n,1\leq
r\leq N_{i}}$, where
$Z_{ir}\sim\mathrm{Multinomial}(1,\Omega_{i})-\Omega_{i}$. By properties of
multinomial distributions, $X_{i}=N_{i}\Omega_{i}+\sum_{r=1}^{N_{i}}Z_{ir}$ in
distribution. We plug it into (2.5) to obtain $T=T_{1}+T_{2}+T_{3}+T_{4}$,
where $T_{1}$ is a linear form of $\\{Z_{ir}\\}$, $T_{2}$, $T_{3}$ and $T_{4}$
are quadratic forms of $\\{Z_{ir}\\}$, and the four terms are uncorrelated
with each other (details are contained in Section A of the appendix ). In the
second step, we construct a martingale for each term $T_{j}$. This is
accomplished by rearranging the double-index sequence $Z_{ir}$ to a single-
index sequence and then successively adding terms in this sequence to $T_{j}$.
We then apply the martingale central limit theorem (CLT) (Hall and Heyde,
2014) to prove the asymptotic normality of each $T_{j}$. The asymptotic
normality of $T$ follows by identifying the dominating terms in
$T_{1}$-$T_{4}$ (as model parameters change, the dominating terms can be
different) and studying their joint distribution. This step involves extensive
calculations to bound the conditional variance and to verify the Lindeberg
conditions of the martingale CLT, as well as numerous subtle uses of the
Cauchy-Schwarz inequality to simplify the moment bounds.

###  3.2 Power analysis

Under the alternative hypothesis, the PMF’s $\mu_{1},\mu_{2},\ldots,\mu_{K}$
are not the same. In Section 2, we introduce a quantity $\rho^{2}$ (see (2.2))
to capture the total variation in $\mu_{k}$’s, but this quantity is not scale-
free. We define a scaled version of $\rho^{2}$ as

$\omega_{n}=\omega_{n}(\mu_{1},\mu_{2},\ldots,\mu_{K}):=\frac{1}{n\bar{N}\|\mu\|^{2}}\sum_{k=1}^{K}n_{k}\bar{N}_{k}\|\mu_{k}-\mu\|^{2}.$
(3.5)

It is seen that
$\omega_{n}\leq\max_{k}\\{\frac{\|\mu_{k}-\mu\|^{2}}{\|\mu\|^{2}}\\}$, which
is properly scaled.

######  Theorem 3.3.

Consider Models (1.1)-(1.2), where (3.1) and (3.4) are satisfied. Then,
$\mathbb{E}[T]=n\bar{N}\|\mu\|^{2}\omega_{n}^{2}$, and
$\mathbb{V}(T)=O\bigl{(}\sum_{k=1}^{K}\|\mu_{k}\|^{2}\bigr{)}+\mathbb{E}[T]\cdot
O\bigl{(}\max_{1\leq k\leq K}\|\mu_{k}\|_{\infty}\bigr{)}$.

For the DELVE test to have an asymptotically full power, we need
$\mathbb{E}[T]\gg\sqrt{\mathbb{V}(T)}$. By Theorem 3.3, this is satisfied if
$\mathbb{E}[T]\gg\sqrt{\sum_{k}\|\mu_{k}\|^{2}}$ and
$\mathbb{E}[T]\gg\max_{k}\|\mu_{k}\|_{\infty}$. Between these two
requirements, the latter one is weaker; hence, we only need
$\mathbb{E}[T]\gg\sqrt{\sum_{k=1}^{K}\|\mu_{k}\|^{2}}$. It gives rise to the
following theorem:

######  Theorem 3.4.

Under the conditions of Theorem 3.3, we further assume that under the
alternative hypothesis, as $n\bar{N}\to\infty$,

$\mathrm{SNR}_{n}:=\frac{n\bar{N}\|\mu\|^{2}\omega_{n}^{2}}{\sqrt{\sum_{k=1}^{K}\|\mu_{k}\|^{2}}}\;\;\to\;\;\infty.$
(3.6)

The following statements are true. Under the alternative hypothesis,
$\psi\to\infty$ in probability. For any fixed $\alpha\in(0,1)$, the
level-$\alpha$ DELVE test has an asymptotic level of $\alpha$ and an
asymptotic power of $1$. If we choose $\alpha=\alpha_{n}$ such that
$\alpha_{n}\to 0$ and $1-\Phi(\mathrm{SNR}_{n})=o(\alpha_{n})$, where $\Phi$
is the CDF of $N(0,1)$, then the sum of type I and type II errors of the DELVE
test converges to $0$.

The detection boundary in (3.6) has simpler forms in some special cases. For
example, if $\|\mu_{k}\|\asymp\|\mu\|$ for $1\leq k\leq K$, then
$\mathrm{SRN}_{n}\asymp n\bar{N}\omega_{n}^{2}\|\mu\|/\sqrt{K}$. If,
furthermore, all entries of $\mu$ are at the same order, which implies
$\|\mu\|\asymp p^{-1/2}$, then $\mathrm{SRN}_{n}\asymp
n^{2}\bar{N}^{2}\omega_{n}^{2}/\sqrt{Kp}$. In this case, the detection
boundary simplifies to $\omega_{n}^{4}n^{2}\bar{N}^{2}/(Kp)\to\infty.$

######  Remark 1 (The low-dimensional case $p=O(1)$).

Although we are primarily interested in the high-dimensional setting
$p\to\infty$, it is also worth investigating the case $p=O(1)$. We can show
the same detection boundary for our test, but the asymptotic normality may not
hold, because the variance estimator $V$ in (2.7) is not guaranteed to be
consistent. To fix this issue, we propose a variant of our test by replacing
$V$ with a refined variance estimator $\widetilde{V}$, which is consistent for
a finite $p$. The expression of $\widetilde{V}$ is a little complicated. Due
to space limits, we relegate it to Section E of the appendix.

###  3.3 A matching lower bound

We have seen that the DELVE test successfully separates two hypotheses if
$\mathrm{SNR}_{n}\to\infty$, where $\mathrm{SNR}_{n}$ is as defined in (3.6).
We now present a lower bound to show that the two hypotheses are
asymptotically indistinguishable if $\mathrm{SNR}_{n}\to 0$.

Let $\ell_{i}\in\\{1,2,\ldots,K\\}$ denote the group label of $X_{i}$. Write
$\xi=\\{(N_{i},\Omega_{i},\ell_{i})\\}_{1\leq i\leq n}$. Let $\mu_{k}$,
$\alpha_{n}$, $\beta_{n}$, and $\omega_{n}$ be the same as defined in (1.2),
(3.2), (3.3), and (3.5), respectively. For each given $(n,p,K,\bar{N})$, we
write $\mu_{k}=\mu_{k}(\xi)$ to emphasize its dependence on parameters, and
similarly for $\alpha_{n},\beta_{n},\omega_{n}$. For any $c_{0}\in(0,1)$ and
sequence $\epsilon_{n}$, define

${\cal
Q}_{n}(c_{0},\epsilon_{n}):=\Big{\\{}\xi=\\{(N_{i},\Omega_{i},\ell_{i})\\}_{i=1}^{n}:\,\mbox{\eqref{cond1-basic}
holds for
$c_{0}$},\,\,\max(\alpha_{n}(\xi),\beta_{n}(\xi))\leq\epsilon_{n}\Big{\\}}$
(3.7)

Furthermore, for any sequence $\delta_{n}$, we define a parameter class for
the null hypothesis and a parameter class for the alternative hypothesis:

$\displaystyle{\cal Q}_{0n}^{*}(c_{0},\epsilon_{n})$ $\displaystyle={\cal
Q}_{n}(c_{0},\epsilon_{n})\cap\left\\{\xi:\omega_{n}(\xi)=0\right\\},$ (3.8)
$\displaystyle{\cal Q}_{1n}^{*}(\delta_{n};c_{0},\epsilon_{n})$
$\displaystyle={\cal
Q}_{n}(c_{0},\epsilon_{n})\cap\left\\{\xi:\frac{n\bar{N}\|\mu(\xi)\|^{2}\omega^{2}_{n}(\xi)}{\sqrt{\sum_{k=1}^{K}\|\mu_{k}(\xi)\|^{2}}}\geq\delta_{n}\right\\}.$
(3.9)

######  Theorem 3.5.

Fix a constant $c_{0}\in(0,1)$ and two positive sequences $\epsilon_{n}$ and
$\delta_{n}$ such that $\epsilon_{n}\to 0$ as $n\to\infty$. For any sequence
of $(n,p,K,\bar{N})$ indexed by $n$, we consider Models (1.1)-(1.2) for
$\Omega\in{\cal Q}_{n}(c_{0},\epsilon_{n})$. Let ${\cal
Q}_{0n}^{*}(c_{0},\epsilon_{n})$ and ${\cal
Q}_{1n}^{*}(\delta_{n};c_{0},\epsilon_{n})$ be as in (3.8). If $\delta_{n}\to
0$, then
$\limsup_{n\to\infty}\inf_{\Psi\in\\{0,1\\}}\bigl{\\{}\sup_{\xi\in{\cal
Q}_{0n}^{*}(c_{0},\epsilon_{n})}\mathbb{P}_{\xi}(\Psi=1)+\sup_{\xi\in{\cal
Q}_{1n}^{*}(\delta_{n};c_{0},\epsilon_{n})}\mathbb{P}_{\xi}(\Psi=0)\bigr{\\}}=1.$

By Theorem 3.5, the null and alternative hypotheses are asymptotically
indistinguishable if $\mathrm{SRN}_{n}\to 0$. Combining it with Theorem 3.4,
the DELVE test achieves the minimax optimal detection boundary.

###  3.4 The special case of $K=2$

The special case of $K=2$ is found in applications such as closeness testing
and authorship attribution. We study this case more carefully. Given
$\\{X_{i}\\}_{1\leq i\leq n}$ and $\\{G_{i}\\}_{1\leq i\leq m}$, we assume

$X_{i}\sim\mathrm{Multinomial}(N_{i},\Omega_{i}),\qquad
G_{j}\sim\mathrm{Multinomial}(M_{j},\Gamma_{j}).$ (3.10)

Write $\bar{N}=n^{-1}\sum_{i=1}^{n}N_{i}$ and
$\bar{M}=m^{-1}\sum_{i=1}^{m}M_{i}$. The null hypothesis becomes

$H_{0}:\quad\eta=\theta,\qquad\mbox{where
}\eta=\frac{1}{n\bar{N}}\sum_{i=1}^{n}N_{i}\Omega_{i},\mbox{ and
}\theta=\frac{1}{m\bar{M}}\sum_{i=1}^{m}M_{i}\Gamma_{i},$ (3.11)

where $\theta$ and $\eta$ are the two group-wise mean PMFs. In this case, the
test statistic $\psi$ has a more explicit form as in (2.15)-(2.16).

In our previous results for a general $K$, the regularity conditions (e.g.,
(3.1)) impose restrictions on the balance of sample sizes among groups. For
$K=2$, the severely unbalanced setting is interesting (e.g., in authorship
attribution, $n=1$ and $m$ can be large). We relax the regularity conditions
to the following ones:

######  Condition 3.1.

Let $\theta$ and $\eta$ be as in (3.11) and define two matrices
$\Sigma_{1}=\frac{1}{n\bar{N}}\sum_{i=1}^{n}N_{i}\Omega_{i}\Omega_{i}^{\prime}$
and
$\Sigma_{2}=\frac{1}{m\bar{M}}\sum_{i=1}^{m}M_{i}\Gamma_{i}\Gamma_{i}^{\prime}$.
We assume that the following statements are true (a) For $1\leq i\leq n$ and
$1\leq j\leq m$, $N_{i}\geq 2$, $\|\Omega_{i}\|_{\infty}\leq 1-c_{0}$,
$M_{j}\geq 2$, and $\|\Gamma_{j}\|_{\infty}\leq 1-c_{0}$, where
$c_{0}\in(0,1)$ is a contant, (b)
$\max\big{\\{}\big{(}\frac{\|\eta\|_{3}^{3}}{n\bar{N}}+\frac{\|\theta\|_{3}^{3}}{m\bar{M}}\big{)},\,\big{(}\frac{\|\eta\|_{2}^{2}}{n^{2}\bar{N}^{2}}+\frac{\|\theta\|_{2}^{2}}{m^{2}\bar{M}_{2}^{2}}\big{)}\big{\\}}\big{/}\bigl{\|}\frac{m\bar{M}}{n\bar{N}+m\bar{M}}\eta+\frac{n\bar{N}}{n\bar{N}+m\bar{M}}\theta\bigr{\|}^{4}=o(1)$,
(c)
$\max\big{\\{}\sum_{i}\frac{N_{i}^{2}}{n^{2}\bar{N}^{2}}\|\Omega_{i}\|_{3}^{3},\,\sum_{i}\frac{M_{i}^{2}}{m^{2}\bar{M}^{2}}\|\Gamma_{i}\|_{3}^{3},\,\|\Sigma_{1}\|_{F}^{2}+\|\Sigma_{2}\|_{F}^{2}\big{\\}}\big{/}\|\mu\|^{2}=o(1)$,
and (d) $\|\mu\|_{4}^{4}/\|\mu\|^{4}=o(1)$.

Condition (a) is similar to (3.1), except that we drop the sample size balance
requriement. Conditions (b)-(d) are equivalent to (3.4) but have more explicit
expressions for $K=2$.

######  Theorem 3.6.

In Model (3.10), we test the null hypothesis $H_{0}$: $\theta=\mu$. As
$\min\\{n{\bar{N}},m\bar{M}\\}\to\infty$, suppose Condition 3.1 is satisfied.
Under the alternative hypothesis, we further assume

$\frac{\|\eta-\theta\|^{2}}{\big{(}\frac{1}{n\bar{N}}+\frac{1}{m\bar{M}}\big{)}\max\\{\|\eta\|,\,\|\theta\|\\}}\to\infty.$
(3.12)

Consider the DELVE test statistic $\psi=T/\sqrt{V}$. The following statements
are true. Under the null hypothesis, $\psi\to N(0,1)$ in distribution. Under
the alternative hypothesis, $\psi\to\infty$ in probability. Moreover for any
fixed $\alpha\in(0,1)$, the level-$\alpha$ DELVE test has an asymptotic level
of $\alpha$ and an asymptotic power of $1$.

Compared with the theorems for a general $K$, first, Theorem 3.6 allows the
two groups to be severely unbalanced and reveals that the detection boundary
depends on the harmonic mean of $n\bar{N}$ and $m\bar{M}$. Second, the
detection boundary is expressed using $\|\eta-\theta\|$, which is easier to
interpret.

###  3.5 The special case of $K=n$

The special case of $K=n$ is interesting for two reasons. First, the
application example of global testing in topic models corresponds to $K=n$.
Second, for any $K$, when $\Omega_{i}$’s within each group are assumed to be
the same (e.g., this is the case in closeness testing of discrete
distributions), it suffices to aggregate the counts in each group, i.e., let
$Y_{k}=\sum_{i\in S_{k}}X_{i}$ and operate on $Y_{1},\ldots,Y_{K}$ instead of
the original $X_{i}$’s; this reduces to the case of $K=n$.

When $K=n$, the null hypothesis has a simpler form:

$H_{0}:\quad\Omega_{i}=\mu,\qquad 1\leq i\leq n.$ (3.13)

Moreover, under the alternative hypothesis, the quantity $\omega_{n}^{2}$ in
(3.5) simplifies to

$\omega_{n}=\omega_{n}(\Omega_{1},\Omega_{2},\ldots,\Omega_{n})=\frac{1}{n\bar{N}\|\mu\|^{2}}\sum_{i=1}^{n}N_{i}\|\Omega_{i}-\mu\|^{2}.$
(3.14)

The DELVE test statistic also has a simplified form as in (2.11)-(2.12). We
can prove the same theoretical results under weaker conditions:

######  Condition 3.2.

We assume that the following statements are true: (a) For a constant
$c_{0}\in(0,1)$, $2\leq N_{i}\leq(1-c_{0})n\bar{N}$ and
$\|\Omega_{i}\|_{\infty}\leq 1-c_{0}$, $1\leq i\leq n$, and
(b)
$\max\big{\\{}\sum_{i}\frac{\|\Omega_{i}\|_{3}^{3}}{N_{i}},\,\sum_{i}\frac{\|\Omega_{i}\|^{2}}{N_{i}^{2}}\big{\\}}\big{/}(\sum_{i}\|\Omega_{i}\|^{2})^{2}=o(1)$,
and $(\sum_{i}\|\Omega_{i}\|_{3}^{3})/(n\|\mu\|^{2})=o(1)$

When $K=n$, Condition (a) is equivalent to (3.1); and Condition (b) is weaker
than (3.4), as we have dropped the requirement
$\frac{\|\mu\|_{4}^{4}}{K\|\mu\|^{4}}=o(1)$. We obtain weaker conditions for
$K=n$ because the dominant terms in $T$ differ from those for $K<n$.

######  Theorem 3.7.

In Model (1.1), we test the null hypothesis (3.13). As $n\to\infty$, we assume
that Condition 3.2 is satisfied. Under the alternative, we further assume that

$\frac{n\bar{N}\|\mu\|^{2}\omega_{n}^{2}}{\sqrt{\sum_{i=1}^{n}\|\Omega_{i}\|^{2}}}\to\infty.$
(3.15)

Let $T$ and $V^{*}$ be the same as in (2.11)-(2.12). Consider the simplified
DELVE test statistic $\psi^{*}=T/\sqrt{V^{*}}$. The following statements are
true. Under the null hypothesis, $\psi^{*}\to N(0,1)$ in distribution. Under
the alternative hypothesis, $\psi^{*}\to\infty$ in probability. Moreover for
any fixed $\alpha\in(0,1)$, the level-$\alpha$ DELVE test has an asymptotic
level of $\alpha$ and an asymptotic power of $1$.

The detection boundary in (3.15) has a simpler form if
$\sum_{i}\|\Omega_{i}\|^{2}\asymp n\|\mu\|^{2}$. In this case, (3.15) is
equivalent to $\sqrt{n}\bar{N}\|\mu\|\omega_{n}^{2}\to\infty.$ Additionally,
if all entries of $\mu$ are at the same order, then $\|\mu\|\asymp
1/\sqrt{p}$, and (3.15) further reduces to
$\sqrt{n\bar{N}^{2}/p}\cdot\omega_{n}^{2}\to\infty$.

###  3.6 A discussion of the contiguity regime

Our power analysis in Section 3.2 concerns $\mathrm{SNR}_{n}\to\infty$, and
our lower bound in Section 3.3 concerns $\mathrm{SNR}_{n}\to 0$. We now study
the contiguity regime where $\mathrm{SNR}_{n}$ tends to a constant. For
illustration, we consider a special choice of parameters, which allows us to
obtain a simple expression of the testing risk.

Suppose $K=n$ and $N_{i}=N$ for all $1\leq i\leq n$. Consider the pair of
hypotheses:

$H_{0}:\;\;\Omega_{ij}=p^{-1},\qquad\mbox{v.s.}\qquad
H_{1}:\;\;\Omega_{ij}=p^{-1}(1+\beta_{n}\delta_{ij}),$ (3.16)

where $\\{\delta_{ij}\\}_{1\leq i\leq n,1\leq j\leq p}$ satisfy that
$|\delta_{ij}|=1$, $\sum_{j=1}^{p}\delta_{ij}=0$ and
$\sum_{i=1}^{n}\delta_{ij}=0$. Such $\delta_{ij}$ always exist.333For example,
we can first partition the dictionary into two halves and then partition all
the documents into two halves; this divides
$\\{1,2,\ldots,p\\}\times\\{1,2,\ldots,n\\}$ into four subsets; we construct
$\delta_{ij}$’s freely on one subset and then specify the $\delta_{ij}$’s on
the other three subsets by symmetry. The $\mathrm{SNR}_{n}$ in (3.6) satisfies
that $\mathrm{SNR}_{n}\asymp(N\sqrt{n}/\sqrt{p})\beta_{n}^{2}$. We thereby set

$\beta_{n}^{2}=\frac{\sqrt{2p}}{N\sqrt{n}}\cdot a,\qquad\mbox{for a constant
}a>0.$ (3.17)

Since $K=n$ here, we consider the simplified DELVE test statistic $\psi^{*}$
as in Section 3.5.

######  Theorem 3.8.

Consider Model (1.1) with $N_{i}=N$. For a constant $a>0$, let the null and
alternative hypotheses be specified as in (3.16)-(3.17). As $n\to\infty$, if
$p=o(N^{2}n)$, then $\psi^{*}\to N(0,1)$ under $H_{0}$ and $\psi^{*}\to
N(a,1)$ under $H_{1}$.

Let $\Phi$ be the cumulative distribution function of the standard normal. By
Theorem 3.8, for any fixed constant $t\in(0,a)$, if we reject the null
hypothesis when $\psi^{*}>t$, then the sum of type I and type II errors
converges to $[1-\Phi(t)]+[1-\Phi(a-t)]$.

##  4 Applications

As mentioned in Section 1, our testing problem includes global testing for
topic models, authorship attribution, and closeness testing for discrete
distributions as special examples. In this section, the DELVE test is applied
separately to these three problems.

###  4.1 Global testing for topic models

Topic modeling (Blei et al., 2003) is a popular tool in text mining. It aims
to learn a small number of “topics” from a large corpus. Given $n$ documents
written using a dictionary of $p$ words, let
$X_{i}\sim\mathrm{Multinomial}(N_{i},\Omega_{i})$ denote the word counts of
document $i$, where $N_{i}$ is the length of this document and
$\Omega_{i}\in\mathbb{R}^{p}$ contains the population word frequencies. In a
topic model, there exist $M$ topic vectors
$A_{1},A_{2},\ldots,A_{M}\in\mathbb{R}^{p}$, where each $A_{k}$ is a PMF. Let
$w_{i}\in\mathbb{R}^{M}$ be a nonnegative vector whose entries sum up to $1$,
where $w_{i}(k)$ is the “weight” document $i$ puts on topic $k$. It assumes

$\Omega_{i}=\sum_{k=1}^{M}w_{i}(k)A_{k},\qquad 1\leq i\leq n.$ (4.1)

Under (4.1), the matrix $\Omega=[\Omega_{1},\Omega_{2},\ldots,\Omega_{n}]$
admits a low-rank nonnegative factorization.

Before fitting a topic model, we would like to know whether the corpus indeed
involves multiple topics. This is the global testing problem: $H_{0}:M=1$ v.s.
$H_{1}:M>1$. When $M=1$, by writing $A_{1}=\mu$, the topic model reduces to
the null hypothesis in (3.13). We can apply the DELVE test by treating each
$X_{i}$ as a separate group (i.e., $K=n$).

######  Corollary 4.1.

Consider Model (1.1) and define a vector $\xi\in\mathbb{R}^{n}$ by
$\xi_{i}=\bar{N}^{-1}N_{i}$. Suppose that $\Omega=\mu{\bf 1}_{n}^{\prime}$
under the null hypothesis, with $\mu=n^{-1}\Omega\xi$, and that $\Omega$
satisfies (4.1) under the alternative hypothesis, with
$r:=\mathrm{rank}(\Omega)\geq 2$. Suppose $\bar{N}/(\min_{i}N_{i})=O(1)$.
Denote by $\lambda_{1},\lambda_{2},\ldots,\lambda_{r}>0$ the singular values
of $\Omega[\mathrm{diag}(\xi)]^{1/2}$, arranged in the descending order. We
further assume that under the alternative hypothesis,

$\bar{N}\cdot\frac{\sum_{k=2}^{r}\lambda_{k}^{2}}{\sqrt{\sum_{k=1}^{r}\lambda_{k}^{2}}}\to\infty.$
(4.2)

For any fixed $\alpha\in(0,1)$, the level-$\alpha$ DELVE test has an
asymptotic level $\alpha$ and an asymptotic power $1$.

The least-favorable configuration in the proof of Theorem 3.5 is in fact a
topic model that follows (4.1) with $M=2$. Transferring the argument yields
the following lower bound that confirms the optimality of DELVE for the global
testing of topic models.

######  Corollary 4.2.

Let ${\cal R}_{n,M}(\epsilon_{n},\delta_{n})$ be the collection of
$\\{(N_{i},\Omega_{i})\\}_{i=1}^{n}$ satisfying the following conditions: 1)
$\Omega$ follows the topic model (4.1) with $M$ topics; 2) Condition 3.2 holds
with $o(1)$ replaced by $\leq\epsilon_{n}$; 3)
$\bar{N}(\sum_{k=2}^{r}\lambda_{k}^{2})/(\sum_{k=1}^{r}\lambda_{k}^{2})^{1/2}\geq\delta_{n}$.
If $\epsilon_{n}\to 0$ and $\delta_{n}\to 0$, then
$\limsup_{n\to\infty}\inf_{\Psi\in\\{0,1\\}}\Bigl{\\{}\sup_{{\cal
R}_{n,1}(\epsilon_{n},0)}\mathbb{P}(\Psi=1)+\sup_{\cup_{M\geq 2}{\cal
R}_{n,M}(\delta_{n},\delta_{n})}\mathbb{P}(\Psi=0)\Bigr{\\}}=1.$

The detection boundary (4.2) can be simplified when $M=O(1)$. Following Ke and
Wang (2022), we define $\Sigma_{A}=A^{\prime}H^{-1}A$ and
$\Sigma_{W}=n^{-1}WW^{\prime}$, where $A=[A_{1},A_{2},\ldots,A_{M}]$,
$W=[w_{1},w_{2},\ldots,w_{n}]$ and $H=\mathrm{diag}(A{\bf 1}_{M})$. Ke and
Wang (2022) argued that it is reasonable to assume that eigenvalues of these
two matrices are at the constant order. If this is true, with some mild
additional regularity conditions, each $\lambda_{k}$ is at the order of
$\sqrt{n/p}$. Hence, (4.2) reduces to $\sqrt{n}\bar{N}/\sqrt{p}\to\infty.$ In
comparison, Ke and Wang (2022) showed that a necessary condition for any
estimator $\hat{A}=[\hat{A}_{1},\hat{A}_{2},\ldots,\hat{A}_{M}]$ to achieve
$\frac{1}{M}\sum_{k=1}^{M}\|\hat{A}_{k}-A_{k}\|_{1}=o(1)$ is
$\sqrt{n\bar{N}/p}\to\infty$. We conclude that consistent estimation of topic
vectors requires strictly stronger conditions than successful testing.

###  4.2 Authorship attribution

In authorship attribution, given a corpus from a known author, we want to test
whether a new document is from the same author. It is a special case of our
testing problem with $K=2$. We can directly apply the results in Section 3.4.
However, the setting in Section 3.4 has no sparsity. Kipnis (2022); Donoho and
Kipnis (2022) point out that the number of words with discriminating power is
often much smaller than $p$. To see how our test performs under sparsity, we
consider a sparse model. As in Section 3.4, let

$X_{i}\sim\mathrm{Multinomial}(N_{i},\Omega_{i}),\;1\leq i\leq
n,\quad\mbox{and}\quad G_{i}\sim\mathrm{Multinomial}(M_{i},\Gamma_{i}),\;1\leq
i\leq m.$ (4.3)

Let $\bar{N}$ and $\bar{M}$ be the average of $N_{i}$’s and $M_{i}$’s,
respectively. Write $\eta=\frac{1}{n\bar{N}}\sum_{i=1}^{n}N_{i}\Omega_{i}$ and
$\theta=\frac{1}{m\bar{M}}\sum_{i=1}^{m}M_{i}\Gamma_{i}$. We assume for some
$\beta_{n}>0$,

$\eta_{j}=\theta_{j},\;\;\mbox{for }j\notin
S,\qquad\mbox{and}\qquad\bigl{|}\sqrt{\eta_{j}}-\sqrt{\theta_{j}}\bigr{|}\geq\beta_{n},\;\;\mbox{for
}j\in S.$ (4.4)

######  Corollary 4.3.

Under the model (4.3)-(4.4), consider testing $H_{0}:S=\emptyset$ v.s.
$H_{1}:S\neq\emptyset$, where Condition 3.1 is satisfied. Let $\eta_{S}$ and
$\theta_{S}$ be the sub-vectors of $\eta$ and $\theta$ restricted to the
coordinates in $S$. Suppose that under the alternative hypothesis,

$\frac{\beta_{n}^{2}\cdot(\|\eta_{S}\|_{1}+\|\theta_{S}\|_{1})}{\big{(}\frac{1}{n\bar{N}}+\frac{1}{m\bar{M}}\big{)}\max\\{\|\eta\|,\,\|\theta\|\\}}\to\infty.$
(4.5)

As $\min\\{n\bar{N},m\bar{M}\\}\to\infty$, the level-$\alpha$ DELVE test has
an asymptotic level $\alpha$ and an asymptotic power $1$. Furthermore, if
$n\bar{N}\asymp m\bar{M}$ and $\min_{j\in S}(\eta_{j}+\theta_{j})\geq cp^{-1}$
for a constant $c>0$, then (4.5) reduces to
$n\bar{N}\beta_{n}^{2}|S|/\sqrt{p}\to\infty$.

Donoho and Kipnis (2022) studied a case where $N=M$, $n=m=1$, $p\to\infty$,

$|S|=p^{1-\vartheta},\qquad\mbox{and}\qquad\beta_{n}=c\cdot
N^{-1/2}\sqrt{\log(p)}.$ (4.6)

When $\vartheta>1/2$ (i.e., $|S|=o(\sqrt{p})$), they derived a phase diagram
for the aforementioned testing problem (under a slightly different setting
where the data distributions are Poisson instead of multinomial). They showed
that when $\vartheta>1/2$ and $c$ is a properly large constant, a Higher-
Criticism-based test has an asymptotically full power. Donoho and Kipnis
(2022) did not study the case of $\vartheta\leq 1/2$. By Corollary 4.3, when
$\vartheta\leq 1/2$ (i.e., $|S|\geq C\sqrt{p}$), the DELVE test has
asymptotically full power.

######  Remark 2.

When $\vartheta>1/2$ in (4.6), the DELVE test is powerless. However, this
issue can be resolved by borrowing the idea of maximum test or Higher
Criticism test (Donoho and Jin, 2004) from the classical multiple testing. For
example, recalling $T_{j}$ in (2.5), we can use $\max_{1\leq j\leq
p}\\{T_{j}/\sqrt{V_{j}}\\}$ as the test statistic, where $V_{j}$ is a proper
estimator of the variance of $T_{j}$. We leave a careful study of this idea to
future work.

###  4.3 Closeness testing between discrete distributions

Two-sample closeness testing is a subject of intensive study in discrete
distribution inference (Bhattacharya and Valiant, 2015; Chan et al., 2014;
Diakonikolas and Kane, 2016; Kim et al., 2022). It is a special case of our
problem with $K=2$ and $n_{1}=n_{2}=1$. We thereby apply both Theorem 3.6 and
Theorem 3.7.

######  Corollary 4.4.

Let $Y_{1}$ and $Y_{2}$ be two discrete variables taking values on the same
$p$ outcomes. Let $\Omega_{1}\in\mathbb{R}^{p}$ and
$\Omega_{2}\in\mathbb{R}^{p}$ be their corresponding PMFs. Suppose we have
$N_{1}$ samples of $Y_{1}$ and $N_{2}$ samples of $Y_{2}$. The data are
summarized in two multinomial vectors:
$X_{1}\sim\mathrm{Multinomial}(N_{1},\Omega_{1}),X_{2}\sim\mathrm{Multinomial}(N_{2},\Omega_{2}).$
We test $H_{0}:\Omega_{1}=\Omega_{2}.$ Write
$\mu=\frac{1}{N_{1}+N_{2}}(N_{1}\Omega_{1}+N_{2}\Omega_{2})$. Suppose
$\min\\{N_{1},N_{2}\\}\geq 2$,
$\max\\{\|\Omega_{1}\|_{\infty},\|\Omega_{2}\|_{\infty}\\}\leq 1-c_{0}$, for a
constant $c_{0}\in(0,1)$. Suppose
$\frac{1}{(\sum_{k=1}^{2}\|\Omega_{k}\|^{2})^{2}}\max\big{\\{}\sum_{k=1}^{2}\frac{\|\Omega_{k}\|_{3}^{3}}{N_{k}},\sum_{k=1}^{2}\frac{\|\Omega_{k}\|^{2}}{N_{k}^{2}}\big{\\}}=o(1)$,
and $\frac{1}{n\|\mu\|^{2}}\sum_{k=1}^{2}\|\Omega_{k}\|_{3}^{3}=o(1)$. We
assume that under the alternative hypothesis,

$\frac{\|\Omega_{1}-\Omega_{2}\|^{2}}{\big{(}N_{1}^{-1}+N_{2}^{-1}\big{)}\max\\{\|\Omega_{1}\|,\,\|\Omega_{2}\|\\}}\to\infty.$
(4.7)

As $\min\\{N_{1},N_{2}\\}\to\infty$, the level-$\alpha$ DELVE test has level
$\alpha$ and power $1$, asymptotically.

We notice that (4.7) matches with the minimum $\ell^{2}$-separation condition
for two-sample closeness testing (Kim et al., 2022, Proposition 4.4).
Therefore, our test is an optimal $\ell^{2}$-testor. Although other optimal
$\ell^{2}$-testors have been proposed (Chan et al., 2014; Bhattacharya and
Valiant, 2015; Diakonikolas and Kane, 2016), they are not equipped with
tractable null distributions.

######  Remark 3.

We can modify the DELVE test to incorporate frequency-dependent weights. Given
any nonnegative vector $w=(w_{1},w_{2},\ldots,w_{p})^{\prime}$, define
$T(w):=\sum_{j=1}^{p}w_{j}T_{j}$ where $T_{j}$ is the same as in (2.5). These
weights $w_{j}$ serve to adjust the contributions of different words. For
example, consider $w_{j}=\bigl{(}\max\\{1/p,\;\hat{\mu}_{j}\\}\bigr{)}^{-1}$.
This kind of weights have been used in discrete distribution inference
(Balakrishnan and Wasserman, 2019; Chan et al., 2014) to turn an optimal
$\ell^{2}$ testor to an optimal $\ell^{1}$ testor. We can similarly study the
power of this modified test, except that we need an additional assumption
$n\bar{N}\gg p$ to guarantee that $\hat{\mu}_{j}$ is a sufficiently accurate
estimator of $\mu_{j}$.

##  5 Simulations

The proposed DELVE test is computationally efficient and easy to implement. In
this section, we investigate its numerical performance in simulation studies.
Real data analysis will be carried out in Section 6.

Figure 1: Histograms of the DELVE statistic (top three panels) and the DELVE+
statistic (bottom three panels) in Experiments 1.1-1.3. In each plot, the blue
and orange histograms correspond to the null and alternative hypotheses,
respectively; and the green curve is the density of $N(0,1)$.

Experiment 1 (Asymptotic normality) . Given
$(n,p,K,N_{\min},N_{\max},\alpha)$, we generate data as follows: first, we
divide $\\{1,\ldots,n\\}$ into $K$ equal-size groups. Next, we draw
$\Omega_{1}^{alt},\ldots,\Omega_{n}^{alt}$ i.i.d. from
$\text{Dirichlet}(p,\alpha\mathbf{1}_{p})$. Third, we draw
$N_{i}\stackrel{{\scriptstyle iid}}{{\sim}}\text{Uniform}[N_{\min},N_{\max}]$
and set $\Omega_{i}^{null}=\mu$, where
$\mu:=\frac{1}{n\bar{N}}\sum_{i}N_{i}\Omega_{i}^{alt}$. Last, we generate
$X_{1},\ldots,X_{n}$ using Model (1.1). We consider three sub-experiments. In
Experiment 1.1, $(n,p,K,N_{\min},N_{\max},\alpha)=(50,100,5,10,20,0.3)$. In
Experiment 1.2, $\alpha$ is changed to $1$, and the other parameters are the
same. When $\alpha=1$, $\Omega_{i}^{alt}$ are drawn from the uniform
distribution of the standard probability simplex; in comparison, $\alpha=0.3$
puts more mass near the boundary of the standard probability simplex. In
Experiment 1.3, we keep all parameters the same as in Experiment 1.1, except
that $(p,K)$ are changed to $(300,50)$. For each sub-experiment, we generate
2000 data sets under the null hypothesis and plot the histogram of the DELVE
test statistic $\psi$ (in blue); similarly, we generate 2000 data sets under
the alternative hypothesis and plot the histogram of $\psi$ (in orange). The
results are contained on the top three panels of Figure 1. In Section 2.2, we
introduced a variant of DELVE, called DELVE+, in which the variance estimator
$V$ is replaced by an adjusted one. DELVE+ has similar theoretical properties
as DELVE but is more suitable for real data. We plot the histograms of the
DELVE+ test statistics on the bottom three panels of Figure 1.

We have several observations. In all sub-experiments, when the null hypothesis
holds, the histograms of both DELVE and DELVE+ fit the standard normal density
reasonably well. This supports our theory in Section 3.1. Second, when $(p,K)$
increase, the finite sample effect becomes slightly more pronounced (c.f.,
Experiment 1.3 versus Experiment 1.1). Third, the tests have power in
differentiating two hypotheses. As $\alpha$ decreases or $K$ increases, the
power increases, and the histograms corresponding to two hypotheses become
further apart. Last, in the alternative hypothesis, DELVE+ has smaller mean
and variance than DELVE. By Lemma 2.2, these two have similar asymptotic
behaviors. The simulation results suggest that they have noticeable finite-
sample differences.

Figure 2:  Power diagrams (based on $500$ repetitions) at level $5\%$. The
$x$-axis plots the SNR
$\lambda(\omega_{n})=K^{-1/2}n\bar{N}\|\mu\|\cdot\omega_{n}$.

Experiment 2 (Power curve). Similarly as before, we divide
$\\{1,2,\ldots,n\\}$ into $K$ equal-size groups and draw
$N_{i}\sim\text{Uniform}[N_{\min},N_{\max}]$. In this experiment, the PMF’s
$\Omega_{i}$ are generated in a different way. Under the null hypothesis, we
generate $\mu\sim\text{Dirichlet}(p/2,\alpha\mathbf{1}_{p/2})$ and set
$\Omega_{i}^{null}=\tilde{\mu}$, where $\tilde{\mu}_{j}=\frac{1}{2}\mu_{j}$
for $1\leq j\leq p/2$ and $\tilde{\mu}_{j}=\frac{1}{2}\mu_{p+1-j}$ for
$p/2+1\leq j\leq p$. Under the alternative hypothesis, we draw
$z_{1},\ldots,z_{K}$, $b_{1},\ldots,b_{p/2}\stackrel{{\scriptstyle
iid}}{{\sim}}\text{Rademacher}(1/2)$ and then let
$\Omega_{ij}^{alt}=\mu(1+\tau_{n}z_{k}b_{j})$, for all $i$ in group $k$ and
$1\leq j\leq p/2$, and $\Omega_{ij}^{alt}=\mu(1+\tau_{n}z_{k}b_{j})$ for
$p/2+1\leq j\leq p$. By applying our theory in Section 3.2 together with some
calculations, we obtain that the signal-to-noise ratio is captured by
$\lambda:=K^{-1/2}n\bar{N}\|\mu\|\tau_{n}.$ We consider three sub-experiments,
Experiment 2.1-2.3, in which the parameter values of
$(n,p,K,N_{\min},N_{\max},\alpha)$ are the same as in Experiments 1.1-1.3. For
each sub-experiment, we consider a grid of 10 equally-spaced values of
$\lambda$. When $\lambda=0$, it corresponds to the null hypothesis; when
$\lambda>0$, it corresponds to the alternative hypothesis. For each $\lambda$,
we generate $500$ data sets and compute the fraction of rejections of the
level-$5\%$ DELVE test. This gives a power curve for the level-$5\%$ DELVE
test, in which the first point corresponding to $\lambda=0$ is the actual
level of the test. The results are contained on the top three panels of Figure
2. We repeat the same experiments for the DELVE+ test, which results are on
the bottom three panels of Figure 2. In all three experiments, the actual
level of our proposed tests is $\leq 5\%$, suggesting that our tests perform
well at controlling the type-I error. As $\lambda$ increases, the power
gradually increased to $1$, suggesting that $\lambda$ is a good metric of the
signal-to-noise ratio. This supports our theory in Section 3.2.

Figure 3: (Left) Histogram of nonzero DELVE $Z$-scores for all authors in the
dataset. The mean is $4.52$ and the standard deviation is $2.94$. (Right)
Scatter plot of author DELVE scores versus the natural log of the number of
papers with five statisticians identified.

##  6 Real Data Analysis

We apply our proposed methods on two real corpora: one consists of abstracts
of research papers in four statistics journals, and the other consists of
movie reviews on Amazon. For the analysis of real data, we use DELVE+, which
modifies the variance estimator in DELVE and reduces the occurrence of
extremely small $p$-values.

###  6.1 Abstracts of statisticians

We use the data set from Ji and Jin (2016). It contains the bibtex information
of all published papers in four top-tier statistics journals, Annals of
Statistics, Biometrika, Journal of the American Statistical Association, and
Journal of the Royal Statistical Society - Series B, from 2003 to the first
half of 2012. We pre-process the abstracts of papers by tokenization and
stemming and turn each abstract to a word count vector.

We conduct two experiments. In the first one, we fix an author and treat the
collection of his/her co-authored abstracts as a corpus. We apply DELVE+ with
$K=n$, where $n$ is the total number of abstracts written by this author. The
$Z$-score measures the “diversity” or “variability” of this authors’
abstracts. An author with a high $Z$-score possesses either diverse research
interests or a variable writing style. A number of authors have only 1–2
papers in this data set, and the variance estimator $V$ is often negative; we
remove all those authors. In Figure 3 (left panel), we plot the histogram of
$Z$-scores of all retained authors. The mean is $4.52$ and the standard
deviation is $2.94$. In Figure 3 (right panel), we show the scatter plot of
$Z$-score versus logarithm of the number of abstracts written by this author,
and a few prolific authors who have many papers and a large $Z$-score are
labeled. For example, Peter Hall has the most papers in this dataset (82
papers in total). Hall’s $Z$-score is larger than $20$, implying a huge
diversity in his abstracts. There is also a positive association between
$Z$-score and total papers. It suggests that senior authors have more
diversity in their abstracts, which is as expected.

Figure 4: Pairwise $Z$-score plots for Peter Hall (left) and Jianqing Fan (right). In the cell $(x,y)$, we compare the corpus of an author’s abstracts from time $x$ with the corpus of that author’s abstracts from time $y$. The heatmap shows the value of DELVE+ with $K=2$ for each cell.  |  Year |  Title |  Journal
---|---|---
2011 |  Nonparametric independence screening in sparse ultra-high-dimensional additive models |  JASA
2011 |  Penalized composite quasi-likelihood for ultrahigh dimensional variable selection |  JRSS-B
2011 |  Multiple testing via ${\rm FDR}_{L}$ for large-scale imaging data |  Ann. Stat.
2012 |  Vast volatility matrix estimation using high-frequency data for portfolio selection |  JASA
2012 |  A road to classification in high dimensional space: the regularized optimal affine discriminant |  JRSS-B
2012 |  Variance estimation using refitted cross-validation in ultrahigh dimensional regression |  JRSS-B

Year |  Title |  Journal
---|---|---
2004 |  Low order approximations in deconvolution and regression with errors in variables |  JRSS-B
2004 |  Nonparametric inference about service time distribution from indirect measurements |  JRSS-B
2004 |  Cross-validation and the estimation of conditional probability densities |  JASA
2004 |  Nonparametric confidence intervals for receiver operating characteristic curves |  Biometrika
2004 |  Bump hunting with non-Gaussian kernels |  Ann. Stat.
2004 |  Attributing a probability to the shape of a probability density |  Ann. Stat.

Figure 5: (Left) Jianqing Fan’s papers in the dataset of Ji and Jin (2016)
from 2011 to 2012. (Right) Peter Hall’s papers in the dataset of Ji and Jin
(2016) from 2004.

In the second experiment, we divide the abstracts of each author into groups
by publication year. We divide Peter Hall’s abstracts into 9 groups, and each
group corresponds to one year. We divide Jianqing Fan’s abstracts into 6
groups, with unequal window sizes to make all groups have roughly equal
numbers of abstracts. Our test can be used to detect differences between all
groups, but to see more informative results, we do a pairwise comparison: for
each pair of groups, we apply DELVE+ with $K=2$. This yields a pairwise plot
of $Z$-scores. The plot reveals the temporal patterns of this author in
abstract writing. Figure 4 shows the results for Peter Hall and Jianqing Fan.

There are interesting temporal patterns. For Jianqing Fan (right panel of
Figure 4), the group consisting of his 2011-2012 abstracts has comparably
large $Z$-scores in the pairwise comparison with other groups. To interpret
this , we gathered the titles and abstracts of all his papers in the dataset
and compared the ones before/after 2011. He published six papers in these
journals during 2011-2012, whose titles are listed on the left of Figure 5. We
see that his papers in this period had a strong emphasis on screening and
variable selection: four out of the six papers mention this subject in their
titles and/or abstracts. This shows a departure from his previously published
topics such as covariance estimation (a focus from 2007–2009) and
semiparametric estimation (a focus before 2010). Though Jianqing Fan had
previously published papers on variable selection and screening in these
journals, he had never published so many in such a short time period. For
Peter Hall (left panel of Figure 4), the group of 2004 abstracts have
comparably large $Z$-scores in the pairwise comparison with other groups. We
examined the titles and abstracts of his 6 papers published in 2004 in this
data set. All of his 2004 papers, except the first one, mention bandwidth
selection or smoothing parameters, and in the last 4 papers, bandwidth
selection plays a central role. For instance, Bump hunting with non-Gaussian
kernels, (Ann. Stat., 2004) studies the relationship between the number of
modes of a kernel density estimator and its bandwidth parameter. Though Peter
Hall’s 2014 papers concern many nonparametric statistics topics, we find that
bandwidth selection is a theme underlying his research in these journals in
2004.

###  6.2 Amazon movie reviews

Rank |  Title |  $Z$-Score | Total reviews
---|---|---|---
1 |  Prometheus | 34.44 | 813
2 |  Expelled: No Intelligence Allowed | 34.17 | 830
3 |  V for Vendetta | 32.24 | 815
4 |  Sin City | 31.72 | 828
5 |  No Country for Old Men | 30.57 | 819
$\vdots$ |  $\vdots$ | $\vdots$ | $\vdots$
16 |  John Adams | 20.78 | 857
17 |  Cars | 19.98 | 902
18 |  Food, Inc. | 17.81 | 876
19 |  Jeff Dunham: Arguing with Myself | 4.96 | 860
20 |  Jeff Dunham: Spark of Insanity | 4.46 | 877

Figure 6: (Left) Histogram of $Z$-scores for the 500 most-reviewed movies. The
mean is $19.97$ and the standard deviation is $5.07$. (Right) $Z$-scores for
the top 20 most reviewed movies.

Figure 7: Pairwise $Z$-scores for 3 movies. In each cell, we use DELVE+ to
compare reviews associated to a pair of star ratings. For each movie, the
title list the number of reviews of each rating from 1–5.

We analyze Amazon reviews from the dataset Maurya (2018) that consists of
1,924,471 reviews of 143,007 visual media products (ie, DVDs, Bluray, or
streams). We examine products with the largest number of reviews. Each
product’s review corpus is cleaned and stemming is used to group together
words with the same root. We obtain word counts for each review and a term-
document matrix of a product’s review corpus. In the first experiment, we fix
a movie and apply DELVE+ with $K=n$ to the corpus consisting of all reviews of
this movie. In Figure 6 (left panel), we plot the histogram of $Z$-scores for
the top 500 most reviewed movies. The mean is $19.97$ and the standard
deviation is $5.07$. Compared with the histogram of $Z$-scores for statistics
paper abstracts, there is much larger diversity in movie reviews. In Figure 6
(right panel), we list the 5 movies with the highest $Z$-scores and lowest
$Z$-scores out of the 20 most reviewed movies. Each movie has more than 800
reviews, but some have surprisingly low $Z$-scores. The works by comedian Jeff
Dunham have the lowest $Z$-scores, suggesting strong homogeneity among the
reviews. The 2012 horror film Prometheus has the highest degree of review
diversity among the 20 most reviewed movies. In the second experiment, we
divide the reviews of each movie into 5 groups by star rating. We compare each
pair of groups using DELVE+ with $K=2$, resulting in a pairwise $Z$-score
plot. In Figure 7, we plot this for 3 popular movies. We see a variety of
polarization patterns among the scores. In Harry Potter and the Deathly
Hallows Part I, DELVE+ signifies that the reviews with ratings in the range
2–4 stars are all similar. We see a smooth gradation in how the 1-star reviews
differ from those from 2–4 stars, and similarly for 5-star reviews versus
those from 2–4 stars. Twilight Saga: Eclipse shows three clusters: 1–2 stars,
3–4 stars, and 5 star, while Night of the living dead shows two clusters: 1–2
stars and 3–5 stars.

##  7 Discussions

We examine the testing for equality of PMFs of $K$ groups of high-dimensional
multinomial distributions. The proposed DELVE statistic has a parameter-free
limiting null that allows for computation of $Z$-scores and $p$-values on real
data. DELVE achieves the optimal detection boundary over the whole range of
parameters $(n,p,K,\bar{N})$, including the high-dimensional case
$p\to\infty$, which is very relevant to applications in text mining.

This work leads to interesting questions for future study. So far the focus is
on testing, but one can also consider inference for $\rho^{2}$ from (2.2),
which measures the heterogeneity among the group-wise means. Consistent
variance estimation under the alternative uses a similar strategy, though we
omit the calculations in this paper. Establishing asymptotic normality of
DELVE under the alternative would then lead to asymptotic confidence intervals
for our heterogeneity metric $\rho^{2}$. Based on the plots in Section 5, it
is possible that stronger regularity conditions are needed to obtain a pivotal
distribution under the alternative. As in the two-sample multinomial testing
problems described in Kipnis and Donoho (2021); Kipnis (2022), such as author
attribution, we may also consider an alternative where all the group means are
the same except for a small set of “giveaway words”. It is interesting to
develop a procedure for identifying these useful words. As discussed in
Section 4.2, we may modify DELVE by using a version based on the maximum test
or higher criticism. Another extension is to go beyond ‘bag-of-words’ style
analysis and use different types of counts besides raw word frequencies. One
option is to apply a suitably modified DELVE to the counts of multi-grams in
the corpus and another is to combine words with similar meanings into a
‘superword’ and use superword counts as the basis for DELVE. To do this, we
can combine words that are close together in some word embedding. We leave
these interesting tasks for future work.

Acknowledgments The research of T. Tony Cai was supported in part by NSF Grant
DMS-2015259 and NIH grant R01-GM129781. The research of Zheng Tracy Ke was
supported in part by NSF CAREER Grant DMS-1943902.

Notational conventions for the appendix: We write $A\lesssim B$ (respectively,
$A\gtrsim B$) if there exists an absolute constant $C>0$ such that $A\leq
C\cdot B$ (respectively $A\geq C\cdot B$). If both $A\lesssim B$ and
$B\lesssim A$, we write $A\asymp B$. The implicit constant $C$ may vary from
line to line. For sequences $a_{t},b_{t}$ indexed by an integer
$t\in\mathbb{N}$, we write $a_{t}\ll b_{t}$ if $b_{t}/a_{t}\to\infty$ as
$t\to\infty$, and we write $a_{t}\gg b_{t}$ if $a_{t}/b_{t}\to\infty$ as
$t\to\infty$. We also may write $a_{t}=o(b_{t})$ to denote $a_{t}\ll b_{t}$.
In particular, we write $a_{t}=(1+o(1))b_{t}$ if $a_{t}/b_{t}\to 1$ as
$t\to\infty$.

##  Appendix A Properties of $T$ and $V$

We recall that

$X_{i}\sim\mathrm{Multinomial}(N_{i},\Omega_{i}),\qquad 1\leq i\leq n.$ (A.1)

For each $1\leq k\leq K$, define

$\mu_{k}=\frac{1}{n_{k}\bar{N}_{k}}\sum_{i\in
S_{k}}N_{i}\Omega_{i}\;\in\;\mathbb{R}^{p},\qquad\Sigma_{k}=\frac{1}{n_{k}\bar{N}_{k}}\sum_{i\in
S_{k}}N_{i}\Omega_{i}\Omega_{i}^{\prime}\;\in\;\mathbb{R}^{p\times p}.$ (A.2)

Moreover, let

$\mu=\frac{1}{n\bar{N}}\sum_{k=1}^{K}n_{k}\bar{N}_{k}\mu_{k}=\frac{1}{n\bar{N}}\sum_{i=1}^{n}N_{i}\Omega_{i}\,,\quad\Sigma=\frac{1}{n\bar{N}}\sum_{k=1}^{n}n_{k}\bar{N}_{k}\Sigma_{k}=\frac{1}{n\bar{N}}\sum_{i}N_{i}\Omega_{i}\Omega_{i}^{\prime}$
(A.3)

The DELVE test statistic is $\psi=T/\sqrt{V}$, where $T$ is as in (2.5) and
$V$ is as in (2.7). As a preparation for the main proofs, in this section, we
study $T$ and $V$ separately.

###  A.1 The decomposition of $T$

It is well-known that a multinomial with the number of trials equal to $N$ can
be equivalently written as the sum of $N$ independent multinomials each with
the number of trials equal to $1$. This inspires us to introduce a set of
independent, mean-zero random vectors:

$\\{Z_{ir}\\}_{1\leq i\leq n,1\leq r\leq N_{i}},\qquad\mbox{with
}Z_{ir}=B_{ir}-\mathbb{E}B_{ir},\;\;\mbox{and}\;\;B_{ir}\sim\mathrm{Multinomial}(1,\Omega_{i}).$
(A.4)

We use them to get a decomposition of $T$ into mutually uncorrelated terms:

######  Lemma A.1.

Let $\\{Z_{ir}\\}_{1\leq i\leq n,1\leq r\leq N_{i}}$ be as in (A.4). For each
$Z_{ir}\in\mathbb{R}^{p}$, let $\\{Z_{ijr}\\}_{1\leq j\leq p}$ denote its $p$
coordinates. Recall that
$\rho^{2}=\sum_{k=1}^{K}n_{k}\bar{N}_{k}\|\mu_{k}-\mu\|^{2}$. For $1\leq j\leq
p$, define

$\displaystyle U_{1j}$ $\displaystyle=$ $\displaystyle
2\sum_{k=1}^{K}\sum_{i\in S_{k}}\sum_{r=1}^{N_{i}}(\mu_{kj}-\mu_{j})Z_{ijr},$
$\displaystyle U_{2j}$ $\displaystyle=$ $\displaystyle\sum_{k=1}^{K}\sum_{i\in
S_{k}}\sum_{1\leq r\neq s\leq
N_{i}}\Bigl{(}\frac{1}{n_{k}\bar{N}_{k}}-\frac{1}{n\bar{N}}\Bigr{)}\frac{N_{i}}{N_{i}-1}Z_{ijr}Z_{ijs},$
$\displaystyle U_{3j}$ $\displaystyle=$
$\displaystyle-\frac{1}{n\bar{N}}\sum_{1\leq k\neq\ell\leq K}\sum_{i\in
S_{k}}\sum_{m\in S_{\ell}}\sum_{r=1}^{N_{i}}\sum_{s=1}^{N_{m}}Z_{ijr}Z_{mjs},$
$\displaystyle U_{4j}$ $\displaystyle=$
$\displaystyle\sum_{k=1}^{K}\sum_{\begin{subarray}{c}i\in S_{k},m\in S_{k}\\\
i\neq
m\end{subarray}}\sum_{r=1}^{N_{i}}\sum_{s=1}^{N_{m}}\Bigl{(}\frac{1}{n_{k}\bar{N}_{k}}-\frac{1}{n\bar{N}}\Bigr{)}Z_{ijr}Z_{mjs}.$

Then, $T=\rho^{2}+\sum_{\kappa=1}^{4}{\bf 1}_{p}^{\prime}U_{\kappa}$.
Moreover, $\mathbb{E}[U_{\kappa}]={\bf 0}_{p}$ and
$\mathbb{E}[U_{\kappa}U_{\zeta}^{\prime}]={\bf 0}_{p\times p}$ for
$1\leq\kappa\neq\zeta\leq 4$.

###  A.2 The variance of $T$

By Lemma A.1, the four terms $\\{{\bf
1}_{p}^{\prime}U_{\kappa}\\}_{1\leq\kappa\leq 4}$ are uncorrelated with each
other. Therefore,

$\mathrm{Var}(T)=\mathrm{Var}({\bf 1}_{p}^{\prime}U_{1})+\mathrm{Var}({\bf
1}_{p}^{\prime}U_{2})+\mathrm{Var}({\bf
1}_{p}^{\prime}U_{3})+\mathrm{Var}({\bf 1}_{p}^{\prime}U_{4}).$

It suffices to study the variance of each of these four terms.

######  Lemma A.2.

Let $U_{1}$ be the same as in Lemma A.1. Define

$\displaystyle\Theta_{n1}$
$\displaystyle=4\sum_{k=1}^{K}n_{k}\bar{N}_{k}\bigl{\|}\mathrm{diag}(\mu_{k})^{1/2}(\mu_{k}-\mu)\bigr{\|}^{2}$
(A.5) $\displaystyle L_{n}$
$\displaystyle=4\sum_{k=1}^{K}n_{k}\bar{N}_{k}\bigl{\|}\Sigma_{k}^{1/2}(\mu_{k}-\mu)\bigr{\|}^{2}$
(A.6)

Then $\mathrm{Var}({\bf 1}_{p}^{\prime}U_{1})=\Theta_{n1}-L_{n}$. Furthermore,
if $\max_{1\leq k\leq K}\|\mu_{k}\|_{\infty}=o(1)$, then $\mathrm{Var}({\bf
1}_{p}^{\prime}U_{1})=o(\rho^{2})$.

######  Lemma A.3.

Let $U_{2}$ be the same as in Lemma A.1. Define

$\displaystyle\Theta_{n2}$
$\displaystyle=2\sum_{k=1}^{K}\Bigl{(}\frac{1}{n_{k}\bar{N}_{k}}-\frac{1}{n\bar{N}}\Bigr{)}^{2}\sum_{i\in
S_{k}}\frac{N_{i}^{3}}{N_{i}-1}\|\Omega_{i}\|^{2}$ (A.7) $\displaystyle A_{n}$
$\displaystyle=2\sum_{k=1}^{K}\Bigl{(}\frac{1}{n_{k}\bar{N}_{k}}-\frac{1}{n\bar{N}}\Bigr{)}^{2}\sum_{i\in
S_{k}}\frac{N_{i}^{3}}{N_{i}-1}\|\Omega_{i}\|_{3}^{3}$ (A.8)

Then

$\Theta_{n2}-A_{n}\leq\mathrm{Var}({\bf 1}_{p}^{\prime}U_{2})\leq\Theta_{n2}.$

Furthermore, if

$\displaystyle\max_{1\leq k\leq K}\big{\\{}\frac{\sum_{i\in
S_{k}}N^{2}_{i}\|\Omega_{i}\|_{3}^{3}}{\sum_{i\in
S_{k}}N_{i}^{2}\|\Omega_{i}\|^{2}}\bigr{\\}}=o(1),$ (A.9)

then $\mathrm{Var}({\bf 1}_{p}^{\prime}U_{2})=[1+o(1)]\cdot\Theta_{n2}$.

######  Lemma A.4.

Let $U_{3}$ be the same as in Lemma A.1. Define

$\displaystyle\Theta_{n3}$
$\displaystyle=\frac{2}{n^{2}\bar{N}^{2}}\sum_{k\neq\ell}\sum_{i\in
S_{k}}\sum_{m\in S_{\ell}}\sum_{j}N_{i}N_{m}\Omega_{ij}\Omega_{mj}$ (A.10)
$\displaystyle B_{n}$
$\displaystyle=2\sum_{k\neq\ell}\frac{n_{k}n_{\ell}\bar{N}_{k}\bar{N}_{\ell}}{n^{2}\bar{N}^{2}}{\bf
1}_{p}^{\prime}(\Sigma_{k}\circ\Sigma_{\ell}){\bf 1}_{p}$ (A.11)

Then

$\Theta_{n3}-B_{n}\leq\mathrm{Var}({\bf
1}_{p}^{\prime}U_{3})\leq\Theta_{n3}+B_{n}.$

######  Lemma A.5.

Let $U_{4}$ be the same as in Lemma A.1. Define

$\displaystyle\Theta_{n4}$
$\displaystyle=2\sum_{k=1}^{K}\sum_{\begin{subarray}{c}i\in S_{k},m\in
S_{k}\\\ i\neq
m\end{subarray}}\sum_{j}\Bigl{(}\frac{1}{n_{k}\bar{N}_{k}}-\frac{1}{n\bar{N}}\Bigr{)}^{2}N_{i}N_{m}\Omega_{ij}\Omega_{mj}.$
(A.12) $\displaystyle E_{n}$
$\displaystyle=2\sum_{k}\sum_{\begin{subarray}{c}i\in S_{k},m\in S_{k},\\\
i\neq m\end{subarray}}\sum_{1\leq j,j^{\prime}\leq
p}\Bigl{(}\frac{1}{n_{k}\bar{N}_{k}}-\frac{1}{n\bar{N}}\Bigr{)}^{2}N_{i}N_{m}\Omega_{ij}\Omega_{ij^{\prime}}\Omega_{mj}\Omega_{mj^{\prime}}$
(A.13)

Then

$\Theta_{n4}-E_{n}\leq\mathrm{Var}({\bf
1}_{p}^{\prime}U_{4})\leq\Theta_{n4}+E_{n}$

.

Using Lemmas A.2-A.5, we derive regularity conditions such that the first term
in $\mathrm{Var}({\bf 1}_{p}^{\prime}U_{\kappa})$ is the dominating term.
Observe that $\Theta_{n}=\Theta_{n1}+\Theta_{n2}+\Theta_{n3}+\Theta_{n4}$,
where the quantity $\Theta_{n}$ is defined in (2.6). The following
intermediate result is useful.

######  Lemma A.6.

Suppose that (3.1) holds. Then

$\displaystyle\Theta_{n2}+\Theta_{n3}+\Theta_{n4}\asymp\sum_{k}\|\mu_{k}\|^{2}.$
(A.14)

Moreover, under the null hypothesis, $\Theta_{n}\asymp K\|\mu\|^{2}$.

The next result is useful in proving that our variance estimator $V$ is
asymptotically unbiased.

######  Lemma A.7.

Suppose that (3.1) holds, and recall the definition of $\Theta_{n}$ in (2.6).
Define

$\displaystyle\beta_{n}=\frac{\max\bigg{\\{}\sum_{k}\sum_{i\in
S_{k}}\frac{N^{2}_{i}}{n_{k}^{2}\bar{N}_{k}^{2}}\|\Omega_{i}\|_{3}^{3}\,,\,\,\sum_{k}\|\Sigma_{k}\|_{F}^{2}\bigg{\\}}}{K\|\mu\|^{2}}.$
(A.15)

If $\beta_{n}=o(1)$, then under the null hypothesis,
$\mathrm{Var}(T)=[1+o(1)]\cdot\Theta_{n}$.

We also study the case of $K=2$ more explicitly. In the lemmas below we use
the notation from Section 3.4. First we have an intermediate result analogous
to Lemma A.6 that holds under weaker conditions.

######  Lemma A.8.

Consider $K=2$ and suppose that $\min N_{i}\geq 2$, $\min M_{i}\geq 2$ Then

$\displaystyle\Theta_{n2}+\Theta_{n3}+\Theta_{n4}\asymp\bigg{\|}\frac{m\bar{M}}{n\bar{N}+m\bar{M}}\eta+\frac{n\bar{N}}{n\bar{N}+m\bar{M}}\theta\bigg{\|}^{2}.$

Moreover, under the null hypothesis, $\Theta_{n}\asymp\|\mu\|^{2}$.

The next result is a version of Lemma A.7 for the case $K=2$ that holds under
weaker conditions.

######  Lemma A.9.

Suppose that $\min_{i}N_{i}\geq 2$ and $\min_{i}M_{i}\geq 2$. Define

$\displaystyle\beta_{n}^{(2)}=\frac{\max\bigg{\\{}\sum_{i}N_{i}^{2}\|\Omega_{i}\|^{3},\,\,\sum_{i}M_{i}^{2}\|\Gamma_{i}\|^{3}\,,\,\,\|\Sigma_{1}\|_{F}^{2}+\|\Sigma_{2}\|_{F}^{2}\bigg{\\}}}{\|\mu\|^{2}}.$
(A.16)

If $\beta_{n}^{(2)}=o(1)$, then under the null hypothesis,
$\mathrm{Var}(T)=[1+o(1)]\cdot\Theta_{n}$.

###  A.3 The decomposition of $V$

######  Lemma A.10.

Let $\\{Z_{ir}\\}_{1\leq i\leq n,1\leq r\leq N_{i}}$ be as in (A.4). Recall
that

$\displaystyle V$ $\displaystyle=2\sum_{k=1}^{K}\sum_{i\in
S_{k}}\sum_{j=1}^{p}\Bigl{(}\frac{1}{n_{k}\bar{N}_{k}}-\frac{1}{n\bar{N}}\Bigr{)}^{2}\biggl{[}\frac{N_{i}X_{ij}^{2}}{N_{i}-1}-\frac{N_{i}X_{ij}(N_{i}-X_{ij})}{(N_{i}-1)^{2}}\biggr{]}$
(A.17) $\displaystyle+\frac{2}{n^{2}\bar{N}^{2}}\sum_{1\leq k\neq\ell\leq
K}\sum_{i\in S_{k}}\sum_{m\in
S_{\ell}}\sum_{j=1}^{p}X_{ij}X_{mj}+2\sum_{k=1}^{K}\sum_{\begin{subarray}{c}i\in
S_{k},m\in S_{k},\\\ i\neq
m\end{subarray}}\sum_{j=1}^{p}\Bigl{(}\frac{1}{n_{k}\bar{N}_{k}}-\frac{1}{n\bar{N}}\Bigr{)}^{2}X_{ij}X_{mj}.$

Define

$\displaystyle\theta_{i}$
$\displaystyle=\big{(}\frac{1}{n_{k}\bar{N}_{k}}-\frac{1}{n\bar{N}})^{2}\frac{N_{i}^{3}}{N_{i}-1}\quad\text{for
}i\in S_{k}\,\,,\quad\text{and let}\,\,$ $\displaystyle\alpha_{im}$
$\displaystyle=\begin{cases}\frac{2}{n^{2}\bar{N}^{2}}&\quad\text{ if }i\in
S_{k},m\in S_{\ell},k\neq\ell\\\
2\big{(}\frac{1}{n_{k}\bar{N}_{k}}-\frac{1}{n\bar{N}})^{2}&\quad\text{ if
}i,m\in S_{k}\end{cases}$

If we let

$\displaystyle A_{1}$
$\displaystyle=\sum_{i}\sum_{r=1}^{N_{i}}\sum_{j}\big{[}\frac{4\theta_{i}\Omega_{ij}}{N_{i}}+\sum_{m\in[n]\backslash\\{i\\}}2\alpha_{im}N_{m}\Omega_{mj}\big{]}Z_{ijr},$
(A.18) $\displaystyle A_{2}$ $\displaystyle=\sum_{i}\sum_{r\neq
s\in[N_{i}]}\frac{2\theta_{i}}{N_{i}(N_{i}-1)}\big{(}\sum_{j}Z_{ijr}Z_{ijs}\big{)}$
(A.19) $\displaystyle A_{3}$ $\displaystyle=\sum_{i\neq
m}\sum_{r=1}^{N_{i}}\sum_{s=1}^{N_{m}}\alpha_{im}\big{(}\sum_{j}Z_{ijr}Z_{mjs}\big{)},$
(A.20)

then these terms are mean zero, are mutually uncorrelated, and satisfy

$\displaystyle V=A_{1}+A_{2}+A_{3}+\Theta_{n2}+\Theta_{n3}+\Theta_{n4}.$
(A.21)

###  A.4 Properties of $V$

First we control the variance of $V$.

######  Lemma A.11.

Let $A_{1},A_{2},$ and $A_{3}$ be defined as in Lemma A.10. Then

$\displaystyle\mathrm{Var}(A_{1})$
$\displaystyle\lesssim\frac{1}{n\bar{N}}\|\mu\|_{3}^{3}+\sum_{k}\frac{\|\mu_{k}\|_{3}^{3}}{n_{k}\bar{N}_{k}}\lesssim\sum_{k}\frac{\|\mu_{k}\|_{3}^{3}}{n_{k}\bar{N}_{k}}$
$\displaystyle\mathrm{Var}(A_{2})$ $\displaystyle\lesssim\sum_{k}\sum_{i\in
S_{k}}\frac{N_{i}^{2}\|\Omega_{i}\|_{2}^{2}}{n_{k}^{4}\bar{N}_{k}^{4}}\lesssim\sum_{k}\frac{\|\mu_{k}\|^{2}}{n_{k}^{2}\bar{N}_{k}^{2}}$
$\displaystyle\mathrm{Var}(A_{3})$
$\displaystyle\lesssim\sum_{k}\frac{\|\mu_{k}\|^{2}}{n_{k}^{2}\bar{N}_{k}^{2}}+\frac{1}{n^{2}\bar{N}^{2}}\|\mu\|^{2}\lesssim\sum_{k}\frac{\|\mu_{k}\|^{2}}{n_{k}^{2}\bar{N}_{k}^{2}}.$

Next we show consistency of $V$ under the null, which is crucial in properly
standardizing our test statistic and establishing asymptotic normality.

######  Proposition A.1.

Recall the definition of $\beta_{n}$ in (A.15). Suppose that $\beta_{n}=o(1)$
and that the condition (3.1) holds. If under the null hypothesis we have

$\displaystyle K^{2}\|\mu\|^{4}$
$\displaystyle\gg\sum_{k}\frac{\|\mu\|^{2}}{n_{k}^{2}\bar{N}_{k}^{2}}\vee\sum_{k}\frac{\|\mu\|_{3}^{3}}{n_{k}\bar{N}_{k}},$
(A.22)

then $V/\mathrm{Var}{T}\to 1$ in probability.

To later control the type II error, we must also show that $V$ does not
dominate the true variance under the alternative. We first state an
intermediate result that is useful throughout.

######  Lemma A.12.

Suppose that, under either the null or alternative,
$\max_{i}\|\Omega_{i}\|_{\infty}\leq 1-c_{0}$ holds for an absolute constant
$c_{0}>0$. Then

$\displaystyle\mathrm{Var}(T)\gtrsim\Theta_{n2}+\Theta_{n3}+\Theta_{n4}.$
(A.23)

######  Proposition A.2.

Suppose that under the alternative (3.1) holds and

$\displaystyle\big{(}\sum_{k}\|\mu_{k}\|^{2}\big{)}^{2}$
$\displaystyle\gg\sum_{k}\frac{\|\mu_{k}\|^{2}}{n_{k}^{2}\bar{N}_{k}^{2}}\vee\sum_{k}\frac{\|\mu_{k}\|_{3}^{3}}{n_{k}\bar{N}_{k}}.$
(A.24)

Then $V=O_{\mathbb{P}}(\mathrm{Var}(T))$ under the alternative.

We also require versions of Proposition A.1 and Proposition A.2 that hold
under weaker conditions in the special case $K=2$. We omit the proofs as they
are similar. Below we use the notation of Section 3.4.

######  Proposition A.3.

Suppose that $K=2$ and recall the definition of $\beta_{n}^{(2)}$ in A.16.
Suppose that $\beta_{n}^{(2)}=o(1)$, $\min_{i}N_{i}\geq 2,\min_{i}M_{i}\geq
2$, and $\max_{i}\|\Omega_{i}\|_{\infty}\leq
1-c_{0},\max_{i}\|\Gamma_{i}\|_{\infty}\leq 1-c_{0}$. If under the null
hypothesis

$\displaystyle\|\mu\|^{4}\gg\max\Big{\\{}\,\big{(}\frac{\|\mu\|_{2}^{2}}{n^{2}\bar{N}^{2}}+\frac{\|\mu\|_{2}^{2}}{m^{2}\bar{M}_{2}^{2}}\big{)},\,\big{(}\frac{\|\mu\|_{3}^{3}}{n\bar{N}}+\frac{\|\mu\|_{3}^{3}}{m\bar{M}}\big{)}\Big{\\}},$
(A.25)

then $V/\mathrm{Var}(T)\to 1$ in probability.

Under the alternative we have the following.

######  Proposition A.4.

Suppose that $K=2$, $\min_{i}N_{i}\geq 2,\min_{i}M_{i}\geq 2$, and
$\max_{i}\|\Omega_{i}\|_{\infty}\leq
1-c_{0},\max_{i}\|\Gamma_{i}\|_{\infty}\leq 1-c_{0}$. If under the alternative

$\displaystyle\bigg{\|}\frac{m\bar{M}}{n\bar{N}+m\bar{M}}\eta+\frac{n\bar{N}}{n\bar{N}+m\bar{M}}\theta\bigg{\|}^{4}\gg\max\Big{\\{}\,\big{(}\frac{\|\eta\|_{2}^{2}}{n^{2}\bar{N}^{2}}+\frac{\|\theta\|_{2}^{2}}{m^{2}\bar{M}_{2}^{2}}\big{)},\,\big{(}\frac{\|\eta\|_{3}^{3}}{n\bar{N}}+\frac{\|\theta\|_{3}^{3}}{m\bar{M}}\big{)}\Big{\\}},$
(A.26)

then $V=O_{\mathbb{P}}(\mathrm{Var}(T))$.

In the setting of $K=n$ and utilize the variance estimator $V^{*}$. The next
results capture the behavior of $V^{*}$ under the null and alternative. The
proofs are given later in this section.

######  Proposition A.5.

Define

$\displaystyle\beta_{n}^{(n)}=\frac{\sum_{i}\|\Omega_{i}\|^{3}}{n\|\mu\|^{2}}.$
(A.27)

Suppose that (3.1) holds, $\beta_{n}^{(n)}=o(1)$, and

$\displaystyle
n^{2}\|\mu\|^{4}\gg\sum_{i}\frac{\|\mu\|^{2}}{N_{i}^{2}}\vee\sum_{i}\frac{\|\mu\|_{3}^{3}}{N_{i}}.$
(A.28)

Then $V^{*}/\mathrm{Var}(T)\to 1$ in probability as $n\to\infty$.

######  Proposition A.6.

Suppose that under the alternative (3.1) holds and

$\displaystyle\big{(}\sum_{i}\|\Omega_{i}\|^{2}\big{)}^{2}\gg\sum_{i}\frac{\|\Omega_{i}\|^{2}}{N_{i}^{2}}\vee\sum_{i}\frac{\|\Omega_{i}\|_{3}^{3}}{N_{i}}.$
(A.29)

Then $V^{*}=O_{\mathbb{P}}(\mathrm{Var}(T))$ under the alternative.

###  A.5 Proof of Lemma A.1

We first show that $\mathbb{E}[U_{\kappa}]={\bf 0}_{p}$ and
$\mathbb{E}[U_{\kappa}U_{\zeta}^{\prime}]={\bf 0}_{p\times p}$ for
$\kappa\neq\zeta$. Note that $\\{Z_{ir}\\}_{1\leq i\leq n,1\leq r\leq N_{i}}$
are independent mean-zero random vectors. It follows that each $U_{\kappa}$ is
a mean-zero random vector. We then compute $\mathbb{E}[U_{\kappa
j_{1}}U_{\zeta j_{2}}]$ for $\kappa\neq\zeta$ and all $1\leq j_{1},j_{2}\leq
p$. By direct calculations,

$\mathbb{E}[U_{1j}U_{2j_{2}}]=2\sum_{(k,i,r,s)}\sum_{(k^{\prime},i^{\prime},r^{\prime})}\Bigl{(}\frac{1}{n_{k}\bar{N}_{k}}-\frac{1}{n\bar{N}}\Bigr{)}(\mu_{k^{\prime}j}-\mu_{j})\frac{N_{i}}{N_{i}-1}\mathbb{E}[Z_{ij_{2}r}Z_{ij_{2}s}Z_{i^{\prime}j_{1}r^{\prime}}].$

If $i^{\prime}\neq i$, or if $i^{\prime}=i$ and $r^{\prime}\notin\\{r,s\\}$,
then $Z_{i^{\prime}j_{1}r^{\prime}}$ is independent of
$Z_{ij_{2}r}Z_{ij_{2}s}$, and it follows that
$\mathbb{E}[Z_{ij_{2}r}Z_{ij_{2}s}Z_{i^{\prime}j_{1}r^{\prime}}]=0$. If
$i^{\prime}=i$ and $r=r^{\prime}$, then
$\mathbb{E}[Z_{ij_{2}r}Z_{ij_{2}s}Z_{i^{\prime}j_{1}r^{\prime}}]=\mathbb{E}[Z_{ij_{2}r}Z_{ij_{1}r}]\cdot\mathbb{E}[Z_{ij_{2}s}]$;
since $r\neq s$, we also have
$\mathbb{E}[Z_{ij_{2}r}Z_{ij_{2}s}Z_{i^{\prime}j_{1}r^{\prime}}]=0$. This
proves $\mathbb{E}[U_{1j}U_{2j_{*}}]=0$. Since this holds for all $1\leq
j_{1},j_{2}\leq p$, we immediately have

$\mathbb{E}[U_{1}U_{2}^{\prime}]={\bf 0}_{p\times p}.$

We can similarly show that $\mathbb{E}[U_{\kappa}U_{\zeta}^{\prime}]={\bf
0}_{p\times p}$, for other $\kappa\neq\zeta$. The proof is omitted.

It remains to prove the desirable decomposition of $T$. Recall that
$T=\sum_{j=1}^{p}T_{j}$. Write $\rho^{2}=\sum_{j=1}^{p}\rho_{j}^{2}$, where
$\rho_{j}^{2}=2\sum_{k=1}^{K}n_{k}\bar{N}_{k}(\mu_{kj}-\mu_{j})^{2}$. It
suffices to show that

$T_{j}=\rho_{j}^{2}+U_{1j}+U_{2j}+U_{3j}+U_{4j},\qquad\mbox{for all }1\leq
j\leq p.$ (A.30)

To prove (A.30), we need some preparation. Define

$Y_{ij}:=\frac{X_{ij}}{N_{i}}-\Omega_{ij}=\frac{1}{N_{i}}\sum_{r=1}^{N_{i}}Z_{ijr},\qquad
Q_{ij}:=Y_{ij}^{2}-\mathbb{E}Y^{2}_{ij}=Y_{ij}^{2}-\frac{\Omega_{ij}(1-\Omega_{ij})}{N_{i}}.$
(A.31)

With these notations, $X_{ij}=N_{i}(\Omega_{ij}+Y_{ij})$ and
$N_{i}Y_{ij}^{2}=N_{i}Q_{ij}+\Omega_{ij}(1-\Omega_{ij})$. Moreover, we can use
(A.31) to re-write $Q_{ij}$ as a function of $\\{Z_{ijr}\\}_{1\leq r\leq
N_{i}}$ as follows:

$Q_{ij}=\frac{1}{N^{2}_{i}}\sum_{r=1}^{N_{i}}[Z_{ijr}^{2}-\Omega_{ij}(1-\Omega_{ij})]+\frac{1}{N^{2}_{i}}\sum_{1\leq
r\neq s\leq N_{i}}Z_{ijr}Z_{ijs}.$

Note that $Z_{ijr}=B_{ijr}-\Omega_{ij}$, where $B_{ijr}$ can only take values
in $\\{0,1\\}$. Hence, $(Z_{ijr}+\Omega_{ij})^{2}=(Z_{ijr}+\Omega_{ij})$
always holds. Re-arranging the terms gives
$Z^{2}_{ijr}-\Omega_{ij}(1-\Omega_{ij})=(1-2\Omega_{ij})Z_{ijr}$. It follows
that

$Q_{ij}=(1-2\Omega_{ij})\frac{Y_{ij}}{N_{i}}+\frac{1}{N^{2}_{i}}\sum_{1\leq
r\neq s\leq N_{i}}Z_{ijr}Z_{ijs}.$ (A.32)

This is a useful equality which we will use in the proof below.

We now show (A.30). Fix $j$ and write $T_{j}=R_{j}-D_{j}$, where

$R_{j}=\sum_{k=1}^{K}n_{k}\bar{N}_{k}(\hat{\mu}_{kj}-\hat{\mu}_{j})^{2},\quad\mbox{and}\quad
D_{j}=\sum_{k=1}^{K}\sum_{i\in
S_{k}}\xi_{k}\frac{X_{ij}(N_{i}-X_{ij})}{n_{k}\bar{N}_{k}(N_{i}-1)},\quad\mbox{with
}\xi_{k}=1-\frac{n_{k}\bar{N}_{k}}{n\bar{N}}$

First, we study $D_{j}$. Note that
$X_{ij}(N_{ij}-X_{ij})=N^{2}_{i}(\Omega_{ij}+Y_{ij})(1-\Omega_{ij}-Y_{ij})=N^{2}_{i}\Omega_{ij}(1-\Omega_{ij})-N^{2}_{i}Y_{ij}^{2}+N_{i}^{2}(1-2\Omega_{ij})Y_{ij}$,
where $Y_{ij}^{2}=Q_{ij}+N_{i}^{-1}\Omega_{ij}(1-\Omega_{ij})$. It follows
that

$\frac{X_{ij}(N_{ij}-X_{ij})}{N_{i}(N_{i}-1)}=\Omega_{ij}(1-\Omega_{ij})-\frac{N_{i}Q_{ij}}{N_{i}-1}+\frac{N_{i}}{N_{i}-1}(1-2\Omega_{ij})Y_{ij}.$

We apply (A.32) to get

$\frac{X_{ij}(N_{ij}-X_{ij})}{N_{i}(N_{i}-1)}=\Omega_{ij}(1-\Omega_{ij})+(1-2\Omega_{ij})Y_{ij}-\frac{1}{N_{i}(N_{i}-1)}\sum_{1\leq
r\neq s\leq N_{i}}Z_{ijr}Z_{ijs}.$ (A.33)

It follows that

$\displaystyle D_{j}$ $\displaystyle=\sum_{k=1}^{K}\sum_{i\in
S_{k}}\frac{\xi_{k}N_{i}}{n_{k}\bar{N}_{k}}\Omega_{ij}(1-\Omega_{ij})+\sum_{k=1}^{K}\sum_{i\in
S_{k}}\frac{\xi_{k}N_{i}}{n_{k}\bar{N}_{k}}(1-2\Omega_{ij})Y_{ij}$ (A.34)
$\displaystyle\qquad-\sum_{k=1}^{K}\sum_{i\in
S_{k}}\frac{\xi_{k}}{n_{k}\bar{N}_{k}(N_{i}-1)}\sum_{1\leq r\neq s\leq
N_{i}}Z_{ijr}Z_{ijs}.$ (A.35)

Next, we study $R_{j}$. Note that
$n_{k}\bar{N}_{k}(\hat{\mu}_{kj}-\hat{\mu}_{j})=\sum_{i\in
S_{k}}(X_{ij}-\bar{N}_{k}\hat{\mu}_{j})$. It follows that

$R_{j}=\sum_{k=1}^{K}\frac{1}{n_{k}\bar{N}_{k}}\biggl{[}\sum_{i\in
S_{k}}(X_{ij}-\bar{N}_{k}\hat{\mu}_{j})\biggr{]}^{2}.$

Recall that $X_{ij}=N_{i}(\Omega_{ij}+Y_{ij})$. By direct calculations,
$\sum_{i\in S_{k}}X_{ij}=n_{k}\bar{N}_{k}\mu_{kj}+\sum_{i\in
S_{k}}N_{i}Y_{ij}$, and
$\hat{\mu}_{j}=\mu_{j}+(n\bar{N})^{-1}\sum_{m=1}^{n}N_{m}Y_{mj}$. We then have
the following decomposition:

$\displaystyle\sum_{i\in S_{k}}(X_{ij}-\bar{N}_{k}\hat{\mu}_{j})$
$\displaystyle=n_{k}\bar{N}_{k}(\mu_{kj}-\mu_{j})+\sum_{i\in
S_{k}}N_{i}Y_{ij}-\frac{n_{k}\bar{N}_{k}}{n\bar{N}}\Bigl{(}\sum_{m=1}^{n}N_{m}Y_{mj}\Bigr{)}.$

Using this decomposition, we can expand $[\sum_{i\in
S_{k}}(X_{ij}-\bar{N}_{k}\hat{\mu}_{j})]^{2}$ to a total of 6 terms, where 3
are quadratic terms and 3 are cross terms. It yields a decomposition of
$R_{j}$ into 6 terms:

$\displaystyle R_{j}$
$\displaystyle=\sum_{k=1}^{K}n_{k}\bar{N}_{k}(\mu_{kj}-\mu_{j})^{2}+\sum_{k=1}^{K}\frac{1}{n_{k}\bar{N}_{k}}\Bigl{(}\sum_{i\in
S_{k}}N_{i}Y_{ij}\Bigr{)}^{2}+\sum_{k=1}^{K}\frac{n_{k}\bar{N}_{k}}{n^{2}\bar{N}^{2}}\Bigl{(}\sum_{m=1}^{n}N_{m}Y_{mj}\Bigr{)}^{2}$
(A.36)
$\displaystyle\qquad+2\sum_{k=1}^{K}(\mu_{kj}-\mu_{j})\Bigl{(}\sum_{i\in
S_{k}}N_{i}Y_{ij}\Bigr{)}-2\sum_{k=1}^{K}\frac{n_{k}\bar{N}_{k}}{n\bar{N}}(\mu_{kj}-\mu_{j})\Bigl{(}\sum_{m=1}^{n}N_{m}Y_{mj}\Bigr{)}$
(A.37) $\displaystyle\qquad-\frac{2}{n\bar{N}}\sum_{k=1}^{K}\Bigl{(}\sum_{i\in
S_{k}}N_{i}Y_{ij}\Bigr{)}\Bigl{(}\sum_{m=1}^{n}N_{m}Y_{mj}\Bigr{)}$ (A.38)
$\displaystyle\equiv I_{1}+I_{2}+I_{3}+I_{4}+I_{5}+I_{6}.$ (A.39)

By definition, $\sum_{k=1}^{K}n_{k}\bar{N}_{k}=n\bar{N}$ and
$\sum_{k=1}^{K}n_{k}\bar{N}_{k}\mu_{kj}=n\bar{N}\mu_{j}$. It follows that

$I_{3}=\frac{1}{n\bar{N}}\Bigl{(}\sum_{m=1}^{n}N_{m}Y_{mj}\Bigr{)}^{2},\qquad
I_{5}=0,\qquad
I_{6}=-\frac{2}{n\bar{N}}\Bigl{(}\sum_{m=1}^{n}N_{m}Y_{mj}\Bigr{)}^{2}=-2I_{3}.$

It follows that

$R_{j}=I_{1}+I_{2}-I_{3}+I_{4}.$ (A.40)

We further simplify $I_{3}$. Recall that
$\xi_{k}=1-(n\bar{N})^{-1}n_{k}\bar{N}_{k}$. By direct calculations,

$\displaystyle I_{3}$
$\displaystyle=\frac{1}{n\bar{N}}\Bigl{(}\sum_{m=1}^{n}N_{m}Y_{mj}\Bigr{)}^{2}=\frac{1}{n\bar{N}}\biggl{[}\sum_{k=1}^{K}\Bigl{(}\sum_{i\in
S_{k}}N_{i}Y_{ij}\Bigr{)}\biggr{]}^{2}$ (A.41)
$\displaystyle=\frac{1}{n\bar{N}}\sum_{k=1}^{K}\Bigl{(}\sum_{i\in
S_{k}}N_{i}Y_{ij}\Bigr{)}^{2}+\frac{1}{n\bar{N}}\sum_{1\leq k\neq\ell\leq
K}\Bigl{(}\sum_{i\in S_{k}}N_{i}Y_{ij}\Bigr{)}\Bigl{(}\sum_{m\in
S_{\ell}}N_{m}Y_{mj}\Bigr{)}$ (A.42)
$\displaystyle=\sum_{k=1}^{K}(1-\xi_{k})\frac{1}{n_{k}\bar{N}_{k}}\Bigl{(}\sum_{i\in
S_{k}}N_{i}Y_{ij}\Bigr{)}^{2}+\underbrace{\frac{1}{n\bar{N}}\sum_{k\neq\ell}\sum_{i\in
S_{k}}\sum_{m\in S_{\ell}}N_{i}N_{m}Y_{ij}Y_{mj}}_{J_{1}}$ (A.43)
$\displaystyle=I_{2}-\sum_{k=1}^{K}\sum_{i\in
S_{k}}\frac{\xi_{k}}{n_{k}\bar{N}_{k}}\Bigl{(}\sum_{i\in
S_{k}}N_{i}Y_{ij}\Bigr{)}^{2}+J_{1}$ (A.44)
$\displaystyle=I_{2}+J_{1}-\sum_{k=1}^{K}\frac{\xi_{k}}{n_{k}\bar{N}_{k}}\Bigl{(}\sum_{i\in
S_{k}}N_{i}^{2}Y_{ij}^{2}\Bigr{)}-\underbrace{\sum_{k=1}^{K}\frac{\xi_{k}}{n_{k}\bar{N}_{k}}\sum_{\begin{subarray}{c}i\in
S_{k},m\in S_{k}\\\ i\neq m\end{subarray}}N_{i}N_{m}Y_{ij}Y_{mj}}_{J_{2}}.$
(A.45)

By (A.31), $N_{i}Y_{ij}^{2}=N_{i}Q_{i}+\Omega_{ij}(1-\Omega_{ij})$. We further
apply (A.32) to get

$N_{i}^{2}Y_{ij}^{2}=N_{i}(1-2\Omega_{ij})Y_{ij}+\sum_{1\leq r\neq s\leq
N_{i}}Z_{ijr}Z_{ijs}+N_{i}\Omega_{ij}(1-\Omega_{ij}).$

It follows that

$\displaystyle\sum_{k=1}^{K}\frac{\xi_{k}}{n_{k}\bar{N}_{k}}$
$\displaystyle\Bigl{(}\sum_{i\in
S_{k}}N_{i}^{2}Y_{ij}^{2}\Bigr{)}=\underbrace{\sum_{k=1}^{K}\sum_{i\in
S_{k}}\frac{\xi_{k}N_{i}}{n_{k}\bar{N}_{k}}(1-2\Omega_{ij})Y_{ij}}_{J_{3}}$
(A.46) $\displaystyle+\underbrace{\sum_{k=1}^{K}\sum_{i\in
S_{k}}\frac{\xi_{k}}{n_{k}\bar{N}_{k}}\sum_{r\neq
s}Z_{ijr}Z_{ijs}}_{J_{4}}+\underbrace{\sum_{k=1}^{K}\sum_{i\in
S_{k}}\frac{\xi_{k}N_{i}}{n_{k}\bar{N}_{k}}\Omega_{ij}(1-\Omega_{ij})}_{J_{5}}.$
(A.47)

We plug (A.46) into (A.41) to get $I_{3}=I_{2}+J_{1}-J_{2}-J_{3}-J_{4}-J_{5}$.
Further plugging $I_{3}$ into the expression of $R_{j}$ in (A.40), we have

$\displaystyle R_{j}$
$\displaystyle=I_{1}+I_{4}-J_{1}+J_{2}+J_{3}+J_{4}+J_{5},$ (A.48)

where $I_{1}$ and $I_{4}$ are defined in (A.36), $J_{1}$-$J_{2}$ are defined
in (A.41), and $J_{3}$-$J_{5}$ are defined in (A.46).

Finally, we combine the expressions of $D_{j}$ and $R_{j}$. By (A.34) and the
definitions of $J_{1}$-$J_{5}$,

$\displaystyle D_{j}$ $\displaystyle=J_{5}+J_{3}-\sum_{k=1}^{K}\sum_{i\in
S_{k}}\frac{\xi_{k}}{n_{k}\bar{N}_{k}(N_{i}-1)}\sum_{r\neq s}Z_{ijr}Z_{ijs}$
$\displaystyle=J_{5}+J_{3}+J_{4}-\underbrace{\sum_{k=1}^{K}\sum_{i\in
S_{k}}\frac{\xi_{k}N_{i}}{n_{k}\bar{N}_{k}(N_{i}-1)}\sum_{r\neq
s}Z_{ijr}Z_{ijs}}_{J_{6}}.$

Combining it with (A.48) gives
$T_{j}=R_{j}-D_{j}=I_{1}+I_{4}-J_{1}+J_{2}+J_{6}$. We further plug in the
definition of each term. It follows that

$\displaystyle T_{j}$
$\displaystyle=\sum_{k=1}^{K}n_{k}\bar{N}_{k}(\mu_{kj}-\mu_{j})^{2}+2\sum_{k=1}^{K}\sum_{i\in
S_{k}}(\mu_{kj}-\mu_{j})N_{i}Y_{ij}-\frac{1}{n\bar{N}}\sum_{k\neq\ell}\sum_{i\in
S_{k},m\in S_{\ell}}N_{i}N_{m}Y_{ij}Y_{mj}$ (A.49)
$\displaystyle\qquad+\sum_{k=1}^{K}\sum_{\begin{subarray}{c}i\in S_{k},m\in
S_{k}\\\ i\neq
m\end{subarray}}\frac{\xi_{k}}{n_{k}\bar{N}_{k}}N_{i}N_{m}Y_{ij}Y_{mj}+\sum_{k=1}^{K}\sum_{i\in
S_{k}}\frac{\xi_{k}N_{i}}{n_{k}\bar{N}_{k}(N_{i}-1)}\sum_{r\neq
s}Z_{ijr}Z_{ijs}.$ (A.50)

We plug in $Y_{ij}=N_{i}^{-1}\sum_{r=1}^{N_{i}}Z_{ijr}$ and take a sum of
$1\leq j\leq p$. It gives (A.30) immediately. The proof is now complete. ∎

###  A.6 Proof of Lemma A.2

Recall that $\\{Z_{ir}\\}_{1\leq i\leq n,1\leq r\leq N_{i}}$ are independent
random vectors. Write

${\bf 1}_{p}^{\prime}U_{1}=2\sum_{k=1}^{K}\sum_{i\in
S_{k}}\sum_{r=1}^{N_{i}}(\mu_{k}-\mu)^{\prime}Z_{ir}.$

The covariance matrix of $Z_{ir}$ is
$\mathrm{diag}(\Omega_{i})-\Omega_{i}\Omega_{i}^{\prime}$. It follows that

$\displaystyle\mathrm{Var}({\bf 1}_{p}^{\prime}U_{1})$
$\displaystyle=4\sum_{k=1}^{K}\sum_{i\in
S_{k}}\sum_{r=1}^{N_{i}}(\mu_{k}-\mu)^{\prime}\bigl{[}\mathrm{diag}(\Omega_{i})-\Omega_{i}\Omega_{i}^{\prime}\bigr{]}(\mu_{k}-\mu)$
(A.51)
$\displaystyle=4\sum_{k}(\mu_{k}-\mu)^{\prime}\Bigl{[}\mathrm{diag}\Bigl{(}\sum_{i\in
S_{k}}N_{i}\Omega_{i}\Bigr{)}-\Bigl{(}\sum_{i\in
S_{k}}N_{i}\Omega_{i}\Omega_{i}^{\prime}\Bigr{)}\Bigr{]}(\mu_{k}-\mu)$ (A.52)
$\displaystyle=4\sum_{k}(\mu_{k}-\mu)^{\prime}\Bigl{[}\mathrm{diag}(n_{k}\bar{N}_{k}\mu_{k})-n_{k}\bar{N}_{k}\Sigma_{k}\Bigr{]}(\mu_{k}-\mu)$
(A.53)
$\displaystyle=4\sum_{k}n_{k}\bar{N}_{k}\bigl{\|}\mathrm{diag}(\mu_{k})^{1/2}(\mu_{k}-\mu)\bigr{\|}^{2}-4\sum_{k}n_{k}\bar{N}_{k}\bigl{\|}\Sigma_{k}^{1/2}(\mu_{k}-\mu)\bigr{\|}^{2}.$
(A.54)

This proves the first claim. Furthermore, by (A.51),

$\mathrm{Var}({\bf 1}_{p}^{\prime}U_{1})\leq
4\sum_{k}n_{k}\bar{N}_{k}\bigl{\|}\mathrm{diag}(\mu_{k})^{1/2}(\mu_{k}-\mu)\bigr{\|}^{2}\leq
4\sum_{k}n_{k}\bar{N}_{k}\|\mathrm{diag}(\mu_{k})\|\|\mu_{k}-\mu\|^{2}.$

Note that $\|\mathrm{diag}(\mu_{k})\|=\|\mu_{k}\|_{\infty}$. Therefore, if
$\max_{k}\|\mu_{k}\|_{\infty}=o(1)$, the right hand side above is $o(1)\cdot
4\sum_{k}n_{k}\bar{N}_{k}\|\mu_{k}-\mu\|^{2}=o(\rho^{2})$. This proves the
second claim. ∎

###  A.7 Proof of Lemma A.3

For each $1\leq k\leq K$, define a set of index triplets: ${\cal
M}_{k}=\\{(i,r,s):i\in S_{k},1\leq r<s\leq N_{i}\\}$. Let ${\cal
M}=\cup_{k=1}^{K}{\cal M}_{k}$. Write for short
$\theta_{i}=(\frac{1}{n_{k}\bar{N}_{k}}-\frac{1}{n\bar{N}})^{2}\frac{N_{i}^{3}}{N_{i}-1}$,
for $i\in S_{k}$. It is seen that

${\bf 1}_{p}^{\prime}U_{2}=2\sum_{(i,r,s)\in{\cal
M}}\frac{\sqrt{\theta_{i}}}{\sqrt{N_{i}(N_{i}-1)}}W_{irs},\qquad\mbox{with}\quad
W_{irs}=\sum_{j=1}^{p}Z_{ijr}Z_{ijs}.$

For $W_{irs}$ and $W_{i^{\prime}r^{\prime}s^{\prime}}$, if $i\neq i^{\prime}$,
or if $i=i^{\prime}$ and $\\{r,s\\}\cap\\{r^{\prime},s^{\prime}\\}=\emptyset$,
then these two variables are independent; if $i=i^{\prime}$, $r=r^{\prime}$
and $s\neq s^{\prime}$, then
$\mathbb{E}[W_{irs}W_{irs^{\prime}}]=\sum_{j,j^{\prime}}\mathbb{E}[Z_{ijr}Z_{ijs}Z_{ij^{\prime}r}Z_{ij^{\prime}s^{\prime}}]=\sum_{j,j^{\prime}}\mathbb{E}[Z_{ijr}Z_{ij^{\prime}r}]\cdot\mathbb{E}[Z_{ijs}]\cdot\mathbb{E}[Z_{ij^{\prime}s^{\prime}}]=0$.
Therefore, $\\{W_{irs}\\}_{(i,r,s)\in{\cal M}}$ is a collection of mutually
uncorrelated variables. It follows that

$\mathrm{Var}({\bf 1}_{p}^{\prime}U_{2})=4\sum_{(i,r,s)\in{\cal
M}}\frac{\theta_{i}}{N_{i}(N_{i}-1)}\mathrm{Var}(W_{irs}).$

It remains to calculate the variance of each $W_{irs}$. By direction
calculations,

$\displaystyle\mathrm{Var}(W_{irs})$
$\displaystyle=\sum_{j}\mathbb{E}[Z_{ijr}^{2}Z_{ijs}^{2}]+2\sum_{j<\ell}\mathbb{E}[Z_{ijr}Z_{ijs}Z_{i\ell
r}Z_{i\ell s}]$ (A.55)
$\displaystyle=\sum_{j}[\Omega_{ij}(1-\Omega_{ij})]^{2}+2\sum_{j<\ell}(-\Omega_{ij}\Omega_{i\ell})^{2}$
(A.56)
$\displaystyle=\sum_{j}\Omega_{ij}^{2}-2\sum_{j}\Omega^{3}_{ij}+\Bigl{(}\sum_{j}\Omega^{2}_{ij}\Bigr{)}^{2}$
(A.57)
$\displaystyle=\|\Omega_{i}\|^{2}-2\|\Omega_{i}\|_{3}^{3}+\|\Omega_{i}\|^{4}$
(A.58)

Since $\max_{ij}\Omega_{ij}\leq 1$, we have

$\displaystyle\|\Omega_{i}\|^{2}-\|\Omega_{i}\|_{3}^{3}\leq\mathrm{Var}(W_{irs})\leq\|\Omega_{i}\|^{2}.$

Therefore,

$\displaystyle\mathrm{Var}({\bf 1}_{p}^{\prime}U_{2})$
$\displaystyle=4\sum_{k=1}^{K}\sum_{i\in S_{k}}\sum_{1\leq r<s\leq
N_{i}}\frac{\theta_{i}}{N_{i}(N_{i}-1)}\mathrm{Var}(W_{irs})$
$\displaystyle=2\sum_{k=1}^{K}\sum_{i\in
S_{k}}\theta_{i}\mathrm{Var}(W_{irs})\geq 2\sum_{k=1}^{K}\sum_{i\in
S_{k}}\theta_{i}\big{[}\|\Omega_{i}\|^{2}-\|\Omega_{i}\|_{3}^{3}\big{]}=\Theta_{n2}-A_{n},$

and similarly $\mathrm{Var}({\bf 1}_{p}^{\prime}U_{2})\leq\Theta_{n2}$, which
proves the first claim. To prove the second claim, note that
$\mathrm{Var}({\bf 1}_{p}^{\prime}U_{2})=\Theta_{n2}+O(A_{n})$. By (A.9) and
the assumption $\min N_{i}\geq 2$, we have

$\displaystyle A_{n}$
$\displaystyle\lesssim\sum_{k}\big{(}\frac{1}{n_{k}\bar{N}_{k}}-\frac{1}{n\bar{N}}\big{)}^{2}\sum_{i\in
S_{k}}N_{i}^{2}\|\Omega_{i}\|_{3}^{3}$
$\displaystyle=\sum_{k}\big{(}\frac{1}{n_{k}\bar{N}_{k}}-\frac{1}{n\bar{N}}\big{)}^{2}\cdot
o\bigg{(}\sum_{i\in S_{k}}N_{i}^{2}\|\Omega_{i}\|^{2}\bigg{)}=o(\Theta_{n2}),$

which implies that $\mathrm{Var}({\bf 1}_{p}U_{2})=[1+o(1)]\Theta_{n2}$, as
desired.

∎

###  A.8 Proof of Lemma A.4

For each $1\leq k<\ell\leq K$, define a set of index quadruples: ${\cal
J}_{k\ell}=\\{(i,r,m,s):i\in S_{k},j\in S_{\ell},1\leq r\leq N_{i},1\leq s\leq
N_{m}\\}$. Let ${\cal J}=\cup_{(k,\ell):1\leq k<\ell\leq K}{\cal J}_{k\ell}$.
It is seen that

${\bf 1}_{p}^{\prime}U_{3}=-\frac{2}{n\bar{N}}\sum_{(i,r,m,s)\in{\cal
J}}V_{irms},\qquad\mbox{where}\;\;V_{irms}=\sum_{j=1}^{p}Z_{ijr}Z_{mjs}.$

For $V_{irms}$ and $V_{i^{\prime}r^{\prime}m^{\prime}s^{\prime}}$, if
$\\{(i,r),(m,s)\\}\cap\\{(i^{\prime},r^{\prime}),(m^{\prime},s^{\prime})\\}=\emptyset$,
then the two variables are independent of each other. If
$(i,r)=(i^{\prime},r^{\prime})$ and $(m,s)\neq(m^{\prime},s^{\prime})$, then
$\mathbb{E}[V_{irms}V_{irm^{\prime}s^{\prime}}]=\sum_{j,j^{\prime}}\mathbb{E}[Z_{ijr}Z_{mjs}Z_{ij^{\prime}r}Z_{m^{\prime}j^{\prime}s^{\prime}}]=\sum_{j,j^{\prime}}\mathbb{E}[Z_{ijr}Z_{ij^{\prime}r}]\cdot\mathbb{E}[Z_{mjs}]\cdot\mathbb{E}[Z_{m^{\prime}js^{\prime}}]=0$.
Therefore, the only correlated case is when
$(i,r,m,s)=(i^{\prime},r^{\prime},m^{\prime},s^{\prime})$. This implies that
$\\{V_{irms}\\}_{(i,r,m,s)\in{\cal J}}$ is a collection of mutually
uncorrelated variables. Therefore,

$\mathrm{Var}({\bf
1}_{p}^{\prime}U_{3})=\frac{4}{n^{2}\bar{N}^{2}}\sum_{(i,r,m,s)\in{\cal
J}}\mathrm{Var}(V_{irms}).$

Note that
$\mathrm{Var}(V_{irms})=\mathbb{E}[(\sum_{j}Z_{ijr}Z_{mjs})^{2}]=\sum_{j,j^{\prime}}\mathbb{E}[Z_{ijr}Z_{mjs}Z_{ij^{\prime}r}Z_{mj^{\prime}s}]$;
also, the covariance matrix of $Z_{ir}$ is
$\mathrm{diag}(\Omega_{i})-\Omega_{i}\Omega_{i}^{\prime}$. It follows that

$\displaystyle\mathrm{Var}(V_{irms})$
$\displaystyle=\sum_{j}\mathbb{E}[Z^{2}_{ijr}]\cdot\mathbb{E}[Z^{2}_{mjs}]+\sum_{j\neq
j^{\prime}}\mathbb{E}[Z_{ijr}Z_{ij^{\prime}r}]\cdot\mathbb{E}[Z_{mjs}Z_{mj^{\prime}s}]$
(A.60)
$\displaystyle=\sum_{j}\Omega_{ij}(1-\Omega_{ij})\Omega_{mj}(1-\Omega_{mj})+\sum_{j\neq
j^{\prime}}\Omega_{ij}\Omega_{ij^{\prime}}\Omega_{mj}\Omega_{mj^{\prime}}$
(A.61)
$\displaystyle=\sum_{j}\Omega_{ij}\Omega_{mj}-2\sum_{j}\Omega^{2}_{ij}\Omega^{2}_{mj}+\sum_{j,j^{\prime}}\Omega_{ij}\Omega_{ij^{\prime}}\Omega_{mj}\Omega_{mj^{\prime}}.$
(A.62)

Write for short
$\delta_{im}=-2\sum_{j}\Omega^{2}_{ij}\Omega^{2}_{mj}+\sum_{j,j^{\prime}}\Omega_{ij}\Omega_{ij^{\prime}}\Omega_{mj}\Omega_{mj^{\prime}}$.Combining
the above gives

$\displaystyle\mathrm{Var}$ $\displaystyle({\bf
1}_{p}^{\prime}U_{3})=\frac{4}{n^{2}\bar{N}^{2}}\sum_{k<\ell}\sum_{i\in
S_{k}}\sum_{m\in
S_{\ell}}\sum_{r=1}^{N_{i}}\sum_{s=1}^{N_{m}}\Bigl{(}\sum_{j}\Omega_{ij}\Omega_{mj}+\delta_{im}\Bigr{)}$
(A.63) $\displaystyle=\frac{2}{n^{2}\bar{N}^{2}}\sum_{k\neq\ell}\sum_{i\in
S_{k}}\sum_{m\in
S_{\ell}}\sum_{j}N_{i}N_{m}\Omega_{ij}\Omega_{mj}+\frac{2}{n^{2}\bar{N}^{2}}\sum_{k\neq\ell}\sum_{i\in
S_{k}}\sum_{m\in S_{\ell}}N_{i}N_{m}\delta_{im}.$ (A.64)

It is easy to see that
$|\delta_{im}|\leq\sum_{j,j^{\prime}}\Omega_{ij}\Omega_{ij^{\prime}}\Omega_{mj}\Omega_{mj^{\prime}}$.
Also, by the definition of $\Sigma_{k}$ in (A.2), we have
$\Sigma_{k}(j,j^{\prime})=\frac{1}{n_{k}\bar{N}_{k}}\sum_{i\in
S_{k}}N_{i}\Omega_{ij}\Omega_{ij^{\prime}}$. Using these results, we
immediately have

$\displaystyle\Bigl{|}\frac{2}{n^{2}\bar{N}^{2}}\sum_{k\neq\ell}\sum_{i\in
S_{k}}\sum_{m\in S_{\ell}}N_{i}N_{m}\delta_{im}\Bigr{|}$
$\displaystyle\leq\frac{2}{n^{2}\bar{N}^{2}}\sum_{k\neq\ell}\sum_{i\in
S_{k}}\sum_{m\in
S_{\ell}}\sum_{j,j^{\prime}}N_{i}N_{m}\Omega_{ij}\Omega_{ij^{\prime}}\Omega_{mj}\Omega_{mj^{\prime}}$
(A.65)
$\displaystyle=\frac{2}{n^{2}\bar{N}^{2}}\sum_{j,j^{\prime}}\sum_{k\neq\ell}\Bigl{(}\sum_{i\in
S_{k}}N_{i}\Omega_{ij}\Omega_{ij^{\prime}}\Bigr{)}\Bigl{(}\sum_{m\in
S_{\ell}}N_{i}\Omega_{mj}\Omega_{mj^{\prime}}\Bigr{)}$ (A.66)
$\displaystyle=\frac{2}{n^{2}\bar{N}^{2}}\sum_{j,j^{\prime}}\sum_{k\neq\ell}n_{k}\bar{N}_{k}\Sigma_{k}(j,j^{\prime})\cdot
n_{\ell}\bar{N}_{\ell}\Sigma_{\ell}(j,j^{\prime})$ (A.67)
$\displaystyle=2\sum_{k\neq\ell}\frac{n_{k}n_{\ell}\bar{N}_{k}\bar{N}_{\ell}}{n^{2}\bar{N}^{2}}{\bf
1}_{p}^{\prime}(\Sigma_{k}\circ\Sigma_{\ell}){\bf 1}_{p}=:B_{n}$ (A.68)

as desired.

∎

###  A.9 Proof of Lemma A.5

For $1\leq k\leq K$, define a set of index quadruples: ${\cal
Q}_{k}=\\{(i,r,m,s):i\in S_{k},m\in S_{k},i<m,1\leq r\leq N_{i},1\leq s\leq
N_{m}\\}$. Let ${\cal Q}=\cup_{k=1}^{K}{\cal Q}_{k}$. Write
$\kappa_{im}=(\frac{1}{n_{k}\bar{N}_{k}}-\frac{1}{n\bar{N}})^{2}N_{i}N_{m}$,
for $i\in S_{k}$ and $m\in S_{k}$. It is seen that

${\bf 1}_{p}^{\prime}U_{4}=2\sum_{(i,r,m,s)\in{\cal
Q}}\frac{\sqrt{\kappa_{im}}}{\sqrt{N_{i}N_{m}}}V_{irms},\qquad\mbox{where}\quad
V_{irms}=\sum_{j=1}^{p}Z_{ijr}Z_{mjs}.$

It is not hard to see that $V_{irms}$ and
$V_{i^{\prime}r^{\prime}m^{\prime}s^{\prime}}$ are correlated only if
$(i,r,m,s)=(i^{\prime},r^{\prime},m^{\prime},s^{\prime})$. It follows that

$\mathrm{Var}({\bf 1}_{p}^{\prime}U_{4})=4\sum_{(i,r,m,s)\in{\cal
Q}}\frac{\kappa_{im}}{N_{i}N_{m}}\mathrm{Var}(V_{irms}).$

In the proof of Lemma A.4, we have studied $\mathrm{Var}(V_{irms})$. In
particular, by (A.60), we have

$\mathrm{Var}(V_{irms})=\sum_{j}\Omega_{ij}\Omega_{mj}+\delta_{im},\qquad\mbox{with}\quad|\delta_{im}|\leq\sum_{j,j^{\prime}}\Omega_{ij}\Omega_{ij^{\prime}}\Omega_{mj}\Omega_{mj^{\prime}}.$

Thus

$\displaystyle\mathrm{Var}({\bf 1}_{p}^{\prime}U_{4})$
$\displaystyle=4\sum_{k=1}^{K}\sum_{\begin{subarray}{c}i\in S_{k},m\in
S_{k}\\\
i<m\end{subarray}}\sum_{i=1}^{N_{i}}\sum_{r=1}^{N_{m}}\frac{\kappa_{im}}{N_{i}N_{m}}\mathrm{Var}(V_{irms})$
$\displaystyle=4\sum_{k=1}^{K}\sum_{\begin{subarray}{c}i\in S_{k},m\in
S_{k}\\\
i<m\end{subarray}}\kappa_{im}\Bigl{(}\sum_{j}\Omega_{ij}\Omega_{mj}+\delta_{im}\Bigr{)}$
$\displaystyle=2\sum_{k=1}^{K}\sum_{\begin{subarray}{c}i\in S_{k},m\in
S_{k}\\\ i\neq m\end{subarray}}\sum_{j}\kappa_{im}\Omega_{ij}\Omega_{mj}\pm
2\sum_{k}\sum_{i\neq m\in
S_{k}}\kappa_{im}\sum_{j,j^{\prime}}\Omega_{ij}\Omega_{ij^{\prime}}\Omega_{mj}\Omega_{mj^{\prime}},$
$\displaystyle=\Theta_{n3}\pm E_{n}.$ (A.69)

which proves the lemma.

∎

###  A.10 Proof of Lemma A.6

By assumption (3.1), $N_{i}^{3}/(N_{i}-1)\asymp N_{i}$ and
$\Bigl{(}\frac{1}{n_{k}\bar{N}_{k}}-\frac{1}{n\bar{N}}\Bigr{)}^{2}\asymp\frac{1}{n_{k}^{2}\bar{N}_{k}^{2}}$.
First, observe that

$\displaystyle\Theta_{n2}+\Theta_{n4}$
$\displaystyle=2\sum_{k=1}^{K}\Bigl{(}\frac{1}{n_{k}\bar{N}_{k}}-\frac{1}{n\bar{N}}\Bigr{)}^{2}\sum_{i\in
S_{k}}\frac{N_{i}^{3}}{N_{i}-1}\|\Omega_{i}\|^{2}$
$\displaystyle\quad+2\sum_{k=1}^{K}\sum_{\begin{subarray}{c}i\in S_{k},m\in
S_{k}\\\ i\neq
m\end{subarray}}\sum_{j}\Bigl{(}\frac{1}{n_{k}\bar{N}_{k}}-\frac{1}{n\bar{N}}\Bigr{)}^{2}N_{i}N_{m}\Omega_{ij}\Omega_{mj}$
$\displaystyle\asymp\sum_{k=1}\Bigl{(}\frac{1}{n_{k}\bar{N}_{k}}\Bigr{)}^{2}\sum_{j}\sum_{i,m\in
S_{k}}N_{i}\Omega_{ij}\cdot N_{m}\Omega_{ij}=\sum_{k}\|\mu_{k}\|^{2}.$ (A.70)

Recall the definitions of $\mu_{k}$ and $\mu$ in (A.2)-(A.3). By direct
calculations, we have

$\displaystyle\Theta_{n3}$
$\displaystyle=2\sum_{j}\sum_{k\neq\ell}\Bigl{(}\frac{1}{n\bar{N}}\sum_{i\in
S_{k}}N_{i}\Omega_{ij}\Bigr{)}\Bigl{(}\frac{1}{n\bar{N}}\sum_{m\in
S_{\ell}}N_{m}\Omega_{mj}\Bigr{)}$
$\displaystyle=2\sum_{j}\sum_{k\neq\ell}\frac{n_{k}\bar{N}_{k}}{n\bar{N}}\mu_{kj}\cdot\frac{n_{\ell}\bar{N}_{\ell}}{n\bar{N}}\mu_{\ell
j}$
$\displaystyle=2\sum_{k\neq\ell}\frac{n_{k}n_{\ell}\bar{N}_{k}\bar{N}_{\ell}}{n^{2}\bar{N}^{2}}\cdot\mu_{k}^{\,\,\prime}\,\mu_{\ell}$
$\displaystyle\leq
2\sum_{j}\Bigl{(}\sum_{k}\frac{n_{k}\bar{N}_{k}}{n\bar{N}}\mu_{kj}\Bigr{)}^{2}=2\sum_{j}\mu_{j}^{2}=2\|\mu\|^{2}.$
(A.71)

By Cauchy–Schwarz,

$\displaystyle\|\mu\|^{2}$
$\displaystyle=\sum_{j}\bigg{(}\sum_{k}(\frac{n_{k}\bar{N_{k}}}{n\bar{N}})\mu_{kj}\bigg{)}^{2}$
$\displaystyle\leq\sum_{j}\bigg{(}\sum_{k}(\frac{n_{k}\bar{N_{k}}}{n\bar{N}})^{2}\bigg{)}\cdot\bigg{(}\sum_{k}\mu_{kj}^{2}\bigg{)}$
$\displaystyle\leq\sum_{j}\bigg{(}\sum_{k}(\frac{n_{k}\bar{N_{k}}}{n\bar{N}})\bigg{)}\cdot\bigg{(}\sum_{k}\mu_{kj}^{2}\bigg{)}=\sum_{j}\sum_{k}\mu_{kj}^{2}=\sum_{k}\|\mu_{k}\|^{2}.$
(A.72)

Combining (A.70), (A.71), and (A.72) yields

$\displaystyle
c\big{(}\sum_{k}\|\mu_{k}\|^{2}\big{)}\leq\Theta_{n2}+\Theta_{n3}+\Theta_{n4}\leq
C\big{(}\sum_{k}\|\mu_{k}\|^{2}\big{)},$

for absolute constants $c,C>0$. This completes the proof. ∎

###  A.11 Proof of Lemma A.7

By (3.1), it holds that

$\displaystyle(\frac{1}{n_{k}\bar{N}_{k}}-\frac{1}{n\bar{N}})^{2}\asymp\frac{1}{(n_{k}\bar{N}_{k})^{2}},$
(A.73)

and moreover, for all $i\in\\{1,2,\ldots,n\\}$,

$\displaystyle\frac{N_{i}^{3}}{N_{i}-1}\asymp N_{i}^{2}.$ (A.74)

Recall the definitions of $A_{n},$ $B_{n}$, and $E_{n}$ in (A.8), (A.11), and
(A.13), respectively. Note that these are the remainder terms in Lemmas A.3,
A.4, and A.5, respectively. Under the null hypothesis (recall
$\Theta_{n1}\equiv 0$ under the null),

$\displaystyle\mathrm{Var}(T)=\Theta_{n2}+\Theta_{n3}+\Theta_{n4}+O(A_{n}+B_{n}+E_{n}).$
(A.75)

It holds that

$\displaystyle
A_{n}\leq\sum_{k=1}^{K}\Bigl{(}\frac{1}{n_{k}\bar{N}_{k}}\Bigr{)}^{2}\sum_{i\in
S_{k}}N_{i}^{2}\|\Omega_{i}\|_{3}^{3}.$ (A.76)

Next, by linearity and the definition of $\Sigma_{k},\Sigma$ in (A.2), (A.3),
respectively,

$\displaystyle B_{n}$ $\displaystyle\leq
2\sum_{k,\ell}\frac{n_{k}n_{\ell}\bar{N}_{k}\bar{N}_{\ell}}{n^{2}\bar{N}^{2}}{\bf
1}_{p}^{\prime}(\Sigma_{k}\circ\Sigma_{\ell}){\bf 1}_{p}$ $\displaystyle\leq
2{\bf
1}_{p}^{\prime}\bigg{(}\frac{1}{n\bar{N}}\sum_{k}n_{k}\bar{N}_{k}\Sigma_{k}\bigg{)}\circ\bigg{(}\frac{1}{n\bar{N}}\sum_{\ell}n_{\ell}\bar{N}_{\ell}\Sigma_{k}\ell\bigg{)}{\bf
1}_{p}$ $\displaystyle=2{\bf 1}_{p}^{\prime}(\Sigma\circ\Sigma){\bf
1}_{p}=2\|\Sigma\|_{F}^{2}$

By Cauchy–Schwarz,

$\displaystyle B_{n}$
$\displaystyle\leq\|\Sigma\|_{F}^{2}=\sum_{j,j^{\prime}}\bigg{(}\sum_{k}(\frac{n_{k}\bar{N}_{k}}{n\bar{N}}\Sigma_{k}(j,j^{\prime})\bigg{)}^{2}$
$\displaystyle\leq\sum_{j,j^{\prime}}\bigg{(}\sum_{k}(\frac{n_{k}\bar{N}_{k}}{n\bar{N}})^{2}\bigg{)}\cdot\bigg{(}\sum_{k}\Sigma_{k}(j,j^{\prime})^{2}\bigg{)}$
$\displaystyle\leq\sum_{j,j^{\prime}}\bigg{(}\sum_{k}\frac{n_{k}\bar{N}_{k}}{n\bar{N}}\bigg{)}\cdot\bigg{(}\sum_{k}\Sigma_{k}(j,j^{\prime})^{2}\bigg{)}=\sum_{j,j^{\prime}}\sum_{k}\Sigma_{k}(j,j^{\prime})^{2}=\sum_{k}\|\Sigma_{k}\|_{F}^{2}.$
(A.77)

Next by the definition of $\Sigma_{k}$ in (A.2), we have
$\Sigma_{k}(j,j^{\prime})=\frac{1}{n_{k}\bar{N}_{k}}\sum_{i\in
S_{k}}N_{i}\Omega_{ij}\Omega_{ij^{\prime}}$. It follows that

$\displaystyle E_{n}$
$\displaystyle\leq\sum_{k}\sum_{j,j^{\prime}}\Bigl{(}\frac{1}{n_{k}\bar{N}_{k}}\sum_{i\in
S_{k}}N_{i}\Omega_{ij}\Omega_{ij^{\prime}}\Bigr{)}\Bigl{(}\frac{1}{n_{k}\bar{N}_{k}}\sum_{m\in
S_{k}}N_{m}\Omega_{mj}\Omega_{mj^{\prime}}\Bigr{)}$ (A.78)
$\displaystyle=\sum_{k}\sum_{j,j^{\prime}}\Sigma_{k}^{2}(j,j^{\prime})=\sum_{k}\|\Sigma_{k}\|_{F}^{2}.$
(A.79)

Next, Lemma A.6 implies that

$\displaystyle\Theta_{n2}+\Theta_{n3}+\Theta_{n4}\asymp\sum_{k}\|\mu_{k}\|^{2}=K\|\mu\|^{2},$
(A.80)

where we use that the null hypothesis holds. By assumption of the lemma, we
have

$\beta_{n}=\frac{\max\bigg{\\{}\sum_{k}\sum_{i\in
S_{k}}\frac{N^{2}_{i}}{n_{k}^{2}\bar{N}_{k}^{2}}\|\Omega_{i}\|_{3}^{3}\,,\,\,\sum_{k}\|\Sigma_{k}\|_{F}^{2}\bigg{\\}}}{K\|\mu\|^{2}}=o(1)$

Combining this with (A.75), (A.76), (A.77), (A.78),and (A.80) completes the
proof of the first claim. The second claim follows plugging in $\mu_{k}=\mu$
for all $k\in\\{1,2,\ldots,K\\}$.

∎

###  A.12 Proof of Lemma A.8

By assumption, $N_{i}^{3}/(N_{i}-1)\asymp N_{i},M_{i}^{3}/(M_{i}-1)\asymp
M_{i}$. By direct calculation,

$\displaystyle\Theta_{n2}+\Theta_{n4}$
$\displaystyle\asymp\big{[}\frac{m\bar{M}}{(n\bar{N}+m\bar{M})n\bar{N}}\big{]}^{2}\sum_{i,m,j}N_{i}N_{m}\Omega_{ij}\Omega_{mj}+\big{[}\frac{n\bar{N}}{(n\bar{N}+m\bar{M})m\bar{M}}\big{]}^{2}\sum_{i,m}N_{i}N_{m}\Gamma_{ij}\Gamma_{mj}$
$\displaystyle=\frac{1}{(n\bar{N}+m\bar{M})^{2}}\bigg{(}(m\bar{M})^{2}\|\eta\|^{2}+n\bar{N}^{2}\|\theta\|^{2}\bigg{)}.$
(A.81)

Next

$\displaystyle\Theta_{n3}$
$\displaystyle=\frac{4}{(n\bar{N}+m\bar{M})^{2}}\sum_{i\in S_{1}}\sum_{m\in
S_{2}}\sum_{j}N_{i}\Omega_{ij}\cdot N_{m}\Gamma_{mj}$
$\displaystyle=\frac{4}{(n\bar{N}+m\bar{M})^{2}}\cdot
n\bar{N}m\bar{M}\langle\theta,\eta\rangle.$ (A.82)

Combining (A.81) and (A.82) yields

$\displaystyle\Theta_{n2}+\Theta_{n3}+\Theta_{n4}$
$\displaystyle\asymp\frac{1}{(n\bar{N}+m\bar{M})^{2}}\big{(}(m\bar{M})^{2}\|\eta\|^{2}+2n\bar{N}m\bar{M}\langle\theta,\eta\rangle+n\bar{N}^{2}\|\theta\|^{2}\big{)}$
$\displaystyle=\bigg{\|}\frac{m\bar{M}}{n\bar{N}+m\bar{M}}\eta+\frac{n\bar{N}}{n\bar{N}+m\bar{M}}\theta\bigg{\|}^{2},$

which proves the first claim. The second follows by plugging in
$\theta=\eta=\mu$ under the null. ∎

###  A.13 Proof of Lemma A.9

As in (A.75), we have under the null that

$\displaystyle\mathrm{Var}(T)=\Theta_{n2}+\Theta_{n3}+\Theta_{n4}+O(A_{n}+B_{n}+E_{n}).$
(A.83)

For general $K$, observe that the proofs of the bounds

$\displaystyle A_{n}$
$\displaystyle\leq\sum_{k=1}^{K}\Bigl{(}\frac{1}{n_{k}\bar{N}_{k}}\Bigr{)}^{2}\sum_{i\in
S_{k}}N_{i}^{2}\|\Omega_{i}\|_{3}^{3}$ $\displaystyle B_{n}$
$\displaystyle\leq\sum_{k=1}^{K}\|\Sigma_{k}\|_{F}^{2}$ $\displaystyle E_{n}$
$\displaystyle\leq\sum_{k=1}^{K}\|\Sigma_{k}\|_{F}^{2}$

derived in (A.76), (A.77), and (A.78), only use the assumption that
$N_{i},M_{i}\geq 2$ for all $i$.

Translating these bounds to the notation of the $K=2$ case, we have

$\displaystyle A_{n}$
$\displaystyle\leq\sum_{i}N_{i}^{2}\|\Omega_{i}\|^{3}+\sum_{i}M_{i}^{2}\|\Gamma_{i}\|^{3}$
$\displaystyle B_{n}$
$\displaystyle\leq\|\Sigma_{1}\|_{F}^{2}+\|\Sigma_{2}\|_{F}^{2}$
$\displaystyle E_{n}$
$\displaystyle\leq\|\Sigma_{1}\|_{F}^{2}+\|\Sigma_{2}\|_{F}^{2}.$ (A.84)

Furthermore, we know that $\Theta_{n}\geq c\|\mu\|^{2}$ under the null by
Lemma A.8, for an absolute constant $c>0$. Combining this with (A.83) and
(A.84) completes the proof. ∎

###  A.14 Proof of Lemma A.10

Define

$\displaystyle V_{1}$ $\displaystyle=2\sum_{k=1}^{K}\sum_{i\in
S_{k}}\sum_{j=1}^{p}\Bigl{(}\frac{1}{n_{k}\bar{N}_{k}}-\frac{1}{n\bar{N}}\Bigr{)}^{2}\biggl{[}\frac{N_{i}X_{ij}^{2}}{N_{i}-1}-\frac{N_{i}X_{ij}(N_{i}-X_{ij})}{(N_{i}-1)^{2}}\biggr{]}$
$\displaystyle V_{2}$ $\displaystyle=\frac{2}{n^{2}\bar{N}^{2}}\sum_{1\leq
k\neq\ell\leq K}\sum_{i\in S_{k}}\sum_{m\in
S_{\ell}}\sum_{j=1}^{p}X_{ij}X_{mj}$ $\displaystyle V_{3}$
$\displaystyle=2\sum_{k=1}^{K}\sum_{\begin{subarray}{c}i\in S_{k},m\in
S_{k},\\\ i\neq
m\end{subarray}}\sum_{j=1}^{p}\Bigl{(}\frac{1}{n_{k}\bar{N}_{k}}-\frac{1}{n\bar{N}}\Bigr{)}^{2}X_{ij}X_{mj}.$

Observe that $V_{1}+V_{2}+V_{3}=V$. Also define

$\displaystyle A_{11}$
$\displaystyle=\sum_{i}\sum_{r=1}^{N_{i}}\sum_{j}\big{[}\frac{4\theta_{i}\Omega_{ij}}{N_{i}}\big{]}Z_{ijr}$
(A.85) $\displaystyle A_{12}$
$\displaystyle=2\sum_{i}\sum_{r=1}^{N_{i}}\sum_{j}\big{[}\sum_{m\in[n]\backslash\\{i\\}}\alpha_{im}N_{m}\Omega_{mj}\big{]}Z_{ijr}$
(A.86)

and observe that $A_{11}+A_{12}=A_{1}$.

First, we derive the decomposition of $V_{1}$. Recall that

$Y_{ij}:=\frac{X_{ij}}{N_{i}}-\Omega_{ij}=\frac{1}{N_{i}}\sum_{r=1}^{N_{i}}Z_{ijr},\qquad
Q_{ij}:=Y_{ij}^{2}-\mathbb{E}Y^{2}_{ij}=Y_{ij}^{2}-\frac{\Omega_{ij}(1-\Omega_{ij})}{N_{i}}.$
(A.87)

With these notations, $X_{ij}=N_{i}(\Omega_{ij}+Y_{ij})$ and
$N_{i}Y_{ij}^{2}=N_{i}Q_{ij}+\Omega_{ij}(1-\Omega_{ij})$.

Write

$V_{1}=2\sum_{i=1}^{n}\sum_{i=1}^{n}\frac{\theta_{i}}{N_{i}}\Delta_{ij},\qquad\mbox{where}\quad\Delta_{ij}:=\frac{X^{2}_{ij}}{N_{i}}-\frac{X_{ij}(N_{i}-X_{ij})}{N_{i}(N_{i}-1)}.$
(A.88)

Note that $X_{ij}=N_{i}(\Omega_{ij}+Y_{ij})$ and
$Y_{ij}^{2}=Q_{ij}+N_{i}^{-1}\Omega_{ij}(1-\Omega_{ij})$. It follows that

$\frac{X_{ij}^{2}}{N_{i}}=N_{i}\Omega_{ij}^{2}+2N_{i}\Omega_{ij}Y_{ij}+N_{i}Q_{ij}+\Omega_{ij}(1-\Omega_{ij}).$

In (A.32), we have shown that
$Q_{ij}=(1-2\Omega_{ij})\frac{Y_{ij}}{N_{i}}+\frac{1}{N^{2}_{i}}\sum_{1\leq
r\neq s\leq N_{i}}Z_{ijr}Z_{ijs}$. It follows that

$\frac{X_{ij}^{2}}{N_{i}}=N_{i}\Omega_{ij}^{2}+2N_{i}\Omega_{ij}Y_{ij}+(1-2\Omega_{ij})Y_{ij}+\frac{1}{N_{i}}\sum_{1\leq
r\neq s\leq N_{i}}Z_{ijr}Z_{ijs}+\Omega_{ij}(1-\Omega_{ij}).$

Additionally, by (A.33),

$\frac{X_{ij}(N_{ij}-X_{ij})}{N_{i}(N_{i}-1)}=\Omega_{ij}(1-\Omega_{ij})+(1-2\Omega_{ij})Y_{ij}-\frac{1}{N_{i}(N_{i}-1)}\sum_{1\leq
r\neq s\leq N_{i}}Z_{ijr}Z_{ijs}.$

Combining the above gives

$\displaystyle\Delta_{ij}=N_{i}\Omega_{ij}^{2}+2N_{i}\Omega_{ij}Y_{ij}+\frac{1}{N_{i}-1}\sum_{1\leq
r\neq s\leq N_{i}}Z_{ijr}Z_{ijs}$ (A.89)
$\displaystyle=N_{i}\Omega_{ij}^{2}+2\Omega_{ij}\sum_{r=1}^{N_{i}}Z_{ijr}+\frac{1}{N_{i}-1}\sum_{1\leq
r\neq s\leq N_{i}}Z_{ijr}Z_{ijs}.$ (A.90)

Recall the definition of $\Theta_{n2}$ in (A.7), $A_{2}$ in (A.19), and
$A_{11}$ in (A.85). We have

$\displaystyle V_{1}$ $\displaystyle=2\sum_{k,i\in
S_{k}}\sum_{j}\frac{\theta_{i}}{N_{i}}\big{[}N_{i}\Omega_{ij}^{2}+2\Omega_{ij}\sum_{r=1}^{N_{i}}Z_{ijr}+\frac{1}{N_{i}-1}\sum_{1\leq
r\neq s\leq N_{i}}Z_{ijr}Z_{ijs}\big{]}.$
$\displaystyle=\Theta_{n2}+\sum_{k,i\in
S_{k}}\sum_{j}\frac{4\theta_{i}\Omega_{ij}}{N_{i}}\sum_{r=1}^{N_{i}}Z_{ijr}+\sum_{k,i\in
S_{k}}\sum_{j}\frac{2\theta_{i}}{N_{i}(N_{i}-1)}\sum_{1\leq r\neq s\leq
N_{i}}Z_{ijr}Z_{ijs}$ $\displaystyle=\Theta_{n2}+A_{11}+A_{2}$ (A.91)

Next, we have

$\displaystyle V_{2}+V_{3}$ $\displaystyle=\sum_{i\neq
m}\alpha_{im}N_{i}N_{m}\sum_{j}\bigg{[}(Y_{ij}+\Omega_{ij})(Y_{mj}+\Omega_{mj})\bigg{]}$
$\displaystyle=\sum_{i\neq
m}\alpha_{im}N_{i}N_{m}\sum_{j}Y_{ij}Y_{mj}+2\sum_{i\neq
m}\alpha_{im}N_{i}N_{m}\sum_{j}Y_{ij}\Omega_{mj}+\sum_{i\neq
m}\alpha_{im}N_{i}N_{m}\sum_{j}\Omega_{ij}\Omega_{mj}$
$\displaystyle=\sum_{i\neq
m}\sum_{r=1}^{N_{i}}\sum_{s=1}^{N_{m}}\alpha_{im}\big{(}\sum_{j}Z_{ijr}Z_{mjs}\big{)}+2\sum_{i}\sum_{r=1}^{N_{i}}\sum_{j}\big{[}\sum_{m\in[n]\backslash\\{i\\}}\alpha_{im}N_{m}\Omega_{mj}\big{]}Z_{ijr}+\Theta_{n3}+\Theta_{n4}$
$\displaystyle=A_{3}+A_{12}+\Theta_{n3}+\Theta_{n4}.$

Hence

$\displaystyle A_{1}+A_{2}+A_{3}+\Theta_{n2}+\Theta_{n3}+\Theta_{n4}=V,$

which verifies (A.21). By inspection, we also see that $\mathbb{E}A_{b}=0$ for
$b\in\\{1,2,3\\}$. That $A_{1},A_{2},A_{3}$ are mutually uncorrelated follows
immediately from the linearity of expectation and the fact that the random
variables $\\{Z_{ijr}\\}_{i,r}\cup\\{Z_{ijr}Z_{mjs}\\}_{(i,r)\neq(m,s)}$ are
mutually uncorrelated.

∎

###  A.15 Proof of Lemma A.11

Define

$\displaystyle\gamma_{irj}=\frac{4\theta_{i}\Omega_{ij}}{N_{i}}+\sum_{m\in[n]\backslash\\{i\\}}2\alpha_{im}N_{m}\Omega_{mj}$
(A.92)

and recall that $A_{1}=\sum_{i}\sum_{r\in[N_{i}]}\sum_{j}\gamma_{irj}Z_{ijr}$.
First we develop a bound on $\gamma_{irj}$. Suppose that $i\in S_{k}$. Then we
have

$\displaystyle\gamma_{irj}$
$\displaystyle\lesssim\frac{N_{i}\Omega_{ij}}{n_{k}^{2}\bar{N}_{k}^{2}}+\sum_{m\in
S_{k},m\neq
i}\frac{N_{m}\Omega_{mj}}{n_{k}^{2}\bar{N}_{k}^{2}}+\sum_{k^{\prime}\in[K]\backslash\\{k\\}}\sum_{m\in
S_{k^{\prime}}}\frac{N_{m}\Omega_{mj}}{n^{2}\bar{N}^{2}}$
$\displaystyle\lesssim\frac{\mu_{kj}}{n_{k}\bar{N}_{k}}+\frac{\mu_{j}}{n\bar{N}}.$

Next using properties of the covariance matrix of a multinomial vector, we
have

$\displaystyle\mathrm{Var}(A_{1})$
$\displaystyle=\sum_{i,r\in[N_{i}]}\mathrm{Var}(\gamma_{ir:}^{\prime}Z_{i:r})=\sum_{i,r\in[N_{i}]}\gamma_{ir:}^{\prime}\text{Cov}(Z_{i:r})\gamma_{ir:}$
$\displaystyle\leq\sum_{i,r\in[N_{i}]}\gamma_{ir:}^{\prime}\text{diag}(\Omega_{i:})\gamma_{ir:}=\sum_{i,r\in[N_{i}]}\sum_{j}\Omega_{ij}\gamma_{irj}^{2}$
$\displaystyle\lesssim\sum_{k,j}\big{(}\frac{\mu_{kj}}{n_{k}\bar{N}_{k}}+\frac{\mu_{j}}{n\bar{N}}\big{)}^{2}\sum_{i\in
S_{k},r\in[N_{i}]}\Omega_{ij}$
$\displaystyle\lesssim\sum_{k,j}\big{(}\frac{\mu_{kj}}{n_{k}\bar{N}_{k}}\big{)}^{2}n_{k}\bar{N}_{k}\mu_{kj}+\sum_{k,j}\big{(}\frac{\mu_{j}}{n\bar{N}}\big{)}^{2}n_{k}\bar{N}_{k}\mu_{kj}$
$\displaystyle=(\sum_{k}\frac{\|\mu_{k}\|_{3}^{3}}{n_{k}\bar{N}_{k}})+\frac{\|\mu\|_{3}^{3}}{n\bar{N}}\lesssim\sum_{k}\frac{\|\mu_{k}\|_{3}^{3}}{n_{k}\bar{N}_{k}},$
(A.93)

which proves the first claim. The last inequality follows because by Jensen’s
inequality (noting that the function $x\mapsto x^{3}$ is convex for $x\geq
0$),

$\displaystyle\|\mu\|_{3}^{3}$
$\displaystyle=\sum_{j}\bigg{(}\sum_{k}(\frac{n_{k}\bar{N}_{k}}{n\bar{N}})\mu_{kj}\bigg{)}^{3}\leq\sum_{j}\sum_{k}(\frac{n_{k}\bar{N}_{k}}{n\bar{N}})\mu_{kj}^{3}\leq\sum_{k}\|\mu_{k}\|_{3}^{3}.$

Next observe that

$\displaystyle A_{2}=\sum_{i}\sum_{r\neq
s}\frac{2\theta_{i}}{N_{i}(N_{i}-1)}W_{irs}$ (A.94)

where recall $W_{irs}=\sum_{j}Z_{ijr}Z_{ijs}$. Also recall that $W_{irs}$ and
$W_{i^{\prime}r^{\prime}s^{\prime}}$ are uncorrelated unless $i=i^{\prime}$
and $\\{r,s\\}=\\{r^{\prime},s^{\prime}\\}$. By (A.55),

$\displaystyle\mathrm{Var}(A_{2})$ $\displaystyle=\sum_{i}\sum_{r\neq
s}\frac{4\theta_{i}^{2}}{N_{i}^{2}(N_{i}-1)^{2}}\mathrm{Var}(W_{irs})$
$\displaystyle\lesssim\sum_{i}\sum_{r\neq
s}\frac{4\theta_{i}^{2}}{N_{i}^{2}(N_{i}-1)^{2}}\|\Omega_{i}\|^{2}$
$\displaystyle\lesssim\sum_{k}\sum_{i\in
S_{k}}\cdot(\frac{1}{n_{k}\bar{N}_{k}}-\frac{1}{n\bar{N}})^{4}\frac{N_{i}^{6}}{(N_{i}-1)^{2}}\cdot\frac{1}{N_{i}(N_{i}-1)}\|\Omega_{i}\|^{2}$
$\displaystyle\lesssim\sum_{k}\sum_{i\in
S_{k}}\frac{N_{i}^{2}}{n_{k}^{4}\bar{N}_{k}^{4}}\|\Omega_{i}\|^{2}$ (A.95)

Also observe that

$\displaystyle\sum_{k}\frac{1}{n_{k}^{4}\bar{N}_{k}^{4}}\sum_{i\in
S_{k}}N_{i}^{2}\|\Omega_{i}\|_{2}^{2}$
$\displaystyle\leq\sum_{k}\frac{1}{n_{k}^{2}\bar{N}_{k}^{2}}\sum_{i,m\in
S_{k}}\bigg{\langle}(\frac{N_{i}}{n_{k}\bar{N}_{k}})\Omega_{i},(\frac{N_{m}}{n_{m}\bar{N}_{m}})\Omega_{m}\bigg{\rangle}$
$\displaystyle=\sum_{k}\frac{1}{n_{k}^{2}\bar{N}_{k}^{2}}\|\mu_{k}\|^{2}.$

This establishes the second claim.

Last we study $A_{3}$. Observe that

$\displaystyle A_{3}=\sum_{i\neq
m}\sum_{r=1}^{N_{i}}\sum_{s=1}^{N_{m}}\alpha_{im}V_{irms}$

where recall $V_{irms}=\sum_{j}Z_{ijr}Z_{mjs}$. Recall that $V_{irms}$ and
$V_{i^{\prime}r^{\prime}m^{\prime}s^{\prime}}$ are uncorrelated unless
$(r,s)=(r^{\prime},s^{\prime})$ and $\\{i,m\\}=\\{i^{\prime},m^{\prime}\\}$
.By (A.60),

$\displaystyle\mathrm{Var}(A_{3})$ $\displaystyle\lesssim\sum_{i\neq
m}\alpha_{im}^{2}N_{i}N_{m}\sum_{j}\Omega_{ij}\Omega_{mj}$
$\displaystyle\lesssim\sum_{k}\sum_{i\neq m\in
S_{k}}\frac{1}{n_{k}^{4}\bar{N}_{k}^{4}}\langle
N_{i}\Omega_{i},N_{m}\Omega_{m}\rangle+\sum_{k\neq\ell}\sum_{i\in S_{k},m\in
S_{\ell}}\frac{1}{n^{4}\bar{N}^{4}}\langle
N_{i}\Omega_{i},N_{m}\Omega_{m}\rangle$
$\displaystyle\lesssim\sum_{k}\frac{\|\mu_{k}\|^{2}}{n_{k}^{2}\bar{N}_{k}^{2}}+\sum_{k,\ell}\frac{1}{n^{4}\bar{N}^{4}}\langle
n_{k}\bar{N}_{k}\mu_{k},n_{\ell}\bar{N}_{\ell}\mu_{\ell}\rangle$
$\displaystyle\lesssim\sum_{k}\frac{\|\mu_{k}\|^{2}}{n_{k}^{2}\bar{N}_{k}^{2}}+\frac{\|\mu\|^{2}}{n^{2}\bar{N}^{2}}\lesssim\sum_{k}\frac{\|\mu_{k}\|^{2}}{n_{k}^{2}\bar{N}_{k}^{2}}.$
(A.96)

In the last line we use that $\|\mu\|^{2}\leq 2\sum\|\mu_{k}\|^{2}$ as shown
in (A.72). This proves all required claims. ∎

###  A.16 Proof of Proposition A.1

Under the null hypothesis, we have $\Theta_{n1}\equiv 0$. Thus,
$\mathbb{E}V=\Theta_{n}$ under the null by Lemma A.10. Under (3.1), we have
$\mathrm{Var}(T)=[1+o(1)]\Theta_{n}$. Therefore,

$\displaystyle\mathbb{E}V=[1+o(1)]\mathrm{Var}(T),$ (A.97)

so $V$ is asymptotically unbiased under the null. Furthermore, by Lemma A.6,
we have

$\displaystyle\Theta_{n}\asymp K\|\mu\|^{2}.$ (A.98)

In Lemma A.11, we showed that

$\displaystyle\mathrm{Var}(A_{2})$ $\displaystyle\lesssim\sum_{k}\sum_{i\in
S_{k}}\frac{N_{i}^{2}\|\Omega_{i}\|_{2}^{2}}{n_{k}^{4}\bar{N}_{k}^{4}}$

We conclude by Lemma A.11 that under the null

$\displaystyle\mathrm{Var}(V)\lesssim\sum_{k}\frac{\|\mu\|^{2}}{n_{k}^{2}\bar{N}_{k}^{2}}\vee\sum_{k}\frac{\|\mu\|_{3}^{3}}{n_{k}\bar{N}_{k}}.$
(A.99)

By Chebyshev’s inequality, (A.98), (A.99), and assumption (A.22) of the
theorem statement, we have

$\displaystyle\frac{|V-\mathbb{E}V|}{\mathrm{Var}(T)}\asymp\frac{|V-\mathbb{E}V|}{K\|\mu\|^{2}}=o_{\mathbb{P}}(1).$

Thus by (A.97),

$\displaystyle\frac{V}{\mathrm{Var}(T)}$
$\displaystyle=\frac{(V-\mathbb{E}V)}{\mathrm{Var}(T)}+\frac{\mathbb{E}V}{\mathrm{Var}(T)}=o_{\mathbb{P}}(1)+[1+o(1)],$

as desired. ∎

###  A.17 Proof of Lemma A.12

By Lemmas A.1–A.5, we have

$\displaystyle\mathrm{Var}(T)$
$\displaystyle=\sum_{a=1}^{4}\mathrm{Var}(\mathbf{1}_{p}^{\prime}U_{a})\geq(\sum_{a=2}^{4}\Theta_{na})-(A_{n}+B_{n}+E_{n}).$
(A.100)

Using that $\max_{i}\|\Omega_{i}\|_{\infty}\leq 1-c_{0}$, we have
$\|\Omega_{i}\|^{3}\leq(1-c_{0})\|\Omega_{i}\|^{2}$, which implies that

$\displaystyle A_{n}\leq(1-c_{0})\Theta_{n2}.$ (A.101)

Again using $\max_{i}\|\Omega_{i}\|_{\infty}\leq 1-c_{0}$, as well as
$\sum_{j^{\prime}}\Omega_{ij^{\prime}}=1$, we have

$\displaystyle B_{n}$
$\displaystyle=\frac{2}{n^{2}\bar{N}^{2}}\sum_{k\neq\ell}\sum_{i\in
S_{k}}\sum_{m\in
S_{\ell}}\sum_{j,j^{\prime}}N_{i}N_{m}\Omega_{ij}\Omega_{ij^{\prime}}\Omega_{mj}\Omega_{mj^{\prime}}$
$\displaystyle\leq(1-c_{0})\cdot\frac{2}{n^{2}\bar{N}^{2}}\sum_{k\neq\ell}\sum_{i\in
S_{k}}\sum_{m\in
S_{\ell}}\sum_{j,j^{\prime}}N_{i}N_{m}\Omega_{ij}\Omega_{ij^{\prime}}\Omega_{mj}$
$\displaystyle=(1-c_{0})\cdot\frac{2}{n^{2}\bar{N}^{2}}\sum_{k\neq\ell}\sum_{i\in
S_{k}}\sum_{m\in S_{\ell}}\sum_{j}N_{i}N_{m}\Omega_{ij}\Omega_{mj}$
$\displaystyle\leq(1-c_{0})\cdot\Theta_{n3}.$ (A.102)

Similarly to control $E_{n}$, we again use
$\max_{i}\|\Omega_{i}\|_{\infty}\leq 1-c_{0}$ and obtain

$\displaystyle E_{n}$ $\displaystyle=2\sum_{k}\sum_{\begin{subarray}{c}i\in
S_{k},m\in S_{k},\\\ i\neq m\end{subarray}}\sum_{1\leq j,j^{\prime}\leq
p}\Bigl{(}\frac{1}{n_{k}\bar{N}_{k}}-\frac{1}{n\bar{N}}\Bigr{)}^{2}N_{i}N_{m}\Omega_{ij}\Omega_{ij^{\prime}}\Omega_{mj}\Omega_{mj^{\prime}}$
$\displaystyle\leq(1-c_{0})\cdot 2\sum_{k}\sum_{\begin{subarray}{c}i\in
S_{k},m\in S_{k},\\\ i\neq m\end{subarray}}\sum_{1\leq j,j^{\prime}\leq
p}\Bigl{(}\frac{1}{n_{k}\bar{N}_{k}}-\frac{1}{n\bar{N}}\Bigr{)}^{2}N_{i}N_{m}\Omega_{ij}\Omega_{ij^{\prime}}\Omega_{mj}$