Skip to main content

impute_missing_values

Function impute_missing_values 

Source
pub fn impute_missing_values(
    data: &FdMatrix,
    argvals: &[f64],
    method: ImputationMethod,
) -> Result<FdMatrix, FdarError>
Expand description

Impute NaN values in a regular functional data matrix.

Returns a new FdMatrix with NaN entries replaced according to method. Non-NaN entries are copied through unchanged.

For Linear, gaps at the curve boundary (no neighbor on one side) are filled with the nearest valid value (boundary extension).

§Arguments

  • data — Functional data matrix (n × m) with possible NaN entries
  • argvals — Evaluation points (length m, must be sorted)
  • method — Imputation strategy

§Errors

  • FdarError::InvalidDimension if argvals.len() != data.ncols()
  • FdarError::InvalidParameter if any curve consists entirely of NaN values