3. Reference documentation: all nistats functions¶
This is the class and function reference of nistats. Please refer to the full user guide for further details, as the class and function raw specifications may not be enough to give full guidelines on their uses.
List of modules
nistats.datasets
: Datasetsnistats.hemodynamic_models
: Hemodynamic Modelsnistats.design_matrix
: Design Matrix Creationnistats.experimental_paradigm
: Experimental Paradigmnistats.model
: Statistical modelsnistats.regression
: Regression Modelsnistats.first_level_model
: First Level Modelnistats.second_level_model
: Second Level Modelnistats.contrasts
: Contrastsnistats.thresholding
: Thresholding Mapsnistats.reporting
: Report plotting functionsnistats.utils
: Utility functions
3.1. nistats.datasets
: Datasets¶
Utilities to download NeuroImaging datasets Author: Gael Varoquaux
Functions:
Download language localizer demo dataset. |
|
|
Download a file with OpenNeuro BIDS dataset index. |
|
Select subset of urls with given filters. |
|
Download OpenNeuro BIDS dataset. |
|
Download a first-level localizer fMRI dataset |
|
Function to fetch SPM auditory single-subject data. |
|
Fetcher for Multi-modal Face Dataset. |
|
Download a first-level fiac fMRI dataset (2 sessions) |
3.2. nistats.hemodynamic_models
: Hemodynamic Models¶
This module is for hemodynamic reponse function (hrf) specification. Here we provide for SPM, Glover hrfs and finite timpulse response (FIR) models. This module closely follows SPM implementation
Author: Bertrand Thirion, 2011–2018
Functions:
|
Implementation of the SPM hrf model |
|
Implementation of the Glover hrf model |
|
Implementation of the SPM time derivative hrf (dhrf) model |
|
Implementation of the Glover time derivative hrf (dhrf) model |
|
Implementation of the SPM dispersion derivative hrf model |
|
Implementation of the Glover dispersion derivative hrf model |
|
This is the main function to convolve regressors with hrf model |
3.3. nistats.design_matrix
: Design Matrix Creation¶
This module implements fMRI Design Matrix creation.
Design matrices are represented by Pandas DataFrames Computations of the different parts of the design matrix are confined to the make_first_level_design_matrix function, that create a DataFrame All the others are ancillary functions.
Design matrices contain three different types of regressors:
Task-related regressors, that result from the convolution of the experimental paradigm regressors with hemodynamic models A hemodynamic model is one of:
‘spm’ : linear filter used in the SPM software
‘glover’ : linear filter estimated by G.Glover
- ‘spm + derivative’, ‘glover + derivative’: the same linear models,
plus their time derivative (2 regressors per condition)
- ‘spm + derivative + dispersion’, ‘glover + derivative + dispersion’:
idem plus the derivative wrt the dispersion parameter of the hrf (3 regressors per condition)
‘fir’ : finite impulse response model, generic linear filter
User-specified regressors, that represent information available on the data, e.g. motion parameters, physiological data resampled at the acquisition rate, or sinusoidal regressors that model the signal at a frequency of interest.
Drift regressors, that represent low_frequency phenomena of no interest in the data; they need to be included to reduce variance estimates.
Author: Bertrand Thirion, 2009-2015
Functions:
|
Generate a design matrix from the input parameters |
|
Check that the provided DataFrame is indeed a valid design matrix descriptor, and returns a triplet of fields |
|
Sets up a second level design. |
3.4. nistats.experimental_paradigm
: Experimental Paradigm¶
An experimental protocol is handled as a pandas DataFrame that includes an ‘onset’ field.
This yields the onset time of the events in the experimental paradigm. It can also contain:
a ‘trial_type’ field that yields the condition identifier.
- a ‘duration’ field that yields event duration (for so-called block
paradigms).
a ‘modulation’ field that associated a scalar value to each event.
Author: Bertrand Thirion, 2015
Functions:
|
Test that the events data describes a valid experimental paradigm |
3.5. nistats.model
: Statistical models¶
This module implement classes to handle statistical tests on likelihood models
Author: Bertrand Thirion, 2011–2015
Classes:
|
Class to contain results from likelihood models |
|
Results from a t contrast of coefficients in a parametric model. |
|
Results from an F contrast of coefficients in a parametric model. |
3.6. nistats.regression
: Regression Models¶
This module implements some standard regression models: OLS and WLS models, as well as an AR(p) regression model.
Models are specified with a design matrix and are fit using their ‘fit’ method.
Subclasses that have more complicated covariance matrices should write over the ‘whiten’ method as the fit method prewhitens the response by calling ‘whiten’.
General reference for regression models:
- ‘Introduction to Linear Regression Analysis’, Douglas C. Montgomery,
Elizabeth A. Peck, G. Geoffrey Vining. Wiley, 2006.
Classes:
|
A simple ordinary least squares model. |
|
A regression model with an AR(p) covariance structure. |
|
This class summarizes the fit of a linear regression model. |
|
This class contains only information of the model fit necessary for contast computation. |
3.7. nistats.first_level_model
: First Level Model¶
This module presents an interface to use the glm implemented in nistats.regression.
It contains the GLM and contrast classes that are meant to be the main objects of fMRI data analyses.
Author: Bertrand Thirion, Martin Perez-Guevara, 2016
Classes:
|
Implementation of the General Linear Model for single session fMRI data. |
Functions:
|
Scaling of the data to have percent of baseline change along the specified axis |
|
GLM fit for an fMRI data matrix |
|
Create FirstLevelModel objects and fit arguments from a BIDS dataset. |
3.8. nistats.second_level_model
: Second Level Model¶
This module presents an interface to use the glm implemented in nistats.regression.
It provides facilities to realize a second level analysis on lists of first level contrasts or directly on fitted first level models
Author: Martin Perez-Guevara, 2016
Classes:
|
Implementation of the General Linear Model for multiple subject fMRI data |
3.9. nistats.contrasts
: Contrasts¶
This module is for contrast computation and operation on contrast to obtain fixed effect results.
Author: Bertrand Thirion, Martin Perez-Guevara, 2016
Classes:
|
The contrast class handles the estimation of statistical contrasts on a given model: student (t) or Fisher (F). |
Functions:
|
Compute the specified contrast given an estimated glm |
3.10. nistats.thresholding
: Thresholding Maps¶
Utilities for probabilistic error control at voxel- and cluster-level in brain imaging: cluster-level thresholding, false discovery rate control, false discovery proportion in clusters.
Author: Bertrand Thirion, 2015 – 2019
Functions:
|
return the Benjamini-Hochberg FDR threshold for the input z_vals |
|
Compute the required threshold level and return the thresholded map |
3.11. nistats.reporting
: Report plotting functions¶
This module implements plotting functions useful to report analysis results.
Author: Martin Perez-Guevara, Elvis Dohmatob, 2017
Functions:
|
Creates plots to compare two lists of images and measure correlation. |
|
Plot a design matrix provided as a DataFrame |
|
Creates plot for contrast definition. |
|
Creates pandas dataframe with img cluster statistics. |
|
Returns HTMLDocument object for a report which shows all important aspects of a fitted GLM. |
3.12. nistats.utils
: Utility functions¶
Misc utilities for the library
Authors: Bertrand Thirion, Matthew Brett, 2015
Functions:
|
Return the z-score corresponding to a given p-value. |
Compute the inverse of a set of arrays. |
|
|
Returns the squared Mahalanobis distance for a given set of samples |
|
Computes the condition number of X and if it is larger than cmax, returns a matrix with a condition number smaller than cmax. |
Return element-wise reciprocal of array, setting X>=0 to 0 |
|
|
Search for files in a BIDS dataset following given constraints. |
|
Returns dictionary with parsed information from file path |