{'fraction_non_alphanumeric': 0.05269489377242165, 'fraction_numerical': 0.022126270112349897, 'mean_word_length': 3.7036475699706983, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Weak detection in the spiked Wigner model

We consider the weak detection problem in a rank-one spiked Wigner data matrix where the signal-to-noise ratio is small so that reliable detection is impossible. We propose a hypothesis test on the presence of the signal by utilizing the linear spectral statistics of the data matrix. The test is data-driven and does not require prior knowledge about the distribution of the signal or the noise. When the noise is Gaussian, the proposed test is optimal in the sense that its error matches that of the likelihood ratio test, which minimizes the sum of the Type-I and Type-II errors. If the density of the noise is known and non-Gaussian, the error of the test can be lowered by applying an entrywise transformation to the data matrix. We establish a central limit theorem for the linear spectral statistics of general rank-one spiked Wigner matrices as an intermediate step.


Introduction
It is of fundamental importance in statistics to detect signals from given noisy data. If the data is given as a square matrix, it is common to apply principal component analysis (PCA), which is to analyze the data by the largest eigenvalue and the eigenvector corresponding to it. For a null model where no signal is present, the data is pure noise in which case the behavior of the largest eigenvalue can be precisely predicted by random matrix theory [34,35,20,33,18]. If the signal is present, the data matrix is of 'signal-plus-noise' type, and it corresponds to a 'deformed random matrix.' In the simple yet realistic case where the signal is in the form of a vector, the model is often referred to as a 'spiked random matrix. ' When the signal is an N -dimensional vector and the data is an N × N real symmetric matrix, one of the most natural signal-plus-noise models is of the form the rest of the graph. In the community detection, the spike x ∈ {1, −1} N indicates communities each node belongs to and the data matrix M models noisy pairwise interactions with different means depending on whether the corresponding nodes are in the same community or not. In the submatrix localization, the task is to detect within a large Gaussian matrix small blocks with atypical mean. In these two problems, the main goals are to recover x from the noisy data matrix M or to test the presence of community structures or submatrices with atypical mean in the data when one cannot reliably detect x. Another example is the angular synchronization problem that aims to recover unknown angles x = (exp(iθ 1 ), ..., exp(iθ N )) from pairwise noisy measurements of θ i − θ j mod 2π. For the Wigner matrix H, which represents the noise, we assume that H ij are independent random variables with mean 0 and variance N −1 . With the assumption, the spectral norm of H, H → 2 as N → ∞ almost surely. Thus, when the signal is normalized so that x 2 = 1, the strengths of the signal xx T and the noise H are comparable. If the parameter λ, which corresponds to the signal-to-noise ratio (SNR), is very large (λ 1) or small (λ 1), a perturbation argument can be applied for PCA; if λ 1, the difference between the largest eigenvalues of M and √ λxx T is negligible, and if λ 1, the largest eigenvalue of M cannot be distinguished from that of H.
The case λ ∼ 1 in (1.1) has been intensively studied. The first and the most notable result in this direction was obtained by Baik, Ben Arous, and Péché [5] for complex Wishart matrices, which is of the form X * X where X is a rectangular matrix with independent complex Gaussian entries, and later extended to more general sample covariance matrices [29,26,21]. Similar results were proved for (both real and complex) Wigner matrices under various assumptions [30,19,14,12]. In these results, the largest eigenvalue exhibits the following phase transition; when λ > 1, the largest eigenvalue separates from the other eigenvalues of M and converges to √ λ + 1 √ λ , which is strictly larger than 2, whereas for λ < 1, the behavior of the largest eigenvalue coincides with that of the pure noise model. In the former case, the eigenvector corresponding to the largest eigenvalue has nontrivial correlation with the signal x and the signal can be detected and recovered by PCA. We refer to the work of Benaych-Georges and Nadakuditi [12] for more detail on the behavior of the largest eigenvalues and corresponding eigenvectors, including their phase transition.
When λ < 1, contrary to the case λ > 1, simple application of PCA does not provide the information on the signal. In this case, the spectral norm of M converges to 2 and the behavior of the largest eigenvalue cannot be distinguished from that of the null model H. It is then natural to ask whether the presence of the signal is detectable, and if so, which tests allow us to detect it in the regime λ < 1.
The question on the detectability was considered in the seminal work by Montanari, Reichman, and Zeitouni [25], where it was proved that no tests based on the eigenvalues can reliably detect the signal if the noise H is a random matrix from the Gaussian Orthogonal Ensemble (GOE). For a non-Gaussian Wigner matrix H, Perry, Wein, Bandeira, and Moitra [31] assumed that the signal x is drawn from a distribution X , which they called the spike prior, and found the critical value for λ ≤ 1 in terms of X and H below which no tests based on the eigenvalues can reliably detect signal. Moreover, they also established a transformation acting on each entry of the data matrix after which the signal can be detected via the largest eigenvalue whenever λ is larger than the critical value that is strictly less than 1 if the noise is non-Gaussian.
For the subcritical case, El Alaoui, Krzakala, and Jordan [16] studied the weak detection, i.e., a test with accuracy better than a random guess. More precisely, they considered the hypothesis testing problem between the null hypothesis that λ = 0 and the alternative hypothesis that M is generated with a fixed λ > 0. Assuming that the entries of √ N x are i.i.d. random variables with bounded support and the noise H is Gaussian, it was proved that the error from the likelihood ratio (LR) test, which is the optimal test in minimizing the sum of the Type-I and the Type-II error, converges to if the variance of diagonal entries H ii tends to infinity. We remark that Onatski, Moreira, and Hallin [28] considered the weak detection for real Wishart matrices and obtained a Gaussian limit of the log LR. While the likelihood ratio test is optimal as predicted by the Neyman-Pearson lemma, LR tests require substantial knowledge of the distribution of x, called prior, which may not be known a priori in many practical cases such as community detection problems. Thus, it is desirable to design a test that does not require any knowledge on the signal. For community detection problem in the stochastic block model, Banerjee and Ma [10] proposed a test based on the linear spectral statistics (LSS). More precisely, denoting by µ 1 , . . . , µ N the eigenvalues of the data matrix, they considered the LSS with f (x) = x k for positive integers k and showed that asymptotically optimal error is achieved by a linear combination of the LSS. The results in [16,10] shed lights on the weak detection problem. However, the analysis in these results seems to be restricted to the specific distributions of the noise -the Gaussian distribution in [16] and the Bernoulli distribution in [10]. Moreover, the signal considered in the previous works is completely delocalized, i.e., x ∞ = O(1/ √ N ), which may lose its validity if the signal is sparse. In this paper, we construct an optimal and universal test that detects the absence or presence of signal in (1.1) based on LSS for any x with x 2 = 1 and for any Wigner matrix H. Our proposed test has the following properties: • Universality 1: For any deterministic or random x, the proposed test and its error do not change, and thus we do not need any prior information on x. Note that the LR test requires the prior information on x.
• Universality 2: The proposed test and its error depend on the distribution of the noise H only through the variance of the diagonal entries and the fourth moment of the off-diagonal entries. The entries H ij do not need to be identically distributed but just independent.
• Optimality 1: The proposed test is with the lowest error among all tests based on LSS.
• Optimality 2: When the noise is Gaussian, the error of the proposed test with low computational complexity converges to the optimal limit (1.2) obtained in [16].
• Data-driven test: The various quantities in the proposed test can be estimated from the observed data.
For the case where the noise is non-Gaussian, the error from the LR test is not known and hence it is not clear whether the proposed test achieves the optimal error. It seems natural to adapt the entrywise transformation in [31] to further improve the proposed test, since the results in [31] show that the PCA performs better with the transformation. When we apply it to our model for the hypothesis testing, we may consider the following two scenarios with respect to the transformation: (1) the transformation effectively changes the SNR and thus the error from the proposed test decreases after the transformation, or (2) the transformation increases the largest eigenvalue but also changes other eigenvalues in a way that the proposed test, which uses all eigenvalues contrary to the PCA that only uses the largest eigenvalue, does not improve (or even performs worse).
In this paper, we prove that the first scenario is true, i.e., the transformation indeed effectively changes the SNR from λ to λF H , where F H is the Fisher information of the density function of the (normalized) off-diagonal entries in H. Since F H ≥ 1, and the strict inequality holds if the noise is non-Gaussian, the error from our test decreases in general after the transformation. In summary, our proposed test also has the following property: • Entrywise transformation: If the density function of the noise matrix is known, which is non-Gaussian, the test can be further improved by an entrywise transformation that effectively increases the SNR.
As a generalization of the model, we briefly introduce the model where the value of the SNR for the alternative hypothesis is not known and explain how to construct in this case an adaptive test that performs better than a random guess if the prior distribution of SNR under the alternative hypothesis is known. The idea of the test can be further extended to more general models such as rank-k spiked Wigner matrices with k > 1 or spiked sample covariance matrices. Such generalizations will be considered in our future papers.
The main mathematical achievement of the present paper is the central limit theorem (CLT) for the LSS of arbitrary analytic functions for the random matrix in (1.1). The fluctuation of the LSS is not only of fundamental importance per se in random matrix theory, but also applicable to various applications such as the fluctuations of the free energy of the spherical spin glass [6,7]. The LR in the weak detection problem with Gaussian noise is directly related to the free energy of spin glass as in [16]. To our best knowledge, however, the CLT for spiked Wigner matrices was proved only for the case where the signal x = 1 : The rest of the paper is organized as follows. In Section 2, we define the model and introduce previous results. In Section 3, we state the main result and describe the algorithm for the proposed test. In Section 4, we explain an adaptive test that does not require the precise information on SNR. In Section 5, we apply the entrywise transformation and state the results for the improved test. In Section 6, we conduct numerical simulations with the algorithm for the proposed test and compare the outcomes with the theoretical results. General results on the CLT for the LSS are collected in Section 7. We conclude the paper in Section 8 with the summary of our results and future research directions. Proof of the theorems and technical results can be found in Appendices.

Notational remarks
We use the standard big-O and little-o notation: a N = O(b N ) implies that there exists N 0 such that a N ≤ Cb N for some constant C > 0 independent of N for all N ≥ N 0 ; a N = o(b N ) implies that for any positive constant there exists N 0 such that a N ≤ b N for all N ≥ N 0 .
For an event Ω, we say that Ω holds with high probability if for any (large) D > 0 there exists N 0 ≡ N 0 (D) such that P(Ω c ) < N −D whenever N > N 0 .
For X and Y , which can be deterministic numbers and/or random variables depending on N , we use the notation X = O(Y ) if for any (small) > 0 and (large) D > 0 there exists N 0 ≡ N 0 ( , D) such that P(|X| > N |Y |) < N −D whenever N > N 0 . Roughly speaking, X = O(Y ) means that with high probability |X| is not significantly larger than |Y |.

Preliminaries
We begin by defining the matrix in (1.1) more precisely. The Wigner matrix is defined as follows: ii ] = w 2 for a constant w 2 ≥ 0.
Note that we do not assume H ij are identically distributed. Our results in the paper hold as long as they are independent and the first four moments of off-diagonal entries (and the first two moments of diagonal entries) match. We also remark that the finite moment condition for H ij can be relaxed further; it is believed that the finiteness of the fourth moment suffices. However, for the sake of brevity, we do not pursue it in the current paper.
The signal-plus-noise model we consider is a (rank-one) spiked Wigner matrix, which is defined as follows: Definition 2.2 (Spiked Wigner matrix). We say an N × N random matrix M = √ λxx T + H is a spiked Wigner matrix with a spike x and signal-to-noise ratio (SNR) λ if x = (x 1 , x 2 , . . . , x N ) ∈ R N with x 2 = 1 and H is a Wigner matrix.
Denote by P 1 the joint probability of the observation, a spiked Wigner matrix, with λ = ω > 0 and P 0 with ii ] = 2, and x is drawn from the spike prior X , the likelihood ratio is given by For the spherical prior, i.e., X is the uniform distribution on the unit sphere, with the spike x = 1, it was proved in [6,7] that where the plus sign holds under the alternative M ∼ P 1 and the minus sign holds under the null M ∼ P 0 . (See Section 3.1 of [6] and Theorem 1.4 of [7] with β = √ ω/2.) For the i.i.d. bounded prior, i.e., the entries of √ N x are i.i.d. random variables with bounded support, the same result was proved in [16]. The proof of the convergence of dP1 dP0 in [6,7] is based on the recent development of random matrix theory, especially the study of the linear spectral statistics. For a Wigner matrix H, if we let λ 1 ≥ λ 2 ≥ · · · ≥ λ N be the eigenvalues of H, then for any continuous function f defined on a neighborhood of [−2, 2], almost surely, which is the celebrated Wigner semicircle law. The fluctuation of 1 N i f (λ i ) about its limit is a subject of intensive study in random matrix theory, and it is natural to introduce the linear spectral statistic (LSS) defined in (1.3) for the analysis. The CLT for the LSS asserts that where the right-hand side denotes a Gaussian random variable with mean m H (f ) and variance V H (f ). Note that the size of the fluctuation is of N −1 and much smaller than that of the conventional central limit theorem, N − 1 2 . For the spiked Wigner matrices, the CLT for the LSS has been proved only for the case x = 1 := 1 √ N (1, 1, . . . , 1) T in [7]. Let µ 1 ≥ µ 2 ≥ · · · ≥ µ N be the eigenvalues of a spiked Wigner matrix with a spike x and SNR λ. .) It turns out that the same CLT holds for any spike x as in Theorem 7.2, and the LSS provides us a test statistic for a hypothesis testing.

