Skip to contents

This function takes the output from convolve_design_matrix and transforms it into a design suitable for sampling with EMC2. It properly configures parameter types, bounds, and transformations for the specified model.

Usage

design_fmri(design_matrix, model = MRI_AR1, ...)

Arguments

design_matrix

A list of design matrices, the output from convolve_design_matrix

model

A function that returns a model specification, options are MRI or MRI_AR1

...

Additional arguments passed to the model

Value

An object of class 'emc.design' suitable for EMC2 sampling

Examples

# Generate a simple example timeseries
ts <- data.frame(
 subjects = rep(1, 100),
 run = rep(1, 100),
 time = cumsum(rep(1.38, 100)),
 ROI1 = rnorm(100)
)

# Generate example events
events <- data.frame(
 subjects = rep(1, 4),
 run = rep(1, 4),
 onset = c(10, 30, 50, 70),
 duration = rep(0.5, 4),
 event_type = c("A", "B", "A", "B"),
 modulation = c(1, 1, 1, 1)
)

# Create convolved design matrix
design_matrix <- convolve_design_matrix(
 timeseries = ts,
 events = events,
 factors = list(condition = c("A", "B")),
 hrf_model = "glover"
)
#>   event_type subjects run onset duration modulation  regressor
#> 1          A        1   1    30      0.5          1 conditionB
#> 2          B        1   1    70      0.5          1 conditionB
#> Filtering out high_pass noise, make sure you also use high_pass_filter(<timeseries>)

# Create fMRI design for EMC2
fmri_design <- design_fmri(design_matrix, model = MRI_AR1)