design_matrix | R Documentation |
Extract or construct the design matrix from a model term or object. The design matrix contains the predictor variables used in the model, with one row per time point and one column per predictor. For event-related designs, the design matrix typically contains the convolved HRF responses. For baseline terms, it contains drift and nuisance regressors.
design_matrix(x, ...)
## S3 method for class 'convolved_term'
design_matrix(x, blockid = NULL, ...)
## S3 method for class 'afni_hrf_convolved_term'
design_matrix(x, blockid = NULL, ...)
## S3 method for class 'baseline_model'
design_matrix(x, blockid = NULL, allrows = FALSE, ...)
## S3 method for class 'baseline_term'
design_matrix(x, blockid = NULL, allrows = FALSE, ...)
## S3 method for class 'event_model'
design_matrix(x, blockid = NULL, ...)
## S3 method for class 'event_term'
design_matrix(x, drop.empty = TRUE, ...)
## S3 method for class 'fmri_model'
design_matrix(x, blockid = NULL, ...)
x |
The term or model object (typically an event_term, event_model, baseline_model, or fmri_model) |
... |
Additional arguments passed to methods |
blockid |
Numeric vector specifying which blocks/runs to include (optional) |
allrows |
Logical; if TRUE, return all rows including those with no events (default: FALSE) |
drop.empty |
Logical; if TRUE, drop empty conditions (default: TRUE) |
As of version X.Y.Z, column names in the final design matrix generated by
event_model
follow the structure:
term_tag
+ _
+ condition_tag
+ _b##
basis suffix
Refer to event_model
documentation for details on term_tag
and condition_tag
generation.
The design_matrix
methods for individual term types (like design_matrix.event_term
)
return unconvolved predictors whose names may not yet follow this final structure.
The final naming is applied by convolve.event_term
and assembled by
build_event_model_design_matrix
.
A tibble containing the design matrix, where:
Rows represent time points (scans)
Columns represent predictor variables
Column names indicate the condition or regressor (see Details)
design_matrix(afni_hrf_convolved_term)
: Design matrix for AFNI-convolved terms
AFNI-convolved terms rely on AFNI software for design matrix construction. This method stops with an informative message.
event_model()
, baseline_model()
, fmri_model()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.