pub fn fplsr(
data: &FdMatrix,
ncomp: usize,
argvals: &[f64],
) -> Result<FplsrResult, FdarError>Expand description
Functional PLS forecasting variant (a PLS-score alternative to FPC-score AR).
Fits a lag-1 PLS design — predictor = current curve (rows 0..n-2), response
= next curve (rows 1..n-1) — and forecasts the next curve one step ahead.
Because the shipped PLS machinery (crate::scalar_on_function::fregre_pls)
takes a scalar response, the functional (curve) response is handled by fitting
one scalar PLS regression per evaluation point (Option A of the research
note): for each grid point j, the next-curve column j is regressed on the
current curve via PLS, the in-sample fits populate column j of fitted, and
the last observed curve is projected + predicted to give the forecast at j.
§Divergence from ftsa
ftsa::fplsr uses a unified NIPALS/SIMPLS functional operator; this
implementation uses per-evaluation-point scalar PLS regression (functionally
equivalent for point prediction, less elegant). Deterministic — no RNG.
§Errors
Returns FdarError::InvalidDimension for empty data / mismatched argvals,
and FdarError::InvalidParameter for ncomp == 0 or n < 3 (need at least
two lag-1 rows plus a forecast origin). PLS/rank failures propagate as
FdarError::ComputationFailed.