Dear Anja,
> I have a question concerning group analysis in spm99. In the first step
> of statistics, when I want to create the design matrix it is very hard
> to type all this data in. Is it possible to create the Design matrix in
> an matlab window by myself? I loaded the mat-file of an existing
> Design matrix, but I don't understand the numbers in the array xX.X. I
> understood that the number of rows is the number of pictures of my
> data, and that the columns are the different conditions and sessions.
> Somehow the numbers seem to code for the onset times of stimulation
> (negative ones for no stimulation and positive ones for stimulation?),
> but what exactly do the floats code for?
It would be difficult to v create a fMRI design matrix by hand (the
routine spm_fMRI_design was built to do this). You could look at the
batch code written by J-B and his colleagues to help you if you wanted
to pursue a 'by-hand' approach.
The following is the help for spm_fMRI_design which contains the
necessary information on structures.
I hope this helps - Karl
>> help spm_fMRI_design
Assembles a design matrix for fMRI studies
FORMAT [xX,Sess] = spm_fMRI_design(nscan,RT)
nscan - n vector {nscan(n) = number of scans in session n}
RT - intercans interval {seconds}
xX - structure describing design matrix
xX.X - design matrix
xX.dt - time bin {secs}
xX.RT - Repetition time {secs}
xX.iH - vector of H partition (condition effects) indices,
xX.iC - vector of C partition (covariates of interest) indices
xX.iB - vector of B partition (block effects) indices
xX.iG - vector of G partition (nuisance variables) indices
xX.Xnames - cellstr of effect names corresponding to columns
of the design matrix
Sess{s}.BFstr - basis function description string
Sess{s}.DSstr - Design description string
Sess{s}.rep - session replication flag
Sess{s}.row - scan indices for session s
Sess{s}.col - effect indices for session s
Sess{s}.name{i} - of ith trial type for session s
Sess{s}.ind{i} - column indices for ith trial type {within session}
Sess{s}.bf{i} - basis functions for ith trial type
Sess{s}.sf{i} - stick functions for ith trial type
Sess{s}.ons{i} - stimuli onset times for ith trial type (secs)
Sess{s}.pst{i} - peristimulus times for ith trial type (secs)
Sess{s}.Pv{i} - vector of paramters for ith trial type
Sess{s}.Pname{i} - name of paramters for ith trial type
saves SPM_fMRIDesMtx.mat (xX Sess)
_______________________________________________________________________
spm_fMRI_design allows you to build design matrices with separable
session-specific partitions. Each partition may be the same (in which
case it is only necessary to specify it once) or different. Responses
can be either event- or epoch related, where the latter model prolonged
and possibly time-varying responses to state-related changes in
experimental conditions. Event-related response are modelled in terms
of responses to instantaneous events. Mathematically they are both
modelled by convolving a series of delta (or stick) functions,
indicating the onset of an event or epoch with a set of basis
functions. These basis functions can be very simple, like a box car,
or may model voxel-specific forms of evoked responses with a linear
combination of several basis functions (e.g. a Fourier set). Basis
functions can be used to plot estimated responses to single events or
epochs once the parameters (i.e. basis function coefficients) have
been estimated. The importance of basis functions is that they provide
a graceful transition between simple fixed response models (like the
box-car) and finite impulse response (FIR) models, where there is one
basis function for each scan following an event or epoch onset. The
nice thing about basis functions, compared to FIR models, is that data
sampling and stimulus presentation does not have to be sychronized
thereby allowing a uniform and unbiased sampling of peri-stimulus time.
spm_fMRI_design allows you to combine both event- and epoch-related
responses in the same model. You are asked to specify the number
of condition (epoch) or trial (event) types. Epoch and event-related
responses are modeled in exactly the same way by first specifying their
onsets [in terms of stimulus onset asynchronies (SOAs) or explicit onset
times] and then convolving with appropriate basis functions (short ones
for event-related models and longer ones for epoch-related respones).
Enter 0 to skip these if you only want to use regressors you have designed
outside spm_fMRI_design).
Interactions or response modulations can enter at two levels. Firstly
the stick function itself can be modulated by some parametric variate
(this can be time or some trial-specific variate like reaction time)
modeling the interaction between the trial and the variate or, secondly
interactions among the trials themselves can be modeled using a Volterra
series formulation that accommodates interactions over time (and therefore
within and between trial types). The first sort of interaction is
specified by extra (modulated) stick functions in Sess{s}.sf{i}. If
a polynomial expansion of the specified variate is requested there will
be more than one additional column. The corresponding name of the
explanatory variables in X.Xname is Sn(s) trial i(p)[q] for the qth
order expansion of the variate convolved with the pth basis function
of the ith trial in the sth session. If no parametric variate is
specified the name is simply Sn(s) trial i(p). Interactions among
and within trials enter as new trial types but do not have .pst or .ons
fields. These interactions can be characterized later, in results, in
terms of the corresponding second order Volterra Kernels.
The design matrix is assembled on a much finer time scale (X.dt) than the
TR and is then subsampled at the acquisition times.
Sess{s}.ons{i} contains stimulus onset times in seconds relative to the
timing of the first scan and are provided to contruct stimuli when using
stochastic designs
Notes on spm_get_ons, spm_get_bf and spm_Volterra are included below
for convenience.
----------------
spm_get_ons contructs a cell of sparse delta functions specifying the
onset of events or epochs (or both). These are convolved with a basis set
at a later stage to give regressors that enter into the design matrix.
Interactions of evoked responses with some parameter (time or a specified
variate Pv) enter at this stage as additional columns in sf with each delta
function multiplied by the [expansion of the] trial-specific parameter.
If parametric modulation is modeled, P contains the original variate and
Pname is its name. Otherwise P{i} = [] and Pname{i} = '';
----------------
spm_get_bf prompts for basis functions to model event or epoch-related
responses. The basis functions returned are unitary and orthonormal
when defined as a function of peri-stimulus time in time-bins.
It is at this point that the distinction between event and epoch-related
responses enters.
----------------
For first order expansions spm_Volterra simply convolves the causes
(e.g. stick functions) in SF by the basis functions in BF to create
a design matrix X. For second order expansions new entries appear
in IND, BF and name that correspond to the interaction among the
orginal causes (if the events are sufficiently close in time).
The basis functions for these are two dimensional and are used to
assemble the second order kernel in spm_graph.m. Second order effects
are computed for only the first column of SF.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|