nilearn.glm: Generalized Linear Models#

Analysing fMRI data using GLMs.

Note that the nilearn.glm module is experimental.

It may change in any future (>0.7.0) release of Nilearn.

Classes:

Contrast(effect, variance[, dim, dof, ...])

The contrast class handles the estimation of statistical contrasts on a given model: student (t) or Fisher (F).

FContrastResults(effect, covariance, F, df_num)

Results from an F contrast of coefficients in a parametric model.

TContrastResults(t, sd, effect[, df_den])

Results from a t contrast of coefficients in a parametric model.

ARModel(design, rho)

A regression model with an AR(p) covariance structure.

OLSModel(design)

A simple ordinary least squares model.

LikelihoodModelResults(theta, Y, model[, ...])

Class to contain results from likelihood models.

RegressionResults(theta, Y, model, ...[, ...])

This class summarizes the fit of a linear regression model.

SimpleRegressionResults(results)

This class contains only information of the model fit necessary for contrast computation.

Functions:

compute_contrast(labels, regression_result, ...)

Compute the specified contrast given an estimated glm

compute_fixed_effects(contrast_imgs, ...[, ...])

Compute the fixed effects, given images of effects and variance

expression_to_contrast_vector(expression, ...)

Converts a string describing a contrast to a contrast vector

fdr_threshold(z_vals, alpha)

Return the Benjamini-Hochberg FDR threshold for the input z_vals

cluster_level_inference(stat_img[, ...])

Report the proportion of active voxels for all clusters defined by the input threshold.

threshold_stats_img([stat_img, mask_img, ...])

Compute the required threshold level and return the thresholded map

nilearn.glm.first_level#

Classes:

FirstLevelModel([t_r, slice_time_ref, ...])

Implementation of the General Linear Model for single session fMRI data.

Functions:

check_design_matrix(design_matrix)

Check that the provided DataFrame is indeed a valid design matrix descriptor, and returns a triplet of fields

compute_regressor(exp_condition, hrf_model, ...)

This is the main function to convolve regressors with hrf model

first_level_from_bids(dataset_path, task_label)

Create FirstLevelModel objects and fit arguments from a BIDS dataset.

glover_dispersion_derivative(tr[, ...])

Implementation of the Glover dispersion derivative hrf model

glover_hrf(tr[, oversampling, time_length, ...])

Implementation of the Glover hrf model

glover_time_derivative(tr[, oversampling, ...])

Implementation of the Glover time derivative hrf (dhrf) model

make_first_level_design_matrix(frame_times)

Generate a design matrix from the input parameters

mean_scaling(Y[, axis])

Scaling of the data to have percent of baseline change along the specified axis

run_glm(Y, X[, noise_model, bins, n_jobs, ...])

GLM fit for an fMRI data matrix

spm_dispersion_derivative(tr[, ...])

Implementation of the SPM dispersion derivative hrf model

spm_hrf(tr[, oversampling, time_length, onset])

Implementation of the SPM hrf model

spm_time_derivative(tr[, oversampling, ...])

Implementation of the SPM time derivative hrf (dhrf) model

nilearn.glm.second_level#

Classes:

SecondLevelModel([mask_img, target_affine, ...])

Implementation of the General Linear Model for multiple subject fMRI data.

Functions:

make_second_level_design_matrix(subjects_label)

Sets up a second level design.

non_parametric_inference(second_level_input)

Generate p-values corresponding to the contrasts provided based on permutation testing.