Main Results
Let us denote by H 0 the null hypothesis and H 1 the alternative hypothesis, i.e., Suppose that the value ω for H 1 is known and our task is to detect whether the signal is present from a given data matrix M . If we construct a test based on the LSS for the hypothesis testing, it is obvious that we need to maximize In Theorem 7.4 in Section 7, we prove that the maximum of (3.1) is attained if and only if f (x) = C 1 φ ω (x)+C 2 for some constants C 1 and C 2 , where Thus, it is natural to define the test statistic L ω by Under H 0 , it is direct to see from Theorem 1.1 of [4] and Section 3.1 of [6] that Our first main result is the CLT for L ω under H 1 .
The mean of the limiting Gaussian distribution is given by and the variance V 0 is as in (3.5).
Theorem 3.1 is a direct consequence of a general CLT in Theorem 7.2 in Section 7. See Supplementary Material for more details.
In the simplest case with w 2 = 2 and w 4 = 3, e.g., when H is a GOE matrix, under H 0 and under H 1 as shown in Figure 1. Based on Theorem 3.1, we propose a hypothesis test described in Algorithm 1. In this test, given a data matrix M , we compute L ω and compare it with the critical value defined as to accept or reject the null hypothesis test.
where erfc(·) is the complementary error function defined as Proof. Due to the symmetry, P(L ω > m ω |H 0 ) and P(L ω ≤ m ω |H 1 ) converge to a common limit. Since and V 0 = 2 (m + − m 0 ), we can identify the limit as for a standard Gaussian random variable Z. Thus, we can conclude that Remark 3.3. Even when the exact values of w 2 and w 4 are not known, we can estimate these parameters from the data matrix by computing 1 ij , respectively. Such estimates are accurate enough for the algorithm as we can easily check from the Chernoff bound.
In case w 4 = 3 and w 2 = ∞, we obtain 12) which is equal to the error of the likelihood ratio test, given in Corollary 5 of [16]. Furthermore, in case w 4 = 3 and w 2 < ∞, we get which coincides with the error of the likelihood ratio test, obtained in the remark after Theorem 2 of [16] with E P X [X 3 ] = 0. Thus, our test achieves the optimal error when λ is below a certain threshold λ c above which reliable detection is possible as shown in [11,24,16]. Since λ c = 1 in many cases including spherical, Rademacher, and any i.i.d. prior with a sub-Gaussian bound [31], and since universal tests such as ours cannot exploit the knowledge on the prior, we have considered a test that works for any λ < 1.
In the extreme cases w 2 = 0 or w 4 = 1, the means and the variance in Theorem 3.1 are not well-defined. However, it actually means there exists a function f such that the variance V M (f ) vanishes, hence the signal can be detected reliably. See Section 7.1 for detail.
In applications such as angular synchronization, the signal and the noise are given as complex numbers. It is natural in this case to consider a complex spiked Wigner matrix, which is defined as in Definition 2.1 with the following modifications: • For all i < j, the real part and the imaginary part of H ij are independent to each other.
When the data matrix is a complex spiked Wigner matrix, we construct a test based on the LSS with the function and thus the test statistic L ω is In the test, we compare L ω with the critical value m ω , defined by We have the following result for the proposed test with a complex Wigner matrix.
Theorem 3.4. Let M be a complex spiked Wigner matrix in Definition 2.2 with λ = ω ∈ (0, 1). Suppose w 2 > 0 and w 4 > 1. Denote by µ 1 ≥ µ 2 ≥ · · · ≥ µ N the eigenvalues of M . Then, for any spike x ∈ C N with x 2 = 1, L ω converges to a Gaussian random variable. The error of the test in algorithm 1, converges to The proof of Theorem 3.4 is an almost verbatim copy of the proofs of Theorems 3.1 and 3.2 except the change of the mean and the variance of the limiting Gaussian distribution in 3.1 (See Remark 7.3); we omit the detail.
In case w 2 = 1, w 4 = 2, which corresponds to the Gaussian Unitary Ensemble (GUE), the limiting error is which is equal to the GOE case where w 2 = 2 and w 4 = 3; see (3.13).

