Learn R Programming

fmri (version 1.0)

fmri.stimulus: Linear Model for FMRI Data

Description

Create the expected BOLD response for a given task indicator function.

Usage

fmri.stimulus(scans = 1, onsets = c(1), length = 1, rt = 3,
                mean = TRUE,
                a1 = 6, a2 = 12, b1 = 0.9, b2 = 0.9, cc = 0.35)

Arguments

scans
number of scans
onsets
vector of onset times (in scans)
length
length of ON stimulus (in scans)
rt
time between scans in seconds (TR)
mean
logical. if TRUE the mean is substracted from the resulting vector
a1
parameter of the hemodynamic response function (see details)
a2
parameter of the hemodynamic response function (see details)
b1
parameter of the hemodynamic response function (see details)
b2
parameter of the hemodynamic response function (see details)
cc
parameter of the hemodynamic response function (see details)

Value

  • Vector with dimension c(scans,1).

Details

The functions calculates the expected BOLD response for the task indicator function given by the argument as a convolution with the hemodynamic response function. 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 of this function can be changed through the arguments a1, a2, b1, b2, cc. The dimension of the function value is set to c(scans,1).

If mean is TRUE (default) the resulting vector is corrected to have zero mean.

References

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.

See Also

fmri.design, fmri.lm

Examples

Run this code
# 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