Skip to contents

This function computes the Variance Accounted For (VAF) for a fitted MFA model across all subjects, reconstructing each subject's data via factor scores and summing squared errors.

Usage

compute_VAF_mfa(list_of_data, mfa_fit, z)

Arguments

list_of_data

A list of subject data matrices, each (T_i x M).

mfa_fit

An MFA fit object containing Lambda, Psi, mu, etc.

z

An integer vector of length N specifying each subject's cluster ID (1..K).

Value

A numeric scalar representing the total VAF over all subjects.

Examples

if (FALSE) { # \dontrun{
sim <- simulate_mixture_data(N = 50, K = 3, r = 2, M = 6, T_each = 100)
fit <- mfa_em_fit(sim$list_of_data, K = 3, r = 2)
vaf <- compute_VAF_mfa(sim$list_of_data, fit, fit$z)
print(vaf)
} # }