Skip to main content

f_perm_test

Function f_perm_test 

Source
pub fn f_perm_test(
    data_a: &FdMatrix,
    data_b: &FdMatrix,
    argvals: &[f64],
    n_perm: usize,
    seed: u64,
) -> Result<TestResult, FdarError>
Expand description

Functional two-sample permutation F-test (fda::Fperm.fd).

The k = 2 case of functional ANOVA: assembles a two-group problem from data_a (label 0) and data_b (label 1) and computes the integrated F-statistic via the shared integrated_f_statistic core (the same core used by crate::function_on_scalar::fanova). The permutation null relabels the pooled group membership via a seeded Fisher–Yates shuffle; the p-value is (#{perm >= observed} + 1) / (n_perm + 1).

§Arguments

  • data_a - First sample (n_a x m).
  • data_b - Second sample (n_b x m).
  • argvals - Evaluation points (length m), used only for input validation (the integrated F-statistic is a mean over grid points).
  • n_perm - Number of permutations (typical default: DEFAULT_N_PERM = 999).
  • seed - Deterministic RNG seed (StdRng::seed_from_u64(seed)).

§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 n_perm == 0.