mne_nirs.experimental_design.make_first_level_design_matrix#

mne_nirs.experimental_design.make_first_level_design_matrix(raw, stim_dur=1.0, hrf_model='glover', drift_model='cosine', high_pass=0.01, drift_order=1, fir_delays=(0,), add_regs=None, add_reg_names=None, min_onset=-24, oversampling=50, *, return_vif=False, verbose=None)[source]#

Generate a design matrix based on annotations and model HRF.

This is a wrapper function for the nilearn [1] function make_first_level_design_matrix. For detailed description of the arguments see the nilearn documentation at http://nilearn.github.io

Parameters:
rawinstance of Raw

Haemoglobin data.

stim_durNumber

The length of your stimulus.

hrf_model{‘glover’, ‘spm’, ‘spm + derivative’, ‘spm + derivative + dispersion’, ‘glover + derivative’, ‘glover + derivative + dispersion’, ‘fir’, None}, optional

Specifies the hemodynamic response function. Default=’glover’.

drift_model{‘cosine’, ‘polynomial’, None}, optional

Specifies the desired drift model. Default=’cosine’.

high_passfloat, optional

High-pass frequency in case of a cosine model (in Hz). Default=0.01.

drift_orderint, optional

Order of the drift model (in case it is polynomial). Default=1.

fir_delaysarray of shape(n_onsets) or list, optional

In case of FIR design, yields the array of delays used in the FIR model (in scans). Default=[0].

add_regsarray of shape(n_frames, n_add_reg) or pandas DataFrame

Additional user-supplied regressors, e.g. data driven noise regressors or seed based regressors.

add_reg_nameslist of (n_add_reg,) str, optional

If None, while add_regs was provided, these will be termed ‘reg_%i’, i = 0..n_add_reg - 1 If add_regs is a DataFrame, the corresponding column names are used and add_reg_names is ignored.

min_onsetfloat, optional

Minimal onset relative to frame_times[0] (in seconds) events that start before frame_times[0] + min_onset are not considered. Default=-24.

oversamplingint, optional

Oversampling factor used in temporal convolutions. Default=50.

return_vifbool, optional

If True, also return the variance inflation factor (VIF) of each regressor. Default=False. Should only be passed as a keyword argument.

verbosebool | str | int | None

Control verbosity of the logging output. If None, use the default verbosity level. See the logging documentation and mne.verbose() for details. Should only be passed as a keyword argument.

Returns:
design_matrixDataFrame instance,

Holding the computed design matrix, the index being the frames_times and each column a regressor.

vifinstance of pandas.Series

The VIF of each non-constant regressor, indexed by regressor name. Only returned if return_vif=True.

Notes

The variance inflation factor (VIF) quantifies how much the variance of a regressor’s coefficient is inflated by collinearity with the other regressors. It is defined as 1 / (1 - R**2), where R**2 is obtained by regressing one regressor on all of the others (plus an intercept), and is not defined for the "constant" regressor itself. Values are always at least 1, and a perfectly collinear regressor yields np.inf.

A VIF between 1 and 5 indicates low to moderate correlation between regressors. Larger values indicate high multicollinearity, which suggests that the offending regressors should be combined or dropped, and are reported in the log output regardless of return_vif.

These are the same values as statsmodels.stats.outliers_influence.variance_inflation_factor gives for a design matrix that contains an intercept column.

References

Examples using mne_nirs.experimental_design.make_first_level_design_matrix#

GLM Analysis (Simulated)

GLM Analysis (Simulated)

GLM Analysis (Measured)

GLM Analysis (Measured)

Finger Tapping Analysis with Kernel Flow2 Data

Finger Tapping Analysis with Kernel Flow2 Data

Auditory GLM Analysis with TD-fNIRS Statistical Moments

Auditory GLM Analysis with TD-fNIRS Statistical Moments

Group Level GLM Analysis

Group Level GLM Analysis

GLM FIR Analysis

GLM FIR Analysis

GLM and Design Matrix Parameters

GLM and Design Matrix Parameters

Frequency and Filter Commentary

Frequency and Filter Commentary

Utilising Auxiliary Data

Utilising Auxiliary Data

Utilising Anatomical Information

Utilising Anatomical Information

Save and load GLM results

Save and load GLM results