Skip to contents

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

Usage

compute_factor_scores_mpca(mpca_fit, list_of_data)

Arguments

mpca_fit

A fitted MPCA model from mixture_pca_em_fit() or select_optimal_K_r_mpca()$best_model_info$model, typically containing:

  • z[i]: cluster assignments (1..K),

  • mu[[k]], W[[k]], sigma2[k] for each cluster,

  • possibly P[[k]], D[[k]] instead of W[[k]].

list_of_data

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

Value

The same mpca_fit object, but with a new element factor_scores, where factor_scores[[i]] is a (T_i x r) matrix of PC scores for subject i.

Details

We use compute_factor_scores_mpca_single for each subject, with the appropriate cluster parameters. This assumes isotropic noise sigma2[k] for cluster k.

Examples

if (FALSE) { # \dontrun{
mpca_fit <- compute_factor_scores_mpca(mpca_fit, list_of_data)
mpca_fit$factor_scores[[1]]  # (T_1 x r) PC scores
} # }