Learn R Programming

fmri (version 1.9.12.1)

fmri.designG: Design matrix for fMRI group analysis

Description

This function returns a design matrix for multi-subject fMRI data to fit a Linear Mixed-effects Model (one-stage procedure) with given stimuli, polynomial drift terms and a set of known population parameters.

Usage

fmri.designG(hrf, subj = 1, runs = 1, group = NULL, XG = NULL)

Value

A design matrix as a data frame, which contains the following variables:

subj

consecutive subject number: 1 to subj specified as factor

run

consecutive run number within the subjects: 1 to runs specified as factor

scan

consecutive scan number: 1 to T within each session

session

consecutive experiment number: 1 to (subj*runs) specified as factor

group

grouping variable specified as factor, one group by default

hrf, hrf2, ...

replicated expected BOLD-response(s)

drift0, drift1, drift2

replicated polynomial drift terms created with fmri.design(hrf, order = 2) orthogonal to the stimuli given in hrf

...

further expanded between-subject factors and covariates

Arguments

hrf

vector or matrix containing expected BOLD response(s) for one session, typically a fmri.stimulus object.

subj

number of subjects in the study.

runs

number of repeated measures within subjects.

group

optional vector to define groups. It is expected one value per subject. A grouping factor can also be part of XG.

XG

optionally, a group-level design matrix of class "data.frame", which contains population parameters such as ages or gender corresponding to the subjects. It is expected one value per subject.

Author

Sibylle Dames

Details

Based on the dimensionality of the hrf object, which provides the total number of scans (time-points) within each session, the entered number of subjects and repeated measures the auxiliary variables: "subj", "run", "scan" and "session" are generated as first part of the returned design matrix.

If no group argument is specified, only one population will be assumed; otherwise group labels are replicated within sessions of the same subject.

First a design matrix for a single run is created by calling: x <- fmri.design(hrf, order = 2). Hence the polynomial drift terms are defined orthogonal to the stimuli (see fmri.design). This matrix is replicated blockwise to all sessions assuming the same experimental design for all runs. The first drift term, a column of ones, is called "drift0" and models an intercept.

If given, further subject characteristics are filled in the design matrix.

References

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

See Also

fmri.stimulus, fmri.design, fmri.lmePar

Examples

Run this code
subj <- 6
runs <- 1
scans <- 121
times <- c(12, 48, 84, 120, 156, 192, 228, 264) 
duration <- 24          
tr <- 2.5

hrf <- fmri.stimulus(scans, times, duration, tr, times = TRUE)
x.group <- fmri.designG(hrf, subj = subj, runs = runs)
# View(x.group)

Run the code above in your browser using DataLab