pub fn two_sample_mean_test(
data_a: &FdMatrix,
data_b: &FdMatrix,
argvals: &[f64],
ncomp: usize,
) -> Result<TestResult, FdarError>Expand description
Functional two-sample mean-equality test via Hotelling-T² on a shared FPC
basis (fda.usc-style mean equality).
Both samples are projected onto a common FPC basis fitted on the pooled
data. The Hotelling-T² statistic is formed on the difference of the two
group score-means, scaled by the effective sample size
sqrt(n_a · n_b / (n_a + n_b)) so that under the null the statistic is
asymptotically χ²(ncomp). The p-value is the χ²(ncomp) upper-tail
probability of the observed statistic.
The eigenvalues fed to hotelling_t2 are derived from the pooled FPCA
singular values via eigenvalue = sv² / (n_pooled − 1) (the mfpca
convention).
§Arguments
data_a- First sample (n_a x m).data_b- Second sample (n_b x m).argvals- Evaluation points (lengthm).ncomp- Number of FPC components for the shared basis.
Returns a TestResult with n_perm = 0 (non-permutation path).
§Errors
Returns FdarError::InvalidDimension if the two samples have unequal or
zero column counts, if argvals.len() does not match the column count, or
if either sample has fewer than 2 rows. Returns
FdarError::InvalidParameter if ncomp < 1. Propagates errors from
fdata_to_pc_1d / hotelling_t2.