pub fn concurrent_regression(
response: &FdMatrix,
predictors: &[FdMatrix],
argvals: Option<&[f64]>,
bandwidth: f64,
kernel: &str,
) -> Result<ConcurrentRegrResult, FdarError>Expand description
Concurrent (varying-coefficient) functional regression.
Fits the model y_i(t) = β₀(t) + Σₖ βₖ(t)·xₖᵢ(t) + εᵢ(t) for a
dense shared grid of m evaluation points and p ≥ 1 functional
predictors. Estimation follows the fdaconcur two-step convention:
pointwise OLS at each grid column, then local-linear kernel smoothing of
the resulting discrete coefficient sequences.
§Arguments
response— Functional response matrix (n × m).predictors— Slice of functional predictor matrices, each (n × m), all evaluated on the same shared grid.argvals— Shared evaluation grid (length m); ifNone, a uniform 0..1 grid is used (project-wide convention).bandwidth— Kernel bandwidth for β(t) smoothing (must be positive). Larger values yield smoother coefficient curves.kernel— Kernel type:"gaussian"(default),"epanechnikov","tricube". Passed directly tocrate::smoothing::local_linear.
§Errors
Returns FdarError::InvalidDimension if:
predictorsis empty,responsehas fewer than 2 rows or zero columns,responsehas at most as many rows as there are predictors (n <= p), which would make each per-column design matrix underdetermined,- any predictor’s shape does not match
(n, m), or argvalsisSomewith a length different fromm.
Returns FdarError::InvalidParameter if bandwidth is not strictly
positive (i.e., zero, negative, f64::NAN, or f64::INFINITY).
§Notes
A small ridge regulariser (eps = 1e-10 * (n + 1)) is applied to the
diagonal of each column’s normal equations to prevent numerical blow-up
when predictors are collinear at a grid point.