regressors | R Documentation |
Extract a set of regressors from a model object. Regressors represent the predicted BOLD response for different experimental conditions or model components. For event-related designs, each regressor is typically a convolution of event onsets with an HRF. For baseline terms, regressors might represent drift or nuisance components.
Convolve the event-term design matrix with an HRF and return the resulting regressors.
regressors(x, ...)
## S3 method for class 'event_term'
regressors(x, hrf, sampling_frame, summate = FALSE, drop.empty = TRUE, ...)
x |
A model object that contains regressors (or can generate them) |
... |
Additional arguments passed to methods. Common arguments include:
|
hrf |
HRF function |
sampling_frame |
sampling_frame object |
summate |
Logical; sum HRF responses |
drop.empty |
Logical; drop empty conditions |
A list of regressor objects, where each regressor contains:
values: Numeric vector of regressor values over time
onsets: Original event onset times
condition: Associated experimental condition
block: Associated run/block number
event_model()
, fmrihrf::HRF_SPMG1()
, convolve()
# Create event data with two conditions
event_data <- data.frame(
condition = factor(c("face", "house", "face", "house")),
onsets = c(1, 10, 20, 30),
run = c(1, 1, 1, 1)
)
# Create sampling frame
sframe <- sampling_frame(blocklens = 50, TR = 2)
# Create event model with canonical HRF
evmodel <- event_model(
onsets ~ hrf(condition),
data = event_data,
block = ~run,
sampling_frame = sframe
)
# Extract all regressors
reg_list <- regressors(evmodel)
# Create model with multiple basis functions
evmodel2 <- event_model(
onsets ~ hrf(condition, basis = "fourier", nbasis = 2),
data = event_data,
block = ~run,
sampling_frame = sframe
)
# Extract regressors with basis functions
reg_list2 <- regressors(evmodel2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.