class eelbrain.testnd.TTestRelated(y, x, c1=None, c0=None, match=None, sub=None, data=None, tail=0, samples=10000, pmin=None, tmin=None, tfce=False, tstart=None, tstop=None, parc=None, force_permutation=False, **criteria)

Mass-univariate related samples t-test

The test data can be specified in two forms:

  • In long form, with y supplying the data, x specifying condition for each case and match determining which cases are related.

  • In wide/repeated measures form, with y and x both supplying data with matching case order.

  • y (NDVar) – Dependent variable.

  • x (categorial | NDVar) – Model containing the cells which should be compared, or NDVar to which y should be compared. In the latter case, the next three parameters are ignored.

  • c1 (str | tuple | None) – Test condition (cell of x). c1 and c0 can be omitted if x only contains two cells, in which case cells will be used in alphabetical order.

  • c0 (str | tuple | None) – Control condition (cell of x).

  • match (categorial) – Units within which measurements are related (e.g. ‘subject’ in a within-subject comparison).

  • sub (index) – Perform the test with a subset of the data.

  • data (Dataset) – If a Dataset is specified, all data-objects can be specified as names of Dataset variables.

  • tail (0 | 1 | -1) – Which tail of the t-distribution to consider: 0: both (two-tailed, default); 1: upper tail (one-tailed); -1: lower tail (one-tailed).

  • samples (int) – Number of samples for permutation test (default 10,000).

  • pmin (float) – Threshold for forming clusters: use a t-value equivalent to an uncorrected p-value.

  • tmin (float) – Threshold for forming clusters as t-value.

  • tfce (float | bool) – Use threshold-free cluster enhancement. Use a scalar to specify the step of TFCE levels (for tfce is True, 0.1 is used).

  • tstart (float) – Start of the time window for the permutation test (default is the beginning of y).

  • tstop (float) – Stop of the time window for the permutation test (default is the end of y).

  • parc (str) – Collect permutation statistics for all regions of the parcellation of this dimension. For threshold-based test, the regions are disconnected.

  • force_permutation (bool) – Conduct permutations regardless of whether there are any clusters.

  • mintime (scalar) – Minimum duration for clusters (in seconds).

  • minsource (int) – Minimum number of sources per cluster.

  • c1_mean (NDVar) – Mean in the c1 condition.

  • c0_mean (NDVar) – Mean in the c0 condition.

  • clusters (None | Dataset) – For cluster-based tests, a table of all clusters. Otherwise a table of all significant regions (or None if permutations were omitted). See also the find_clusters() method.

  • difference (NDVar) – Difference between the mean in condition c1 and condition c0.

  • p (NDVar | None) – Map of p-values corrected for multiple comparison (or None if no correction was performed).

  • p_uncorrected (NDVar) – Map of p-values uncorrected for multiple comparison.

  • t (NDVar) – Map of t-values.

  • tfce_map (NDVar | None) – Map of the test statistic processed with the threshold-free cluster enhancement algorithm (or None if no TFCE was performed).

  • n (int) – Number of cases.

See also


Information on the different permutation methods


Also known as dependent t-test, paired t-test or repeated measures t-test.

Permutation distributions are generated by randomly switching condition labels within categories of match. For each permutation, a random subset of match is selected and the c1/c0 labels are switched for those cases.

T-values for cases with zero variance are set to t=0.



Retrieve a specific cluster as NDVar


Compute a probability map

find_clusters([pmin, maps])

Find significant regions or clusters


Find peaks in a threshold-free cluster distribution


List with information about the test


c1 map masked by significance of the c1-c0 difference

masked_difference([p, name])

Difference map masked by significance


Statistical parameter map masked by significance