Skip to contents

Unified interface for computing reconstruction error for both MFA and MPCA models. Automatically detects model type from the fit object structure.

Usage

compute_reconstruction_error(
  list_of_data,
  fit,
  model_type = NULL,
  metric = c("sse", "rmse")
)

Arguments

list_of_data

A list of N matrices, each of dimension (T_i x M)

fit

A fitted model object (MFA or MPCA)

model_type

Character, either "MFA" or "MPCA". If NULL, auto-detected from the fit object structure.

metric

Character, one of "sse" (sum of squared errors) or "rmse" (root mean squared error). Default: "sse"

Value

A numeric scalar representing the reconstruction error

Examples

if (FALSE) { # \dontrun{
# Compute SSE
sse <- compute_reconstruction_error(list_of_data, fit)

# Compute RMSE
rmse <- compute_reconstruction_error(list_of_data, fit, metric = "rmse")
} # }