Skip to contents

Convolves a HRF with a design matrix (one column per condition) to produce a list of regressors.

Usage

convolve_design(hrf, dmat, globons, durations, summate = TRUE, hrf_list = NULL)

Arguments

hrf

A function representing the HRF (used when hrf_list is NULL).

dmat

Design matrix (with named columns).

globons

Numeric vector of global onsets.

durations

Numeric vector of event durations.

summate

Logical; if TRUE, summate the convolved HRF (default: TRUE).

hrf_list

Optional list of HRF objects, one per event (row in dmat). When provided, allows per-onset HRF specification. The list is subsetted to match non-zero amplitude events for each condition.

Value

A list of regressors (one for each column).

Examples

hrf <- fmrihrf::HRF_SPMG1
dmat <- data.frame(A = c(1, 0, 1), B = c(0, 1, 0))
globons <- c(0, 10, 20)
durations <- rep(0, 3)
regs <- convolve_design(hrf, dmat, globons, durations)
length(regs)
#> [1] 2