Adaptive test
In this section, we explain how we can find an adequate candidate of SNR for the test when the presence of the signal is not known, but the prior distribution of SNR under H 1 is known. In this case, λ = 0 under H 0 but λ is drawn from a distribution on (0, 1) under H 1 . Since the SNR for H 1 is not known, we introduce a parameter t that we use as a representative value of SNR under H 1 in the test.
We consider the test proposed in Section 3 with SNR t, which involves the test statistic L t in (3.3). Then, for a given t, L t converges to a Gaussian distribution with the mean and the variance The test compares L t with the critical value m t defined in (3.10). The probability of Type-I error where Z is a standard Gaussian random variable. Similarly, the probability of Type-II error The average error then converges to where P SN R denotes the prior distribution of SNR λ under H 1 . We may choose t as the minimizer of the right hand side of (4.3).
In the simplest case where λ is drawn from unif(0, 1) under H 1 and w 2 = 2, w 4 = 3, the limiting error is which attains its minimum 0.771 · · · when t = 0.671 · · · as shown in Figure 2. This in particular shows that the test performs better than the random guess whose error is 1.

Test with Entrywise Transformation
Suppose that each normalized entry √ N H ij is drawn from a distribution P with a density function g. As shown in [31], it turns out that the signal can be reliably detected by Since F H ≥ 1 with equality if and only if P is a standard Gaussian, if H is non-Gaussian, the detection problem becomes easier. The main idea of improving the detection threshold for PCA is based on the following entrywise transformation. Set Given the data matrix M , one can consider a transformed matrix M obtained by (See (5.2) for the diagonal entries.) The transformation effectively changes the SNR from ω to ωF H for PCA, and thus it is possible to reliably detect the signal if ωF H > 1. For more detail, see Section 4 of [31].
If ω < 1/F H , no tests based on PCA are reliable. Hence, we consider the weak detection of the signal with the entrywise transformation. The effective change of the SNR by the entrywise transformation suggests that the result in Theorem 3.1 will also change correspondingly with the entrywise transformation. For analysis, we will assume the following: 8 . For the noise, let P and P d be the distributions of the normalized off-diagonal entries √ N H ij and the normalized diagonal entries √ N H ii , respectively. We assume the following: 1. The density function g of P is smooth, positive everywhere, and symmetric (about 0).
2. For any fixed D, the D-th moment of P is finite.
3. The function h = −g /g and its all derivatives are polynomially bounded in the sense that |h ( ) (w)| ≤ C |w| C for some constant C depending only on . 4. The density function g d of P d satisfies the assumptions 1-3.
Note that the signal is not necessarily delocalized, i.e., x ∞ can be significantly larger than N −1/2 . We remark that the assumption x ∞ N −3/8 is a technical constraint and may not be optimal.
The transformed matrix M is not a spiked Wigner matrix anymore. Nevertheless, as we will prove in Theorem 7.5 in Section 7, the CLT for the LSS of M holds with the mean m M (f ) and the variance V M (f ). Further, as we will see in Theorem 5.2, when compared with Theorem 3.1, the parameter ω in the mean and the variance of the CLT is replaced by ωF H , especially in the logarithmic term. It shows that the entrywise transform effectively increases the SNR from ω to ωF H . Denote by m M0 (f ) the mean m M (f ) with λ = 0. Then, as in Section 3, we need to maximize In Theorem 7.6, we prove that the maximum is attained if and only if f (x) = C 1 φ ω (x) + C 2 for some constants C 1 and C 2 , where Thus, denoting by µ 1 ≥ µ 2 ≥ · · · ≥ µ N the eigenvalues of M , we define the test statistic L ω by The CLT for L ω holds as follows: The mean and the variance of the limiting Gaussian distribution are given by Theorem 5.2 is a direct consequence of a general CLT in Theorem 7.5 in Section 7.
With the entrywise transformation, we modify the hypothesis test as in Algorithm 2, where we compute L ω and compare it with The error of the test in Algorithm 2, The proof closely follows the proof of Theorem 3.2, and we omit the detail.

