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_pass
float, optional High-pass frequency in case of a cosine model (in Hz). Default=0.01.
- drift_order
int, optional Order of the drift model (in case it is polynomial). Default=1.
- fir_delays
arrayof shape(n_onsets) orlist, optional In case of FIR design, yields the array of delays used in the FIR model (in scans). Default=[0].
- add_regs
arrayof shape(n_frames, n_add_reg) orpandasDataFrame Additional user-supplied regressors, e.g. data driven noise regressors or seed based regressors.
- add_reg_names
listof (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_onset
float, optional Minimal onset relative to frame_times[0] (in seconds) events that start before frame_times[0] + min_onset are not considered. Default=-24.
- oversampling
int, 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 andmne.verbose()for details. Should only be passed as a keyword argument.
- rawinstance of
- Returns:
- design_matrix
DataFrameinstance, 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.
- design_matrix
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), whereR**2is 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 yieldsnp.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_factorgives for a design matrix that contains an intercept column.References
Examples using mne_nirs.experimental_design.make_first_level_design_matrix#
Auditory GLM Analysis with TD-fNIRS Statistical Moments