pub fn pace_fpca(
data: &IrregFdata,
config: &PaceFpcaConfig,
) -> Result<PaceFpcaResult, FdarError>Expand description
Fit PACE sparse FPCA for irregularly sampled functional data.
Implements the Yao–Müller–Wang (2005) PACE estimator:
- Kernel-smoothed mean µ̂(t) on the work grid.
- Kernel-smoothed covariance surface Ĝ(s,t) via
cov_irreg. - Symmetric eigendecomposition of Ĝ → eigenvalues λ_k, eigenfunctions φ_k.
- Per-curve BLUP (conditional-expectation) scores ξ_ik.
- Fitted trajectories x̂_i(t) = µ̂(t) + Σ_k ξ_ik φ_k(t).
- Pointwise confidence bands from BLUP prediction variance.
§Errors
Returns FdarError::InvalidDimension if:
datahas zero observations,- any curve has fewer than 2 observed points (PACE requires at least 2 per curve),
config.work_gridhas fewer than 2 points.
Returns FdarError::InvalidParameter if:
config.ncompis zero,config.bandwidthis not strictly positive or not finite,config.sigma2is not strictly positive or not finite,config.alphais not in the open interval (0, 1),config.work_gridis not sorted or contains non-finite values.
Returns FdarError::ComputationFailed if:
mean_irregreturns non-finite values (bandwidth too narrow for the data range),- no positive eigenvalues are found after eigendecomposing the covariance surface,
- a per-curve Σ_yi Cholesky solve fails even after a single ridge-stabilisation retry.