A Julia package for cluster-based permutation testing on time-series data. Cluster permutation tests are a nonparametric approach widely used in neuroscience (EEG, ERP, fMRI) and psycholinguistics to identify significant temporal effects while naturally controlling the family-wise error rate across many time points.
Documentation: https://lindemann09.github.io/ClusterPermutationTests.jl
(C) 2024 Oliver Lindemann, Erasmus University Rotterdam.
The test proceeds in three steps:
- Fit a statistical model at every time point — t-test, linear regression, or linear mixed model.
- Detect clusters — contiguous windows where the test statistic exceeds a threshold.
- Build a null-hypothesis distribution via permutation — shuffle the condition labels, refit, and record the maximum cluster mass. Repeat thousands of times. The p-value of each observed cluster is its quantile rank against this distribution.
Compared to mass-univariate correction methods (Bonferroni, FDR), the cluster approach exploits the temporal autocorrelation that is intrinsic to physiological time series and typically has greater power when effects span multiple consecutive time points.
| Type | Constructor |
|---|---|
| Paired-samples t-test | CPPairedSampleTTest |
| Independent-samples t-test (equal variances) | CPEqualVarianceTTest |
| Welch's t-test (unequal variances) | CPUnequalVarianceTTest |
| OLS linear regression | CPLinearModel |
| Linear mixed-effects model | CPMixedModel |
| ANOVA F-test from mixed model | CPAnovaMixedModel |
All model types share the same interface: fit → resample! → cluster_table.
using Pkg
Pkg.add("ClusterPermutationTests")An optional plotting extension for Makie.jl is available.
Pkg.add("Makie") # file I/O- HypothesisTests.jl — t-test implementations used internally
- MixedModels.jl — mixed-effects models used internally for
CPMixedModel
MIT License. See LICENSE for details.