event_model.list: event_model.list

View source: R/event_model.R

event_model.listR Documentation

event_model.list

Description

Constructs an event model from a list of hemodynamic response function (HRF) specifications (x), along with additional parameters (data, block, sampling frame, durations, etc.). All elements in x must be of type hrfspec.

Usage

## S3 method for class 'list'
event_model(
  x,
  data,
  block,
  sampling_frame,
  drop_empty = TRUE,
  durations = 0,
  precision = 0.3,
  ...
)

Arguments

x

A list of HRF specifications.

data

The dataset (a data.frame) containing event information.

block

The block variable; either a formula or a vector of block values.

sampling_frame

The time series grid over which to sample the function.

drop_empty

Logical indicating whether to drop empty events. Default is TRUE.

durations

A numeric vector of event durations. Default is 0 for all events.

precision

Numeric value indicating the precision for HRF sampling. Default is 0.3.

...

Additional arguments.

Details

Construct an event model from a list of HRF specifications.

Value

An event model object.

Examples

# Example for event_model.list:
# Assume HRF_SPMG1 is a predefined hrfspec object.
df <- data.frame(onset = seq(1, 100, by = 10),
                 run = rep(1:2, each = 5))
# Create a list of HRF specifications:
hrf_list <- list(HRF_SPMG1)
# Create a sampling frame (assume sampling_frame() is defined)
sframe <- sampling_frame(blocklens = c(50, 50), TR = 2)
# Construct the event model
ev_model <- event_model.list(x = hrf_list, data = df, block = ~ run, sampling_frame = sframe)

bbuchsbaum/fmrireg documentation built on March 1, 2025, 11:20 a.m.