Examples and Simulations
We conduct some simulations to numerically check the accuracy of the proposed tests in Section 3 and Section 5 under various settings.

Gaussian noise
We first consider the case where the noise matrix H is a GOE matrix and the signal Rademacher random variable. Let the data matrix M = √ ωxx T + H. The parameters are w 2 = 2 and w 4 = 3.
Reject H 0 ; In the numerical simulation done in Matlab, we generated 10,000 independent samples of the 256 × 256 data matrix M under H 0 (without signal) and H 1 (with signal), respectively, varying SNR ω from 0 to 0.7. To apply Algorithm 1 proposed in Section 3, we computed and accepted H 0 if L ω ≤ − log(1 − ω) and rejected H 0 otherwise. The limiting error of the test is In Figure 3, we plot the histograms of the test statistic L ω under H 0 and under H 1 , respectively, with the test threshold − log(1 − ω) for ω = 0.4 and ω = 0.5. It can be shown that the difference of the means of L ω under H 0 and under H 1 is larger for ω = 0.5. In Figure 4, we plot empirical average (after 10,000 Monte Carlo simulations) of the error of test by Algorithm 1 and the theoretical error in (6.2). It can be shown that the error of the test closely matches the theoretical error.

Non-Gaussian noise
We next consider the case where the density function of the noise matrix is given by The parameters are w 2 = 1 and w 4 = 5. We perform the numerical simulation 10,000 samples of the 256 × 256 data matrix M with and without the signal, respectively, varying SNR ω from 0 to 0.7.
In Algorithm 1 proposed in Section 3, we compute and accept H 0 if L ω ≤ − log(1 − ω) + 3ω 2 8 and reject H 0 otherwise. The limiting error of the test is We can further improve the test by introducing the entrywise transformation given by The Fisher information F H is π 2 8 , which is strictly larger than 1. We first construct a pre-transformed matrix M by If ω > 1 F H = 8 π 2 , we can use PCA to reliably detect the signal. If ω < 8 π 2 , we compute the test statistic and reject H 0 otherwise. The limiting error with entrywise transformation is Since erfc(z) is a decreasing function of z and π 2 8 > 1, it is direct to see that the limiting error in (6.5) is strictly less than the limiting error in (6.4).
The result of the simulation can be seen from Figure 5, which shows that the error from Algorithm 2 is smaller than that of Algorithm 1, and both errors matches theoretical errors in (6.5) and (6.4).

