Statistical Inference

Statistical inference for TRF analysis.

This module provides nonparametric statistical methods for temporal response function (TRF) analysis, complementing the parametric tvals_/pvals_ path in pyeeg.models.TRFEstimator.

The primary methods are:

  • permutation_test_trf(): circular-shift permutation test with FWE correction via the max-statistic.

  • cluster_based_permutation_test(): cluster-based correction (Maris & Oostenveld 2007) on top of the permutation engine.

  • bootstrap_ci_trf(): paired block-bootstrap confidence intervals.

  • cross_subject_consistency(): descriptive cross-subject reliability.

  • group_level_test(): sign-flip group-level inference on coefficient maps.

The default statistic is stat="zscore": the stats function internally z-scores each input feature of X and each channel of y before lag construction and fitting, producing a scale-standardised coefficient that is mathematically clean for any solver (OLS, ridge, banded ridge, robust). This is not a t-statistic; it removes measurement units but does not equalise coefficient uncertainty.

No MNE imports occur in this module. Spatial adjacency matrices must be supplied by the user (e.g. from mne.channels.find_ch_adjacency).

The pyeeg.stats module provides nonparametric statistical inference for TRF (Temporal Response Function) analysis. It complements the parametric tvals_/pvals_ path in pyeeg.models.TRFEstimator.

Key features:

  • Permutation test (permutation_test_trf): circular-shift surrogate test with FWE correction via the max-statistic. Supports stat="zscore" (default: internal pre-lag z-scoring + refit, clean for any solver), stat="t" (OLS only), stat="coef", and stat="perm_norm" (permutation-null normalised).

  • Cluster-based correction (cluster_based_permutation_test): Maris & Oostenveld (2007) cluster-level FWE. Positive and negative clusters formed separately; adjacency (lag, explicit, sparse, or none).

  • Bootstrap CIs (bootstrap_ci_trf): paired circular block bootstrap with boundary drop and auto block-size estimation.

  • Jackknife SE (jackknife_se_trf): leave-one-epoch-out standard error and confidence intervals (standalone, not a permutation stat).

  • Cross-subject consistency (cross_subject_consistency): descriptive pairwise or leave-one-out reliability (Pearson or cosine).

  • Group-level test (group_level_test): sign-flip permutation test on subject coefficient maps (H0: population mean = 0).

No MNE imports occur in this module. Spatial adjacency matrices must be supplied by the user (e.g. from mne.channels.find_ch_adjacency).