Mixture-based muscle synergy analysis on PhysioExperiment objects
Source:R/emg-synergy-mixture.R
physioSynergyMixture.RdThin entry point that runs muscleSynergyMixture() directly on ecosystem
data: it reads each subject's time x muscle activation from a
PhysioExperiment (or accepts matrices) and fits the subgroup mixture.
Usage
physioSynergyMixture(
pe_list,
n_clusters,
n_factors,
method = c("mfa", "mpca"),
assay_name = NULL,
...
)Arguments
- pe_list
A list with one element per subject, each a
PhysioExperiment(its assay is read) or atime x musclematrix.- n_clusters, n_factors
Number of subgroups and synergies (factors).
- method
"mfa"or"mpca"(seemuscleSynergyMixture()).- assay_name
Assay to read from each PhysioExperiment (default: its default assay).
- ...
Further arguments passed to
muscleSynergyMixture().
Examples
set.seed(1)
mk <- function(L) {
pe <- PhysioCore::PhysioExperiment(
assays = list(raw = t(L %*% matrix(rnorm(2 * 50), 2, 50) +
matrix(rnorm(6 * 50, 0, .3), 6, 50))),
samplingRate = 100)
pe
}
LA <- matrix(abs(rnorm(12)), 6, 2); LB <- matrix(abs(rnorm(12)), 6, 2)
pes <- c(replicate(5, mk(LA), simplify = FALSE),
replicate(5, mk(LB), simplify = FALSE))
fit <- physioSynergyMixture(pes, n_clusters = 2, n_factors = 2, seed = 1)
fit$cluster
#> [1] 1 1 1 1 1 2 2 2 2 2