Skip to contents

construct a regressor object that can be used to generate regression variables from a set of onset times and a hemodynamic response function. A regressor can be evaluated at a set of times to generate a time-course appropriate for modeling an fMRI response.

Usage

regressor(
  onsets,
  hrf = HRF_SPMG1,
  duration = 0,
  amplitude = 1,
  span = 40,
  summate = TRUE
)

Arguments

onsets

the event onsets in seconds

hrf

a hemodynamic response function, e.g. HRF_SPMG1 or costum HRF

duration

duration of events (default is 0)

amplitude

scaling vector (default is 1)

span

the temporal window of the impulse response function (default is 24)

summate

whether to summate hrf amplitude as a function of the duration of an event.

Value

an S3 list of type regressor

Examples


reg <- regressor(c(10,12,14,16,18, 40), HRF_SPMG1, duration=3)
pred <- evaluate(reg, seq(0,100,by=2))
nbasis(reg) == 1
#> [1] TRUE

reg2 <- regressor(c(10,12,14,16,18, 40), HRF_SPMG1, duration=3, summate=FALSE)
pred2 <- evaluate(reg2, seq(0,100,by=2))
stopifnot(max(pred) > max(pred2))