Skip to contents

This function takes a fitted MFA model (with elements z, mu, Lambda, Psi) and reconstructs all subjects' data from the factor scores, computing the ratio of explained variance (\(1 - \mathrm{SSE}/\mathrm{SST}\)).

Usage

compute_global_vaf_mfa(list_of_data, res)

Arguments

list_of_data

A list of matrices, each (T_i x M), containing the original data.

res

A fitted MFA model result. It must contain:

  • z: A length-N vector of cluster assignments (1..K).

  • mu: A list of length K, each a mean vector of length M.

  • Lambda: A list of length K, each an M x r loading matrix.

  • Psi: A list of length K, each an M x M diagonal matrix.

Value

A numeric scalar for the global variance accounted for, \(1 - \mathrm{SSE}/\mathrm{SST}\).

Details

For each subject i, we identify its cluster assignment k_i, compute factor scores via compute_factor_scores, reconstruct Xhat from the factor model, accumulate the sum of squares of residuals (SSE), and the sum of squares total (SST).

Examples

if (FALSE) { # \dontrun{
gvaf <- compute_global_vaf_mfa(my_data_list, fit_mfa)
cat("Global VAF:", gvaf, "\n")
} # }