class eelbrain.testnd.t_contrast_rel(y: Union[eelbrain._data_obj.NDVar, str], x: Union[eelbrain._data_obj.Factor, eelbrain._data_obj.Interaction, eelbrain._data_obj.NestedEffect, str], contrast: str, match: Union[eelbrain._data_obj.Factor, eelbrain._data_obj.Interaction, eelbrain._data_obj.NestedEffect, str] = None, sub: Union[eelbrain._data_obj.Factor, eelbrain._data_obj.Interaction, eelbrain._data_obj.NestedEffect, str] = None, ds: eelbrain._data_obj.Dataset = None, tail: int = 0, samples: int = 10000, pmin: float = None, tmin: float = None, tfce: Union[float, bool] = False, tstart: float = None, tstop: float = None, parc: str = None, force_permutation: bool = 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.

ds : None | 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.

mintime : scalar

Minimum duration for clusters (in seconds).

minsource : int

Minimum number of sources per cluster.


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)".


cluster(self, cluster_id) Retrieve a specific cluster as NDVar
compute_probability_map(self, **sub) Compute a probability map
find_clusters(self[, pmin, maps]) Find significant regions or clusters
find_peaks(self) Find peaks in a threshold-free cluster distribution
info_list(self[, computation]) List with information about the test
masked_parameter_map(self[, pmin]) Create a copy of the parameter map masked by significance