event_terms | R Documentation |
Extract the event-related terms from a model object, separating them from baseline or nuisance terms. Event terms represent the experimental conditions and parametric modulators in an fMRI design. For example, in a model with both task events (e.g., stimulus presentations) and baseline components (e.g., drift terms, motion parameters), this function returns only the task-related terms.
event_terms(x)
x |
The model object (typically an fmri_model) |
A list of event_term objects. Each event_term represents a different component of the experimental design and contains:
varname: Name of the term (e.g., "stimulus", "rt")
events: List of event objects (factors or continuous variables)
event_table: Data frame of event information
onsets: Event onset times in seconds
blockids: Run/block identifiers
durations: Event durations in seconds
baseline_terms()
, fmri_model()
Other model_components:
baseline_terms()
,
term_indices()
# Create a model with both event and baseline terms
event_data <- data.frame(
stimulus = factor(c("face", "house", "face", "house")),
rt = c(0.8, 1.2, 0.9, 1.1),
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
evmodel <- event_model(
onsets ~ hrf(stimulus) + hrf(rt),
data = event_data,
block = ~run,
sampling_frame = sframe
)
# Create baseline model for drift
bmodel <- baseline_model(
basis = "bs",
degree = 3,
sframe = sframe
)
# Combine into full model
fmodel <- fmri_model(evmodel, bmodel)
# Extract only the event terms
event_terms(fmodel) # Returns list of stimulus and rt terms
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.