gen_hrf
takes a raw function f(t)
and returns an HRF (Hemodynamic Response Function) instance.
Usage
gen_hrf(
hrf,
lag = 0,
width = 0,
precision = 0.1,
summate = TRUE,
normalize = FALSE,
name = "gen_hrf",
span = NULL,
...
)
Arguments
- hrf
A function mapping from time to signal.
- lag
Optional lag in seconds.
- width
Optional block width in seconds.
- precision
Sampling precision in seconds.
- summate
Whether to allow each impulse response function to "add" up (default: TRUE).
- normalize
Rescale so that the peak of the output is 1 (default: FALSE).
- name
The assigned name of the generated HRF.
- span
The span of the HRF (maximum width in seconds after which function reverts to zero).
- ...
Extra parameters for the
hrf
function.
Examples
## Generate an HRF using SPMG1 canonical HRF, a lag of 3, and a width of 2.
grf <- gen_hrf(hrf_spmg1, lag=3, width=2)
grf(0:20)
#> [1] 0.00000000 0.00000000 0.00000000 0.00000000 0.07573777 1.84058304
#> [7] 8.85283567 20.78293336 31.37528579 35.50904282 33.02071221 26.68047304
#> [13] 19.40238428 12.98708141 8.10702993 4.73934865 2.57370719 1.25700902
#> [19] 0.49695650 0.08416017 -0.11989363
hg <- purrr::partial(hrf_gaussian, mean=4, sd=1)
grf <- gen_hrf(hg, lag=1, width=2)
vals <- grf(0:20)