Central Limit Theorems
In this section, we present our results on general CLTs for the LSS. The mean and the variance will be written in terms of Chebyshev polynomials (of the first kind) for which we use the following definition.
Definition 7.1 (Chebyshev polynomial). The n-th Chebyshev polynomial T n is a degree n polynomial defined inductively by T 0 (x) = 1, T 1 (x) = x, and It can also be defined by the orthogonality condition Our first result in this section is the CLT for the LSS with a general function f . , The mean and the variance of the limiting Gaussian distribution are given by where with the -th Chebyshev polynomial T .
We prove Theorem 7.2 in Section 7.3. and Recall that m H (f ) = m M (f ) if λ = 0. Our second result classifies all functions that are optimal for the hypothesis test.
The equality holds if and only if f = C 1 φ ω + C 2 for some constants C 1 and C 2 with the function φ ω defined in (3.2).
We prove Theorem 7.4 in Section 7.2.
The function of the form φ ω in (3.2) was considered by Banerjee and Ma for hypothesis testing in stochastic block models; see Remark 3.3 in [10]. Instead of using polynomial approximation of φ ω as in [10], we use φ ω itself since it is analytic for any , it implies that the signal is present with high probability.
Our result for the pre-transformed CLT is the following theorem: , The mean and the variance of the limiting Gaussian distribution are given by and The proof of Theorem 7.5 is contained in Appendix B.
Let m M0 (f ) be m M (f ) in (7.2) with λ = 0. For the transformed matrix M , we have the following result that corresponds to Theorem 7.4. Theorem 7.6. Assume the conditions in Theorem 7.5. Then Here, the equality holds if and only if f (x) = C 1 φ ω (x) + C 2 for some constants C 1 and C 2 with the function φ ω defined in (5.3). See Section 7.2 for the proof of Theorem 7.6.

Exceptional cases
In this subsection, we examine exceptional cases and introduce a feasible test statistic for each case.
Exceptional case 1: w 2 = 0 In this case, if τ 1 (f ) > 0 and τ (f ) = 0 for all ≥ 2, then V M (f ) = 0. It corresponds to choosing f (x) = x, and the test statistic is Tr M . Since w 2 = 0, the diagonal entries H ii vanish, hence from which we can recover λ.

Exceptional case 3: Biased spike
In this last exceptional case, we briefly consider a case that the signal can be reliably detected under a priori information on it. If the signal has a bias, i.e., for some N -independent constant c > 0, then we can consider the test statistic which can be easily checked by applying Chernoff's bound. Note that the condition in (7.6) is satisfied if √ N x i 's are independent random variables with mean c. We also remark that the test is not based on the spectrum of M .

Proof of Theorem 7.4 and Theorem 7.6
In this subsection, we prove Theorem 7.4 by applying Theorem 7.2. The proof of Theorem 7.6 is omitted since it is exactly same as the proof of Theorem 7.4 except that we use Theorem 7.5 instead of Theorem 7.2.
First, we notice that Assuming w 2 > 0 and w 4 > 1, by Cauchy's inequality, we obtain that which proves the first part of the theorem. Since we only used Cauchy's inequality, the equality in (7.10) holds if and only if We now find all functions f that satisfy (7.12). Letting 2C be the common value in (7.12), we rewrite (7.12) as Since f is analytic, we can consider the Taylor expansion of it. Using the Chebyshev polynomials, we can expand f as (7.14) Then, from the orthogonality relation of the Chebyshev polynomials, we get for ≥ 1 that Thus, (7.13) holds if and only if for some constant c 0 . It is well-known from the generating function of the Chebyshev polynomials that (See, e.g., (18.12.9) of [27].) Since T 1 (x) = x and T 2 (x) = 2x 2 − 1, we find that (7.16) is equivalent to This concludes the proof of Theorem 7.4.

