Skip to main content

StatsCluster

Namespace: STATSLIB  ·  Library: Statistics Library

Python equivalent

mne.stats.permutation_cluster_test in MNE-Python.

#include <sts/sts_cluster.h>

class STSLIB::StatsCluster

Cluster-based permutation test for comparing two conditions.

Maris-Oostenveld cluster-mass permutation tests and Threshold-Free Cluster Enhancement on (channel,time) or (vertex,time) statistic maps.


Static Methods

permutationTest(dataA, dataB, adjacency, nPermutations, clusterAlpha, pThreshold, tail)

Cluster-based permutation test.

Parameters:

  • dataA : const QVector< Eigen::MatrixXd > & Per-subject data for condition A. Each matrix is nChannels x nTimes.

  • dataB : const QVector< Eigen::MatrixXd > & Per-subject data for condition B. Each matrix is nChannels x nTimes.

  • adjacency : const Eigen::SparseMatrix< int > & Spatial adjacency matrix (nChannels x nChannels).

  • nPermutations : int Number of permutations (default 1024).

  • clusterAlpha : double Alpha level for initial thresholding (default 0.05).

  • pThreshold : double p-value threshold for reporting significant clusters (default 0.05).

  • tail : StatsTailType Tail type for the test.

Returns:

  • StatsClusterResultStatsClusterResult with observed t-map, cluster statistics, and p-values.

oneSamplePermutationTest(data, adjacency, threshold, nPermutations, tail)

One-sample cluster-based permutation test.

Tests whether the mean across subjects differs from zero at each vertex x time point using sign-flip permutations.

Parameters:

  • data : const QVector< Eigen::MatrixXd > & Per-subject data. Each matrix is nVertices x nTimes.

  • adjacency : const Eigen::SparseMatrix< int > & Spatio-temporal adjacency matrix (nVerticesnTimes x nVerticesnTimes).

  • threshold : double Cluster-forming t-threshold.

  • nPermutations : int Number of sign-flip permutations.

  • tail : StatsTailType Tail type for the test.

Returns:

  • StatsClusterResultStatsClusterResult with observed t-map, cluster statistics, and p-values.

fTestPermutationTest(conditions, adjacency, threshold, nPermutations)

F-test cluster-based permutation test for one-way ANOVA.

Tests for differences across conditions by randomly reassigning condition labels and computing max cluster F-statistics.

Parameters:

  • conditions : const QVector< QVector< Eigen::MatrixXd > > & Vector of conditions, each containing per-subject matrices (nVertices x nTimes).

  • adjacency : const Eigen::SparseMatrix< int > & Spatio-temporal adjacency matrix (nVerticesnTimes x nVerticesnTimes).

  • threshold : double Cluster-forming F-threshold.

  • nPermutations : int Number of permutations.

Returns:

  • StatsClusterResultStatsClusterResult with observed F-map (in matTObs), cluster statistics, and p-values.

tfce(statMap, adjacency, E, H, nSteps)

Threshold-Free Cluster Enhancement (TFCE).

Enhances a statistic map by integrating cluster extent and height over a range of thresholds (Smith & Nichols 2009). Handles both positive and negative values.

Parameters:

  • statMap : const Eigen::MatrixXd & Statistic map (nVertices x nTimes).

  • adjacency : const Eigen::SparseMatrix< int > & Spatio-temporal adjacency matrix (nVerticesnTimes x nVerticesnTimes).

  • E : double Extent exponent (default 0.5).

  • H : double Height exponent (default 2.0).

  • nSteps : int Number of threshold steps (default 100).

Returns:

  • Eigen::MatrixXd — TFCE-enhanced score map (nVertices x nTimes).

Authors of this file