Skip to contents

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

Usage

compute_VAF(list_of_data, fit, model_type = NULL)

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.

Value

A numeric scalar representing the global VAF (0 to 1)

Details

VAF is computed as 1 - SSE/SST, where SSE is the sum of squared errors between observed and reconstructed data, and SST is the total sum of squares.

Examples

if (FALSE) { # \dontrun{
# Works with either MFA or MPCA fit objects
vaf <- compute_VAF(list_of_data, fit)

# Or explicitly specify model type
vaf <- compute_VAF(list_of_data, fit, model_type = "MFA")
} # }