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.
fmri.designG(hrf, subj =1, runs =1, group =NULL, XG =NULL)
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.
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.
Returns
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