event_model | R Documentation |
This function creates an event-based fMRI regression model, represented as a data structure.
event_model(
x,
data,
block,
sampling_frame,
drop_empty = TRUE,
durations = 0,
...
)
x |
The model specification, typically a |
data |
A data frame containing the experimental design, with one row per time point and one column per variable used in the model formula. If a categorical variable is used in the formula, it should be a factor in the data frame. The data frame should also contain a column with the fMRI signal values (the response variable). |
block |
A formula specifying the block structure of the design. This formula should have
the format |
sampling_frame |
A sampling frame defining the temporal and block structure of the design.
This should be an object of class |
drop_empty |
Logical value indicating whether to drop empty factor levels in the model.
If |
durations |
A numeric vector specifying the duration (in seconds) of each event in the model. If the model contains block variables, the duration of each block should be specified as well. The length of this vector should be equal to the number of events/blocks in the design. Default value is 0 (no duration). |
... |
Additional arguments to be passed to methods. Currently not used. |
A list containing the following elements:
The formula used to create the model.
The design matrix for the model, with one row per time point and one column per predictor variable.
A list of indices defining the start and end time points of each block.
A vector containing the estimated baseline fMRI signal level for each block.
A vector containing the duration (in seconds) of each event or block in the design.
# Create a data frame with experimental design
event_data <- data.frame(fac=c("a", "B", "A", "B"), onsets=c(1,10,20,80), run=c(1,1,1,1))
# Create a sampling frame with 50-second blocks and a TR of 2 seconds
sframe <- sampling_frame(blocklens=50, TR=2)
# Create an event model using the `onsets` variable as a predictor,
# with a separate baseline for each run
evmodel <- event_model(onsets ~ hrf(onsets), data=event_data, block=~run, sampling_frame=sframe)
dmat <- design_matrix(evmodel)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.