lyman.glm.build_design_matrix¶
-
lyman.glm.
build_design_matrix
(conditions=None, hrf_model=None, regressors=None, artifacts=None, n_tp=None, tr=1, res=60, shift=0.5, hpf_matrix=None, demean=True)[source]¶ Use design information to build a matrix for a BOLD time series GLM.
- Parameters
- conditionsdataframe
Must have an onset (in seconds) columns. Can also have duration (in seconds, defaulting to 0), and value (in arbitrary units, defaulting to 1), and condition (strings, defaulting to “event”) columns; rows should correspond to event occurrences.
- hrf_modelHRFModel object
Object that implements .transform() to return a basis set for the predicted response. Defaults to GammaHRF with default parameters.
- regressorsdataframe
Additional columns to include in the design matrix without any transformation (aside from optional de-meaning). It must have an index with valid time points.
- artifactsboolean series
A Series indicating which row should have indicator regressors included in the design matrix to account for signal artifacts.
- n_tpint
The number of timepoints in the
- trfloat
Time resolution of the output regressors, in seconds.
- resfloat
Sampling resolution at which to construct the condition regressors and perform convolution with the HRF model.
- shiftfloat
Proportion of the TR to shift the predicted response when downsampling to the output resolution.
- hpf_matrixn_tp x n_tp array
Matrix for high-pass filtering the condition regressors.
- demeanbool
If True, each column in the output matrix will be mean-centered.
- Returns
- Xdataframe
Design matrix with timepoints in rows and regressors in columns.