class eelbrain.testnd.TContrastRelated(y, x, contrast, 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 contrast based on t-values

  • y (NDVar) – Dependent variable.

  • x (categorial) – Model containing the cells which are compared with the contrast.

  • contrast (str) – Contrast specification: see Notes.

  • match (Factor) – Match cases for a repeated measures test.

  • 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); 1: upper tail (one-tailed); -1: lower tail (one-tailed).

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

  • pmin (None | scalar (0 < pmin < 1)) – Threshold for forming clusters: use a t-value equivalent to an uncorrected p-value for a related samples t-test (with df = len(match.cells) - 1).

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

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

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

  • tstop (scalar) – 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.

  • min... – Minimum cluster size criteria: min followed by the simension name, for example: mintime=0.050 for minimum duration of 50 ms; minsource=10 to require at least 10 sources; minsensor=10 to requre at least 10 sensors).

See also


Information on the different permutation methods


A contrast specifies the steps to calculate a map based on t-values. Contrast definitions can contain:

  • Comparisons using > or < and data cells to compute t-maps. For example, "cell1 > cell0" will compute a t-map of the comparison if cell1 and cell0, being positive where cell1 is greater than cell0 and negative where cell0 is greater than cell1. If the data is defined based on an interaction, cells are specified with |, e.g. "a1 | b1 > a0 | b0". Cells can contain * to average multiple cells. Thus, if the second factor in the model has cells b1 and b0, "a1 | * > a0 | *" would compare a1 to a0 while averaging b1 and b0 within a1 and a0.

  • Unary numpy functions abs and negative, e.g. "abs(cell1 > cell0)".

  • Binary numpy functions subtract and add, e.g. "add(a>b, a>c)".

  • Numpy functions for multiple arrays min, max and sum, e.g. min(a>d, b>d, c>d).

Cases with zero variance are set to t=0.


To find cluster where both of two pairwise comparisons are reliable, i.e. an intersection of two effects, one could use "min(a > c, b > c)".

To find a specific kind of interaction, where a is greater than b, and this difference is greater than the difference between c and d, one could use "(a > b) - abs(c > d)".



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


Statistical parameter map masked by significance