fmri.stimulus: Linear Model for FMRI Data

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/lm.R

Description

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

Usage

1
2
3
  fmri.stimulus(scans = 1, onsets = c(1), durations = c(1), TR = 2,
                times = FALSE, type = c("canonical", "gamma", "boxcar", "user"),
                par = NULL, scale = 10, hrf = NULL, verbose = FALSE)

Arguments

scans

number of scans

onsets

vector of onset times (in scans)

durations

vector of duration of ON stimulus in scans or seconds (if !is.null(times))

TR

time between scans in seconds (TR)

times

onset times in seconds. If present onsets arguments is ignored.

type

One of "canonical", "gamma", "boxcar", "user"

par

Possible parameters to the HRF.

scale

Temporal undersampling factor

hrf

If type is "user" this should be a function evaluating the hemodynamic response function

verbose

Report more if TRUE

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.

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):

(x/d1)^a1 * exp(-(x - d1)/b1) - c * (x/d2)^a2 * exp(-(x - d2)/b2)

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τ_h (k-1)!} ≤ft( \frac{t}{τ_h} \right)^k \exp ≤ft( - \frac{t}{τ_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.

Value

Vector with dimension c(scans, 1).

Author(s)

Karsten Tabelow tabelow@wias-berlin.de

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.

Polzehl, J. and Tabelow, K. (2007) fmri: A Package for Analyzing fmri Data, R News, 7:13-17 .

See Also

fmri.design, fmri.lm

Examples

1
2
3
4
5
  # 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")

fmri documentation built on May 19, 2017, 1:34 p.m.

Search within the fmri package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.