Skip to contents

This function enables pure method-level benchmarking by generating data using only the v2 dynamic synergy simulator and applying all six analysis methods (SingleFA, SinglePCA, TwoStep_FA, TwoStep_PCA, MixtureFA, MixturePCA). This complements compare_static_vs_dynamic by focusing on method performance rather than model comparison.

Usage

compare_baselines(
  N = 50,
  K = 2,
  r = 2,
  M = 6,
  T_each = 100,
  cluster_sep_spatial = 1,
  cluster_sep_temporal = 1,
  cluster_sep_stability = 1,
  seed = 123,
  n_init = 1,
  use_kmeans_init = FALSE,
  mc_cores = 1,
  method_pca = "EM",
  align_basis = TRUE,
  refine_assignments = TRUE
)

Arguments

N

Number of subjects (time series). Default is 50.

K

Number of clusters. Default is 2.

r

Number of synergies (factor dimension). Default is 2.

M

Number of observed channels (muscles). Default is 6.

T_each

Time-series length per subject. Default is 100.

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.

seed

Random seed for data generation. Default is 123.

n_init

Number of random initializations for mixture methods. Default is 1.

use_kmeans_init

Logical; if TRUE, also try k-means initialization. Default is FALSE.

mc_cores

Number of cores for parallel computation. Default is 1.

method_pca

Method for PCA fitting. Default is "EM".

align_basis

Logical. If TRUE (default), applies Hungarian algorithm alignment in Step 1.5 of TwoStep methods to ensure corresponding components across subjects are in the same order before clustering. Set to FALSE to disable alignment and compare performance with/without this step.

refine_assignments

Logical. If TRUE (default), performs a single reassignment pass after fitting cluster-specific models in Step 4 of TwoStep methods. Each subject is reassigned to the cluster that minimizes reconstruction error. Set to FALSE to disable reassignment and use only the initial k-means cluster assignments.

Value

A data frame with the following columns:

Method

Analysis method name (e.g., "MixtureFA", "SinglePCA")

BIC

Bayesian Information Criterion

ARI

Adjusted Rand Index (clustering accuracy)

SSE

Sum of Squared Errors (reconstruction error)

VAF

Variance Accounted For (1 - SSE/totalSST)

model_type

Always "Dynamic_v2" for this function

seed

Random seed used for data generation

cluster_sep_spatial

Spatial separation parameter

cluster_sep_temporal

Temporal separation parameter

cluster_sep_stability

Stability separation parameter

N

Number of subjects

K

Number of clusters

r

Number of synergies

M

Number of muscles

T_each

Time series length

Details

This function generates data using simulate_dynamic_synergy_data with three orthogonal control axes (spatial, temporal, stability), then applies all six analysis methods to evaluate their performance. This is useful for:

  • Method benchmarking on realistic dynamic synergy data

  • Parameter sensitivity analysis for method performance

  • Integration with run_param_sweep for systematic evaluation

The function complements compare_static_vs_dynamic by focusing on method performance rather than model comparison. Together, these functions provide comprehensive evaluation of both models and methods.

See also

compare_static_vs_dynamic for model comparison, run_param_sweep for systematic parameter sweep, simulate_dynamic_synergy_data for data generation

Examples

if (FALSE) { # \dontrun{
# Basic method comparison on v2 data
results <- compare_baselines(
  N = 50, K = 2, r = 2, M = 6, T_each = 100,
  cluster_sep_spatial = 1.0,
  cluster_sep_temporal = 1.0,
  cluster_sep_stability = 1.0,
  seed = 123
)
print(results)

# Compare methods with high spatial separation
results_spatial <- compare_baselines(
  N = 50, K = 2, r = 2, M = 6, T_each = 100,
  cluster_sep_spatial = 2.0,
  cluster_sep_temporal = 0.5,
  cluster_sep_stability = 1.0,
  seed = 456
)

# Visualize method performance
library(ggplot2)
ggplot(results, aes(x = Method, y = ARI)) +
  geom_bar(stat = "identity", fill = "steelblue") +
  labs(title = "Method Performance on v2 Dynamic Data")
} # }