Plot Reconstructed Waveforms for All Clusters and Channels (MPCA)
Source:R/visualization.R
plot_all_reconstructed_waveforms_mpca.RdThis function plots the reconstructed waveforms (Xhat_i) for each subject across all channels, grouped by cluster. By default, it overlays all subjects in the same cluster, then uses facet to separate by (Cluster, Channel).
Usage
plot_all_reconstructed_waveforms_mpca(
mpca_fit,
list_of_data,
overlay_subjects = TRUE,
muscle_names = NULL
)Arguments
- mpca_fit
A fitted MPCA model (with z, W, mu, etc.). Also
factor_scores[[i]]must be available if we want to reconstruct Xhat.- list_of_data
A list of (T_i x M) data matrices used in fitting.
- overlay_subjects
Logical; if TRUE, each subject in the same cluster is drawn in the same facet. If FALSE, the function computes the average waveforms across subjects in each cluster.
- muscle_names
Optional character vector of muscle names for y-axis labels. If NULL, default channel names will be used.
Examples
if (FALSE) { # \dontrun{
mpca_fit <- compute_factor_scores_mpca(mpca_fit, list_of_data)
p_recon <- plot_all_reconstructed_waveforms_mpca(mpca_fit, list_of_data)
print(p_recon)
} # }