Skip to main content

predict_functional_glm

Function predict_functional_glm 

Source
pub fn predict_functional_glm(
    fit: &FunctionalGlmResult,
    new_data: &FdMatrix,
    new_scalar: Option<&FdMatrix>,
) -> Result<Vec<f64>, FdarError>
Expand description

Predict response for new functional data using a fitted GLM.

Projects new curves through the stored FPCA, computes the linear predictor, and applies the inverse link: μ = g⁻¹(η).

§Arguments

  • fit — A fitted FunctionalGlmResult
  • new_data — New functional predictor matrix (n_new × m), where m MUST equal the training grid length
  • new_scalar — Optional new scalar covariates (n_new × p)

§Errors

Returns FdarError::InvalidDimension if new_data’s column count differs from the training grid length, or if new_scalar’s shape does not match the fitted model’s scalar-covariate count (or is missing when the model has scalar covariates). This prevents out-of-bounds indexing / silent truncation.