Skip to main content

pace_fpca

Function pace_fpca 

Source
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:

  1. Kernel-smoothed mean µ̂(t) on the work grid.
  2. Kernel-smoothed covariance surface Ĝ(s,t) via cov_irreg.
  3. Symmetric eigendecomposition of Ĝ → eigenvalues λ_k, eigenfunctions φ_k.
  4. Per-curve BLUP (conditional-expectation) scores ξ_ik.
  5. Fitted trajectories x̂_i(t) = µ̂(t) + Σ_k ξ_ik φ_k(t).
  6. Pointwise confidence bands from BLUP prediction variance.

§Errors

Returns FdarError::InvalidDimension if:

  • data has zero observations,
  • any curve has fewer than 2 observed points (PACE requires at least 2 per curve),
  • config.work_grid has fewer than 2 points.

Returns FdarError::InvalidParameter if:

  • config.ncomp is zero,
  • config.bandwidth is not strictly positive or not finite,
  • config.sigma2 is not strictly positive or not finite,
  • config.alpha is not in the open interval (0, 1),
  • config.work_grid is not sorted or contains non-finite values.

Returns FdarError::ComputationFailed if:

  • mean_irreg returns 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.