Simulate Dynamic Synergy Data with Three Orthogonal Control Axes
Source:R/simulation_dynamic.R
simulate_dynamic_synergy_data.RdThis function extends simulate_dynamic_synergy_data() to systematically
evaluate how different motor control strategies affect muscle synergy structures.
The simulation model includes three orthogonal control axes:
(1) Spatial structure, (2) Temporal coordination, and (3) Stability-Adaptability.
These axes represent complementary aspects of motor control diversity observed
in both rehabilitation and sports science contexts.
Arguments
- N
Number of subjects (time series). Default is 30.
- K
Number of clusters (subgroups). Default is 3.
- r
Number of synergies per cluster. Default is 3.
- M
Number of observed channels (muscles). Default is 8.
- T_each
Time-series length per subject. Default is 200.
- cluster_sep_spatial
Numeric scalar (0-2) controlling spatial structure differentiation between clusters. Higher values create more distinct spatial modules. Default is 1.0.
- cluster_sep_temporal
Numeric scalar (0-2) controlling temporal coordination differentiation between clusters. Higher values create more distinct temporal patterns. Default is 1.0.
- cluster_sep_stability
Numeric scalar (0-2) controlling stability-adaptability differentiation between clusters. Higher values create more distinct noise profiles. Default is 1.0.
- freq_range
Numeric vector of length 2 specifying the range of base frequencies (in Hz) for the periodic activation signals. Default is c(0.5, 3.0).
- amp_range
Numeric vector of length 2 specifying the range of amplitudes for the periodic activation signals. Default is c(0.5, 1.5).
- base_level
Numeric scalar specifying the baseline activation level added to C(t) to avoid all-zero activations. Default is 0.05.
- rectify_output
Logical; if TRUE, apply half-wave rectification to X(t) to produce non-negative EMG-like signals. Default is TRUE.
- seed
Random seed for reproducibility. Default is 123.
Value
A list with the following components:
X_listList of length N; each element is a (T_each x M) matrix of generated EMG signals.
C_listList of length N; each element is a (T_each x r) matrix of synergy activation signals.
Lambda_listList of length K; each element is a (M x r) matrix of cluster-specific synergy loadings (non-negative).
z_trueInteger vector of length N indicating true cluster assignments (1 to K).
spatial_paramsList containing spatial structure parameters for each cluster (bias patterns).
temporal_paramsList containing temporal coordination parameters for each cluster (frequencies, phase offsets).
stability_paramsList containing stability-adaptability parameters for each cluster (noise levels, filter lengths).
Details
Each cluster (k = 1, ..., K) is assigned a unique combination of parameters along these three axes, emulating distinct movement control strategies (e.g., proximal-dominant, alternating coordination, or adaptive noisy control).
Spatial Structure Axis
The spatial axis defines how strongly each muscle group contributes to each synergy component. For each cluster k, the synergy matrix (Lambda_k) is generated with cluster-specific bias patterns (B_k) that shift the activation balance among proximal, distal, or antagonistic muscle groups.
The parameter cluster_sep_spatial controls the degree of differentiation
between clusters, ranging from 0 (identical synergy weights) to 2 (strongly
distinct spatial modules).
Temporal Coordination Axis
The temporal axis governs how synergies are activated over time, including their onset timing, overlap, and rhythmic frequency. For each cluster, the activation matrix C_i^(k)(t) is generated with cluster-specific frequencies (f_k) and phase offsets (phi_ij^(k)).
Three representative temporal coordination modes:
Cluster 1: Co-contraction/rigid (all synergies in-phase, strong overlap)
Cluster 2: Alternating/efficient (phases evenly distributed, minimal overlap)
Cluster 3: Adaptive/reactive (random phases, heterogeneous frequencies)
The parameter cluster_sep_temporal (0-2) scales the magnitude of
inter-cluster differences in phase and frequency.
Stability-Adaptability Axis
The stability axis introduces physiological and measurement variability into the EMG signal. Each cluster k is assigned distinct noise parameters to simulate differences in control precision and adaptability.
Three representative control profiles:
Cluster 1: Stable control (minimal noise, elite or late rehab)
Cluster 2: Moderate control (balanced smoothness vs flexibility)
Cluster 3: Adaptive/exploratory (variable, early rehab or fatigue)
Examples
if (FALSE) { # \dontrun{
# Basic usage with default parameters
sim_v2 <- simulate_dynamic_synergy_data(
N = 30, K = 3, r = 3, M = 8, T_each = 200
)
# High spatial separation, low temporal separation
sim_spatial <- simulate_dynamic_synergy_data(
N = 30, K = 3, r = 3, M = 8, T_each = 200,
cluster_sep_spatial = 2.0,
cluster_sep_temporal = 0.5,
cluster_sep_stability = 1.0,
seed = 456
)
# Factorial design: 3x3x3 combinations
spatial_levels <- c(0.5, 1.0, 2.0)
temporal_levels <- c(0.5, 1.0, 2.0)
stability_levels <- c(0.5, 1.0, 2.0)
results <- list()
idx <- 1
for (sp in spatial_levels) {
for (tp in temporal_levels) {
for (st in stability_levels) {
results[[idx]] <- simulate_dynamic_synergy_data(
N = 30, K = 3, r = 3, M = 8, T_each = 200,
cluster_sep_spatial = sp,
cluster_sep_temporal = tp,
cluster_sep_stability = st,
seed = 100 + idx
)
idx <- idx + 1
}
}
}
} # }