Skip to contents

Applies a chosen rotation (e.g. varimax) to each cluster's loading matrix W[[k]] in a fitted MPCA model, optionally also rotating the subject factor scores in factor_scores[[i]].

Usage

rotate_mpca_model(
  mpca_fit,
  rotation = c("varimax"),
  rotate_scores = FALSE,
  cluster_ids = NULL
)

Arguments

mpca_fit

A fitted MPCA model, e.g. returned by mixture_pca_em_fit() or select_optimal_K_r_mpca()$best_model_info$model, typically containing:

  • W[[k]]: (M x r) loadings for cluster k

  • factor_scores[[i]]: optional (T_i x r) PC scores for subject i

  • z[i]: cluster assignments

rotation

Rotation method, e.g. "varimax".

rotate_scores

Logical; if TRUE, also rotate factor_scores if present.

cluster_ids

Vector of cluster indices to rotate. Defaults to all.

Value

A new MPCA model object with W[[k]] rotated, and factor_scores also rotated if requested and available.

Details

In R's stats::varimax(), the matrix should have rows = variables, cols = factors. If W_k is already (M x r), then passing it directly to varimax means we have M variables, r factors. The returned rotation matrix is (r x r), and scores_i (T_i x r) can be multiplied by that.