create_event_model | R Documentation |
Constructs an event model from its components. Variables can be specified as character strings or expressions (captured using rlang::exprs). The function creates HRF specifications (hrfspec objects), builds a formula string, and then assembles the final event model.
create_event_model(
event_terms,
events,
onsets,
block,
sampling_frame,
durations = 0,
drop_empty = TRUE,
precision = 0.3
)
event_terms |
A list of event term specifications. Each term is a list with components:
- |
events |
A data frame of event variables (all variables must be present). |
onsets |
A numeric vector of event onset times (in seconds). |
block |
A vector of block IDs (must be strictly increasing integers). |
sampling_frame |
The time series grid over which to sample the function. |
durations |
A numeric vector of event durations (default is 0 for all events). |
drop_empty |
Logical indicating whether to drop empty events (default is TRUE). |
precision |
Numeric value indicating the precision of HRF sampling (default is 0.3). |
An event_model object.
# Example with variables as character strings:
event_terms <- list(
list(
variables = c("x", "y"),
hrf = "spmg1"
)
)
# Example with variables as expressions:
event_terms <- list(
list(
variables = exprs(x, Poly(y, 2)),
hrf = "spmg1"
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.