Skip to main content

flm_f_test

Function flm_f_test 

Source
pub fn flm_f_test(fit: &FregreLmResult) -> Result<TestResult, FdarError>
Expand description

Overall-significance F-test for a fitted functional linear model.

Tests the null hypothesis H0 that the functional coefficient has no effect — i.e. the FLM reduces to an intercept-only model. The statistic is the classical regression F built from the model R²:

F = (R² / p) / ((1 − R²) / (n − p − 1))

where p = fit.ncomp is the number of effective FPC parameters and n = fit.residuals.len() is the sample size. Under H0, F follows an F(p, n − p − 1) distribution, so the p-value is the F upper-tail (survival) probability of the observed statistic. A small p-value rejects H0 in favour of a genuine functional effect.

Returns a TestResult with n_perm = 0 (this is an asymptotic / closed-form test, not a permutation test).

§Errors

Returns FdarError::InvalidParameter when the fit is degenerate: ncomp is zero, the denominator degrees of freedom n − p − 1 are non-positive, or r_squared is not finite or is >= 1.0 (a perfect fit makes the F statistic ill-defined).