Proof of Theorem 7.2
We adapt the strategy of Bai and Silverstein [3], and Bai and Yao [4]. In this method, we first express the left-hand side of (2.1) by using a contour integral via Cauchy's integration formula. The integral is then written in terms of the Stieltjes transforms of the empirical spectral measure and the semicircle measure.
Since the Stieltjes transform of the empirical spectral measure converges weakly to a Gaussian process, we find that the linear eigenvalue statistic also converges to a Gaussian random variable. Precise control of error terms requires estimates on the resolvents from random matrix theory, which are known as the local laws. Denote by ρ N the empirical spectral distribution of M , i.e., As N → ∞, ρ N converges to the Wigner semicircle measure ρ, defined by ρ(dx) = (4 − x 2 ) + 2π dx. (7.20) Choose (N -independent) constants a − ∈ (−3, −2), a + ∈ (2, 3), and v 0 ∈ (0, 1) so that the function f is analytic on the rectangular contour Γ whose vertices are (a − ± iv 0 ) and (a + ± iv 0 ). Since M → 2 almost surely, we assume that all eigenvalues of M are contained in Γ. Thus, from Cauchy's integral formula, we find that The procedure decouples the randomness of µ i and the function f , and we can solely focus on the randomness of µ i via the integral of the function (x − z) −1 with respect to the random measure ρ N (dx).
Let us recall the Stieltjes transform to handle the random integral of (x − z) −1 . For a measure ν and a variable z ∈ C + , the Stieltjes transform s ν (z) of ν is defined by We abbreviate s ρ N (z) ≡ s N (z). Then, (7.21) can be rewritten as Similarly, we also find that where we let s(z) = s ρ (z), the Stieltjes transform of the Wigner semicircle measure. Thus, we obtain that We remark that s(z) satisfies We use the results from the random matrix theory to analyze the right-hand side of (7.25). For z ∈ C + , define the resolvent R(z) of M by R(z) = (M − zI) −1 .

(7.27)
Note that the normalized trace of the resolvent satisfies As discussed in Section 1, Theorem 7.2 was proved in [7] for We introduce an interpolation between x and 1 as follows: Since x, 1 ∈ S N −1 , the (N − 1)-dimensional unit sphere, we can consider a parametrized curve y : [0, 1] → S N −1 , a segment of the geodesic on S N −1 joining x and 1 such that y(0) = x and y(1) = 1. We write y(θ) = (y 1 (θ), y 2 (θ), . . . , y N (θ)) T (7.30) and also define Our strategy of the proof is to show that the limiting distribution of ξ N (θ, z) does not change with θ. More precisely, we claim that uniformly on z ∈ Γ. Once we prove the claim, we can use the lattice argument to prove Theorem 7.2 as follows: Choose points z 1 , z 2 , . . . , z 16N ∈ Γ so that |z i − z i+1 | ≤ N −1 for i = 1, 2, . . . , 16N (with the convention z 16N +1 = z 1 ). For each z i , the claim (7.32) shows that For any z ∈ Γ, if z i is the nearest lattice point from z, then |z − z i | ≤ N −1 . From the Lipschitz continuity of ξ N , we then find |ξ N (θ, z) − ξ N (θ, z i )| = O(N −1 ) uniformly on z and z i . Hence, Now, integrating over Γ, we get This shows that the limiting distribution of the right-hand side of (7.25) does not change even if we change x into 1. Therefore, we get the desired theorem from Theorem 1.6 and Remark 1.7 of [7]. We now prove the claim (7.32). For the ease of notation, we omit the z-dependence in some occasions. Using the formula and the fact that M and R(θ) are symmetric, it is straightforward to check that where we use the notationẏ a ≡ẏ a (θ) = dya(θ) dθ . To estimate the right-hand side of (7.37), we first note that N a,b=1ẏ For the resolvents of the Wigner matrices, we have the following lemma from [22].  Then, for any deterministic v, w ∈ C N with v = w = 1, the following estimate holds uniformly on Proof of Lemma 7.7. We prove the lemma by using the results in [22]. If z = E + iη ∈ Γ for some E ∈ [a − − , a + + ] and η ∈ [v 0 − , v 0 + ], we get the estimate from Theorem 2.2 of [22] since the control parameter Ψ(z) in Equation (2.7) of [22] is bounded by This completes the proof of the lemma.

Conclusion and Future Works
In this paper, we proposed a hypothesis test for a signal detection problem in a rank-one spiked Wigner model. Based on the central limit theorem for the linear spectral statistics of the data matrix, we established a test statistic that does not require any prior information on the signal. The test and its error is independent of the noise matrix except the variance of the diagonal entries and the fourth moment of the off-diagonal entries. The error of the proposed test is the lowest among all tests based on the linear spectral statistics, and it also matches the error of the likelihood ratio test if the noise is Gaussian. When the density of the noise is known, we further improve the test by adapting the entrywise transformation introduced in [31]. An interesting future research direction is to extend the test to the case with a spike of higher ranks or spiked sample covariance matrices. We believe that it is possible to prove the central limit theorem for the linear statistics in these general models to which our test can be naturally extended. We also hope to generalize our results to the data matrix with non-Wigner noise, where the variances of off-diagonal entries of the noise matrix are not identical, including (sparse) stochastic block models.

