durations | R Documentation |
Extract the duration of events from a model object. Durations represent how long each event lasts in an fMRI design, typically in seconds. These are important for:
Modeling block designs where stimuli have non-zero duration
Creating accurate HRF convolutions for extended events
Distinguishing between brief and sustained neural activity
durations(x)
## S3 method for class 'regressor'
durations(x)
x |
The object containing event information (typically an event_term or event_model) |
A numeric vector of durations in seconds, where:
Each value represents how long an event lasts
Zero values indicate instantaneous events
Order matches the corresponding event sequence
onsets()
, event_term()
Other timing:
global_onsets()
,
onsets()
,
samples()
# Create event data with varying durations
event_data <- data.frame(
condition = factor(c("block", "event", "block", "event")),
onsets = c(1, 10, 20, 30),
durations = c(8, 0, 8, 0), # 8s blocks and instantaneous events
run = c(1, 1, 1, 1)
)
# Create event term
eterm <- event_term(
list(condition = event_data$condition),
onsets = event_data$onsets,
durations = event_data$durations,
blockids = event_data$run
)
# Get durations from term
dur <- durations(eterm) # Returns: c(8, 0, 8, 0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.