Skip to contents

This function uses precomputed factor scores mpca_fit$factor_scores[[i]] (each T_i x r) and plots them over time, grouped by cluster z[i]. Optionally overlays all subjects in the same cluster on one facet, or can average them.

Usage

plot_all_factor_scores_mpca(
  mpca_fit,
  list_of_data,
  overlay_subjects = TRUE,
  muscle_names = NULL
)

Arguments

mpca_fit

A fitted MPCA model (with z, W, mu, etc.) plus factor_scores[[i]] if available.

list_of_data

A list of (T_i x M) data matrices (just for dimension reference).

overlay_subjects

Logical; if TRUE, all subjects in the same cluster are overlaid in the same facet. If FALSE, we can average them etc.

muscle_names

Optional character vector of muscle names for y-axis labels. If NULL, default channel names will be used.

Value

A ggplot object that shows the factor scores over time, with facets by (Cluster, Factor).

Examples

if (FALSE) { # \dontrun{
  mpca_fit <- compute_factor_scores_mpca(mpca_fit, list_of_data)
  p <- plot_all_factor_scores_mpca(mpca_fit, list_of_data, overlay_subjects=TRUE)
  print(p)
} # }