Acknowledgements
We thank anonymous referees for their constructive comments that enabled us to improve the manuscript.
where φ λ is defined as in (3.2). Then, Proof. It is straightforward to see that To compute the integral in the definition of L λ , we use the formula for z > 2. See, e.g., Equation (8.5) of [6]. Putting z = (1 + λ)/ √ λ, we get Finally, it is elementary to check that and where φ λ is defined as in (3.2). Then, and Proof. Recall that φ λ is the function f in (7.18) with C = 1 and c 0 = ( 2 w4−1 − 1)λ. Thus, from (7.13), Moreover, (A.14) Moreover, we also find that which can be easily checked from (A.11).

B Proof of Theorem 7.5
Recall that the normalized off-diagonal entries √ N H ij are identically distributed with density g and the normalized diagonal entries N/w 2 H ii are identically distributed with density g d . In Assumption 5.1, we further assumed that the densities g and g d are smooth, positive everywhere, with subexponential tails, and symmetric (about 0). We also assumed that for some 3 8 < φ ≤ 1 2 . As discussed in Section 5, we consider the entrywise transformation defined by a function Further, with λ = 0, as shown in Proposition 4.2 of [31], where the equality holds if and only if √ N H ij is a standard Gaussian (hence h(w) = w). For the diagonal entries, we similarly define We define a transformed matrix M as follows: the off-diagonal terms of M are defined by Note that the entries of M are independent up to symmetry. Since g is smooth, h is also smooth and all moments of √ N M ij are O(1). Thus, applying a high-order Markov inequality, it is immediate to find that

B.1 Decomposition of the transformed matrix
We first evaluate the mean and the variance of each off-diagonal entry by using the comparison method with the pre-transformed entries. For i = j, we find that In the Taylor expansion for some θ ∈ (0, 1). Note that the second term and the fourth term in the summation are even functions. Since g /g is an odd function, from the symmetry we find that For the diagonal entries, we similarly get and We omit the detail. The evaluation of the mean and the variance shows that the transformed matrix M is not a spiked Wigner matrix when λ > 0, since the variances of the off-diagonal entries are not identical. Our strategy is to approximate M as a spiked generalized Wigner matrix for which the sum of the variances of the entries in each row is equal to 1. Let S be the variance matrix of M defined as which shows that M is indeed approximately a spiked generalized Wigner matrix.

B.2 CLT for a general Wigner-type matrix
To adapt the strategy of Section 7.3, we use the local law for general Wigner-type matrices in [2]. Consider a matrix W = (W ij ) 1≤i,j≤N defined by Next, we introduce an interpolation for W . For 0 ≤ θ ≤ 1, we define a matrix W (θ) by and then Theorem 1.7 of [2] asserts that the limiting distribution of R W ij (z) is m i (z)δ ij , where m i (θ, z) is the unique solution to the quadratic vector equation Recall that s(z) = (−z + √ z 2 − 4)/2 is the Stieltjes transform of the Wigner semicircle measure. It is direct to check that 1 + zs(z) + s(z) 2 = 0. With an ansatz m i (θ, z) = s(z) + C 1 x 2 i + C 2 N −1 , we can then find m i (θ, z) = s(z) + O( x 2 ∞ ); see also Theorem 4.2 of [2]. For the resolvent R W (θ, z), we have the following lemma from [2].
which is analogous to Lemma 7.7.
We have the following lemma for the difference between Tr R W (0, z) and Tr R W (1, z) on Γ 1/2 . 17) and (B.19). Then, the following holds uniformly for z ∈ Γ 1/2 : We will prove Lemma B.2 later in this section. On Γ\Γ 1/2 , we use the following results on the rigidity of eigenvalues.
Lemma B.3. Denote by µ W 1 (θ) ≥ µ W 2 (θ) ≥ · · · ≥ µ W N (θ) the eigenvalues of W (θ). Let γ i be the classical location of the eigenvalues with respect to the semicircle measure defined by for i = 1, 2, . . . , N . Then, Proof. See Corollary 1.11 of [2]. Note that it is O(N − 3 4 ), hence negligible, the difference between the semicircle measure and the limiting measure ρ in Equation (1.31) and Corollary 1.11 of [2], since uniformly for z ∈ Γ. Thus, from (B.23) and (B.26), is not a rank-1 matrix, we instead consider We follow the same strategy as in Section 7.3. For z ∈ Γ 1/2 , we use Recall that R A (0, z) = R W (1, z) satisfies the isotropic local law in (B.22), As in (7.43) and (7.44), we can easily check that We thus find that Plugging it back to (B.29) and applying Cauchy's integral formula again, we find that Now, integrating over θ, we get On Γ\Γ 1/2 , we use the interlacing property of the eigenvalues. Let E A 0 and E A 1 be the cumulative distribution functions for the eigenvalue counting measures of A(0) and A(1), respectively, i.e., if we let µ A i (θ) be the i-th eigenvalue of A(θ) and denote by µ A The interlacing property is that In terms of E A 0 , we can represent the trace of the resolvent R A (0, z) by where we used integration by parts with empirical spectral measure of A(0). Similarly, and we get Following the idea in (B.27), we obtain from (B.35) and (B.40) that (B.41)

