Yusuke Matsui (Nagoya University)
Muscle synergy analysis is often applied to reduce high-dimensional electromyographic (EMG) signals into a smaller set of “synergies” or activation patterns. Two mixture-based methods for identifying group-level synergies in heterogeneous populations are:
Both approaches can handle heterogeneous data, grouping subjects (or trials) into different synergy “clusters,” each with its own synergy loadings.
Compared to a single global factor/PCA decomposition, mixture-based approaches can uncover fundamentally different synergy patterns in subpopulations (e.g. half the subjects might use synergy pattern A, the other half synergy pattern B)
Cluster membership Each subject i belongs to one of K clusters with probability pi_k.
Factor model per cluster Within cluster k, each subject’s data X_i (dimension time x M) follows a low-dimensional factor model: X_i(t) = mu_k + Lambda_k * Z_i(t) + epsilon_{i,t}, where mu_k is the mean vector, Lambda_k is (M x r) factor loadings (synergy matrix), and epsilon_{i,t} ~ N(0, Psi_k) with Psi_k diagonal.
Similarly, we can define a mixture of probabilistic PCA (PPCA) models:
Cluster membership Each subject i belongs to one of K clusters with probability pi_k.
PCA model per cluster Data X_i(t) is modeled with X_i(t) = mu_k + W_k * Z_i(t) + epsilon_{i,t}, where W_k is (M x r). The noise is isotropic sigma^2_k * I.
Use cases:
All the provided functions assume:
Example:
Use mfa_em_fit() to fit an MFA model for fixed K
(clusters) and r (factors):
library(synergyMixR)
# Suppose we want K=2 clusters, r=3 factors
fit_mfa <- mfa_em_fit(
list_of_data = list_of_data,
K = 2,
r = 3,
max_iter = 50,
nIterFA = 5,
tol = 1e-3,
n_init = 1,
use_kmeans_init = TRUE
)This returns a fitted MFA object with elements like $z
(cluster assignments), $Lambda, $mu,
$Psi, etc.
Use mixture_pca_em_fit() similarly:
fit_mpca <- mixture_pca_em_fit(
list_of_data = list_of_data,
K = 2,
r = 3,
max_iter = 50,
nIterPCA = 20, # sub-iterations for the PCA updates
tol = 1e-3,
method = "EM", # or "closed_form"
n_init = 1,
use_kmeans_init = TRUE
)This returns an MPCA object, typically with $z,
$W or $P/$D, $mu,
$sigma2, $logLik, etc.
After mfa_em_fit(), you can visualize synergy
loadings:
# Heatmap of factor loadings
p_loadings <- plot_cluster_synergy_loadings_mfa(fit_mfa, plot_type="heatmap")
print(p_loadings)
# Factor scores (time evolution) per subject, faceted by cluster & factor
fit_mfa <- compute_factor_scores_mfa(fit_mfa, list_of_data)
p_scores <- plot_all_factor_scores_mfa(fit_mfa, list_of_data, overlay_subjects=TRUE)
print(p_scores)Similar calls for MPCA:
# Heatmap of loadings W
p_loadings_mpca <- plot_cluster_synergy_loadings_mpca(fit_mpca, plot_type="heatmap")
print(p_loadings_mpca)
# Factor scores
fit_mpca <- compute_factor_scores_mpca(fit_mpca, list_of_data)
p_scores_mpca <- plot_all_factor_scores_mpca(fit_mpca, list_of_data, overlay_subjects=TRUE)
print(p_scores_mpca)If you do not know the best (K, r) in advance, you can search over a grid:
search_res_mpca <- select_optimal_K_r_mpca(
list_of_data,
Kvec = 1:5,
rvec = 1:5,
max_iter = 50,
nIterPCA = 20,
tol = 1e-3,
method = "EM",
n_init = 1,
use_kmeans_init = TRUE
)
search_res_mpca$summary
search_res_mpca$best_model_infoBoth select_optimal_K_r_mfa() and
select_optimal_K_r_mpca() compute a BIC for each
combination, returning the best by BIC.
Once you identify the best (K, r), you can:
Extract the best model:
Optionally re-run with more initializations, stricter tolerances, or greater iteration limits.
Using MFA or MPCA in a mixture setting can substantially enhance your ability to discover and interpret distinct synergy patterns in heterogeneous EMG datasets.