Note

This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the user guide for the big picture.

nilearn.glm.compute_contrast

nilearn.glm.compute_contrast(labels, regression_result, con_val, stat_type=None)[source]

Compute the specified contrast given an estimated glm.

Parameters:
labelsarray of shape (n_voxels,)

A map of values on voxels used to identify the corresponding model

regression_resultdict

With keys corresponding to the different labels values are RegressionResults instances corresponding to the voxels.

con_valnumpy.ndarray of shape (p) or (q, p)

Where q = number of contrast vectors and p = number of regressors.

stat_type{None, ‘t’, ‘F’}, default=None

Type of the contrast. If None, then defaults to ‘t’ for 1D con_val and ‘F’ for 2D con_val.

contrast_type

Deprecated since version 0.10.3: Use stat_type instead (see above).

Returns:
conContrast instance,

Yields the statistics of the contrast (effects, variance, p-values).