B.4 CLT for a general Wigner-type matrix with a spike and small perturbation
While the rank-1 spike in A is √ λF H xx T , the mean of the diagonal entry for the constant C 3 in (B.8). By definition, B(0) = A(1) and We also set R B (θ, z) = (B(θ) − zI) −1 .
for a = 1, 2, . . . , N . Denote by e a a standard basis vector whose a-th coordinate is 1 and all other coordinates are zero. From (B.31), we find that Using the same argument again, we obtain that (B.52) By construction, for all i, j, Then, with high probability.
B.5 Proof of Theorem 7.5 and Theorem 7.6 We are now ready to prove Theorem 7.5. Denote by µ 1 ≥ µ 2 ≥ · · · ≥ µ N the eigenvalues of M . Recall that we denoted by µ W 1 (0) ≥ µ W 2 (0) ≥ · · · ≥ µ W N (0) the eigenvalues of W (0). From Cauchy's integral formula, as in (7.21), we have Since W is a Wigner matrix, the first term in the right-hand side converges to a Gaussian random variable.
To determine the mean and the variance of the limiting Gaussian distribution, we need to find the leading order term in the fourth moment of W ij . We compute as in (B.9) to obtain ij ] and w 4 is negligible in the sense that it has no contribitution in the limiting behavior of the resolvent, which can be checked from standard Green function comparison theorems. (See, e.g., Theorem 2.3 of [17].) Thus, the mean and the variance of the limiting Gaussian distribution are given by and respectively. For the second term in the right-hand side of (B.59), combining (B.27), (B.41), (B.52), (B.56), and (B.58), we obtain that with high probability. From (B.59), we thus find that the CLT for the LSS holds, i.e., and the variance V M (f ) = V W (f ) since the second term in (B.59) converges to a deterministic number as N → ∞, which corresponds to the change of the mean. In particular, Following the computation in the proof of Lemma 4.4 in [7] with the identity s (z) = s(z) 2 1−s(z) 2 , we find that the right-hand side of (B.65) is given by (B.66) (See also Remark 1.7 of [7].) This proves Theorem 7.5.

B.6 Proof of Lemma B.2
In this subsection, we prove Lemma B.2.

Notational remarks
In the rest of the section, we use C order to denote a constant that is independent of N . Even if the constant is different from one place to another, we may use the same notation C as long as it does not depend on N for the convenience of the presentation.
Proof of Lemma B.2. To prove the lemma, we consider Here, we used the properties that It remains to estimate the second term in the right-hand side of (B.73). Set We notice that |X| = O(N −1 ) on Γ 1/2 by a naive power counting as in (B.69). To obtain a better bound for X, we use a method based on a recursive moment estimate, introduced in [23]. We need the following lemma: Lemma B.4. Let X be as in (B.74). Define an event Ω by Then, for any fixed (large) D and (small) , which may depend on D, (B.75) We will prove Lemma B.4 at the end of this section. With Lemma B.4, we are ready to obtain an improved bound for X. First, note that P(Ω c ) < N −D 2 , which can be checked by applying a high-order Markov inequality with the moment condition on M (Assumption 5.1(iii)). We decompose E[|X| 2D ] by (B.76) The second term in the right-hand side of (B.76), the contribution from the exceptional event Ω c is negligible, where we used a trivial bound |R W ba | ≤ R W ≤ 1 Im z . From Young's inequality which holds for any a, b > 0 and p, q > 0 with 1 p + 1 q = 1, we find that (B.80) Absorbing the last term in the right-hand side to the left-hand side and plugging the estimates (B.77) and (B.78) into (B.76), we now get (B.81) For any fixed > 0 independent of D, from the (2D)-th order Markov inequality, Thus, by choosing D sufficiently large and = 1/D, we find that We now go back to (B.67) and use (B.73) with the bound |X| = O( √ N x 4 ∞ ). Since x ∞ = O(N −φ ) for some 3 8 To handle the derivative of the right-hand side, we use Cauchy's integral formula as in (7.49) with a rectangular contour, contained in Γ , whose perimeter is larger than . Then, we get from (B.67) that After integrating over θ from 0 to 1, we conclude that (B.23) holds for a fixed z ∈ Γ 1/2 . To prove the uniform bound in the lemma, we can use the lattice argument in Section 7.3; see Equations (7.32)-(7.35).
Finally, we prove the recursive moment estimate in Lemma B.4.
Proof of Lemma B.4. We consider For simplicity, we omit the θ-dependence and z-dependence of W ≡ W (θ) and R W ≡ R W (θ, z). We use the following inequality that generalizes Stein's lemma (see Proposition 5.2 of [8]): Let Φ be a C 2 function. Fix a (small) > 0, which may depend on D. Recall that Ω is the complement of the exceptional event on which |W ab | or |R W ba | is exceptionally large for some a, b, defined by (B.90) We plug it into (B.89) and estimate each term. We decompose the term originated from the first term in (B.90) as N a,b=1 (B.91) The first term satisfies that N a,b=1 for some constants C and C . We then find that N a,b=1 for some constant C. For the second term in (B.90), we also have N a,b=1 To estimate the third term and the fourth term in (B.90), we notice that on Ω ∂X ∂W ab = N i,j=1 for some constant C. Thus, we obtain that N a,b=1 and N a,b=1 (B.100) We want to compare Φ (W ab ) and Φ (tW ab ) for some |t| < 1. Let R W,t be the resolvent of W where W ab and W ba are replaced by tW ab and tW ba , respectively, and let X t be defined as X in (B.74) with the same replacement for W ab (and W ba ) and also R W is replaced by R W,t . Then, and X t − X = N i,j=1 This proves the desired lemma.