Solution (source code)

= Solution

Let $(\widehat\lambda_k,\widehat\phi_k)$ be the leading eigenpairs of the sample <covariance operator>. For fixed $K$ with $\lambda_1>\cdots>\lambda_K>\lambda_{K+1}$ and $\lambda_K>0$, the <FPCA mean test> uses
$$
T_{K,n}
=n\sum_{k=1}^K
\frac{\langle\overline X_n,\widehat\phi_k\rangle^2}
{\widehat\lambda_k}.
$$
Under the null, consistency of the empirical eigenpairs and the multivariate central limit theorem imply
$$
T_{K,n}\xrightarrow d\chi_K^2.
$$
The level-$\alpha$ test therefore rejects above the $(1-\alpha)$ quantile of the <chi-squared distribution> with $K$ degrees of freedom.

For a fixed mean $\mu$, if at least one leading coordinate $\langle\mu,\phi_k\rangle$, $k\leq K$, is nonzero, then $T_{K,n}\to\infty$ in probability and the test is consistent. It has only null-level asymptotic power against means orthogonal to the first $K$ principal component functions. Under $\mu_n=n^{-1/2}\delta$, the limit is noncentral chi-squared with noncentrality
$$
\sum_{k=1}^K\frac{\langle\delta,\phi_k\rangle^2}{\lambda_k}.
$$