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.
regressors(x, ...)
x |
A model object that contains regressors (or can generate them) |
... |
Additional arguments passed to methods. Common arguments include:
|
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()
, 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.