Create the expected BOLD response for a given task indicator function.
fmri.stimulus(scans = 1, onsets = c(1), durations = c(1), TR = 2,
times = FALSE, sliceorder = NULL,
type = c("canonical", "gamma", "boxcar", "user"),
par = NULL, scale = 10, hrf = NULL, verbose = FALSE)
Vector with dimension c(scans, 1)
or a matrix with dimension
c(scans, number of slices)
.
number of scans
vector of onset times (in scans)
vector of duration of ON stimulus in scans
(if times==FALSE)
) or
seconds (if times==TRUE)
)
time between scans in seconds (TR)
logical. If TRUE onsets and durations are given in units of time not number of scans. Defaults to FALSE.
order of slice acquisition. If provided separate expected bold responses are calculated for the slices taking slice acquisition times into account. Default: no slice timing.
One of "canonical"
, "gamma"
, "boxcar"
,
"user"
Possible parameters to the HRF.
Temporal undersampling factor
If type
is "user"
this should be a function evaluating the hemodynamic response function
Report more if TRUE
Karsten Tabelow tabelow@wias-berlin.de, Joerg Polzehl polzehl@wias-berlin.de
The functions calculates the expected BOLD response for the task indicator function given by the argument as a convolution with the hemodynamic response function.
If sliceorder
provides an ordering of slice acquisitions a matrix of
expected Bold responses with columns corresponding to the slice number is
computed.
For type
is "canonical"
the latter is modelled by the difference
between two gamma functions as given in the reference (with the defaults
for a1, a2, b1, b2, cc given therein):
$$\left(\frac{t}{d_1}\right)^{a_1} \exp \left(-\frac{t-d_1}{b_1}\right) - c \left(\frac{t}{d_2}\right)^{a_2} \exp \left(-\frac{t-d_2}{b_2}\right) $$
The parameters a1
, a2
, b1
, b2
, cc
of this function
can be changed through the argument par
in this order.
Other choices are a simple gamma function
$$\frac{1}{k\tau_h (k-1)!} \left( \frac{t}{\tau_h} \right)^k \exp \left( - \frac{t}{\tau_h} \right)$$
or the "boxcar"
stimulus, or a user defined function hrf
.
The dimension of the function value is set to c(scans, 1)
.
If !is.null(times)
durations are specified in seconds.
Worsley, K.J., Liao, C., Aston, J., Petre, V., Duncan, G.H., Morales, F., Evans, A.C. (2002). A general statistical analysis for fMRI data. NeuroImage, 15:1-15.
Polzehl, J. and Tabelow, K. (2007) fmri: A Package for Analyzing fmri Data, R News, 7:13-17 .
fmri.design
, fmri.lm
# Example 1
hrf <- fmri.stimulus(107, c(18, 48, 78), 15, 2)
z <- fmri.design(hrf, 2)
par(mfrow=c(2, 2))
for (i in 1:4) plot(z[, i], type="l")
Run the code above in your browser using DataLab