Skip to contents

Given a fitted MFA model (with z, mu, Lambda, Psi for each cluster), this function computes the posterior factor scores Z_i(t) for each subject i and stores them in model$factor_scores[[i]].

Usage

compute_factor_scores_mfa(mfa_fit, list_of_data)

Arguments

mfa_fit

A fitted MFA model, typically from mfa_em_fit() or select_optimal_K_r_mfa()$best_model_info$model, containing:

  • z[i]: cluster assignments,

  • Lambda[[k]], Psi[[k]], mu[[k]] for each cluster k.

list_of_data

The same list of data (T_i x M) used to fit the model.

Value

The same mfa_fit object, but with a new element factor_scores (a list of length N), where each factor_scores[[i]] is a (T_i x r) matrix of factor scores for subject i.

Details

Internally, it calls compute_factor_scores_optimized for each subject, using that subject's assigned cluster k = z[i].

Examples

if (FALSE) { # \dontrun{
mfa_fit <- compute_factor_scores_mfa(mfa_fit, list_of_data)
# Now mfa_fit$factor_scores[[i]] is available for each subject i
} # }